[PATCH 2/2] Squashfs: Its safe to unlock cache after wake_up*

From: Ajeet Yadav
Date: Fri Dec 23 2011 - 07:32:32 EST


wake_up* calls are non sleeping varients, its safe to
call spin_unlock(cache->lock) after them.

Signed-off-by: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
---
fs/squashfs/cache.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
index 88d986a..1f5a685 100644
--- a/fs/squashfs/cache.c
+++ b/fs/squashfs/cache.c
@@ -131,11 +131,10 @@ struct squashfs_cache_entry
*squashfs_cache_get(struct super_block *sb,
* have looked it up in the cache, and have slept
* waiting for it to become available.
*/
- if (entry->num_waiters) {
- spin_unlock(&cache->lock);
+ if (entry->num_waiters)
wake_up_all(&entry->wait_queue);
- } else
- spin_unlock(&cache->lock);
+
+ spin_unlock(&cache->lock);

goto out;
}
@@ -191,11 +190,8 @@ void squashfs_cache_put(struct squashfs_cache_entry *entry)
* If there's any processes waiting for a block to become
* available, wake one up.
*/
- if (cache->num_waiters) {
- spin_unlock(&cache->lock);
+ if (cache->num_waiters)
wake_up(&cache->wait_queue);
- return;
- }
}
spin_unlock(&cache->lock);
}
--
1.6.0.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/