linux/debian/patches/features/all/rt/fs-fscache-remove-spin_lock...

48 lines
1.7 KiB
Diff

From d32f5420ac164141683c51e8a8fce666423de492 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: Wed, 3 Apr 2013 12:43:30 +0200
Subject: [PATCH] fs/fscache: remove spin_lock() from the condition in while()
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patches-3.10.4-rt1.tar.xz
The spinlock() within the condition in while() will cause a compile error
if it is not a function. This is not a problem on mainline but it does not
look pretty and there is no reason to do it that way.
That patch writes it a little differently and avoids the double condition.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
fs/fscache/page.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
Index: linux-stable/fs/fscache/page.c
===================================================================
--- linux-stable.orig/fs/fscache/page.c
+++ linux-stable/fs/fscache/page.c
@@ -796,11 +796,13 @@ void fscache_invalidate_writes(struct fs
_enter("");
- while (spin_lock(&cookie->stores_lock),
- n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0,
- ARRAY_SIZE(results),
- FSCACHE_COOKIE_PENDING_TAG),
- n > 0) {
+ spin_lock(&cookie->stores_lock);
+ while (1) {
+ n = radix_tree_gang_lookup_tag(&cookie->stores, results, 0,
+ ARRAY_SIZE(results),
+ FSCACHE_COOKIE_PENDING_TAG);
+ if (n == 0)
+ break;
for (i = n - 1; i >= 0; i--) {
page = results[i];
radix_tree_delete(&cookie->stores, page->index);
@@ -810,6 +812,7 @@ void fscache_invalidate_writes(struct fs
for (i = n - 1; i >= 0; i--)
page_cache_release(results[i]);
+ spin_lock(&cookie->stores_lock);
}
spin_unlock(&cookie->stores_lock);