add patch fix-sleep-in-atomic-context-in-grab_mapping_entry
[ext4-patch-queue.git] / mbcache-correctly-handled-e_referenced-bit
blobfe89fb65ed445fd3c664917dfd1420edb0444fd1
1 mbcache: correctly handle 'e_referenced' bit
3 From: Eric Biggers <ebiggers@google.com>
5 mbcache entries have an 'e_referenced' bit which users can set with
6 mb_cache_entry_touch() to indicate that an entry should be given another
7 pass through the LRU list before the shrinker can delete it.  However,
8 mb_cache_shrink() actually would, when seeing an e_referenced entry at
9 the front of the list (the least-recently used end), place it right at
10 the front of the list again.  The next iteration would then remove the
11 entry from the list and delete it.  Consequently, e_referenced had
12 essentially no effect, so ext2/ext4 xattr blocks would sometimes not be
13 reused as often as expected.
15 Fix this by making the shrinker move e_referenced entries to the back of
16 the list rather than the front.
18 Signed-off-by: Eric Biggers <ebiggers@google.com>
19 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20 Reviewed-by: Jan Kara <jack@suse.cz>
21 ---
22  fs/mbcache.c | 2 +-
23  1 file changed, 1 insertion(+), 1 deletion(-)
25 diff --git a/fs/mbcache.c b/fs/mbcache.c
26 index c5bd19f..31e54c2 100644
27 --- a/fs/mbcache.c
28 +++ b/fs/mbcache.c
29 @@ -286,7 +286,7 @@ static unsigned long mb_cache_shrink(struct mb_cache *cache,
30                                          struct mb_cache_entry, e_list);
31                 if (entry->e_referenced) {
32                         entry->e_referenced = 0;
33 -                       list_move_tail(&cache->c_list, &entry->e_list);
34 +                       list_move_tail(&entry->e_list, &cache->c_list);
35                         continue;
36                 }
37                 list_del_init(&entry->e_list);
38 -- 
39 2.8.0.rc3.226.g39d4020
42 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
43 the body of a message to majordomo@vger.kernel.org
44 More majordomo info at  http://vger.kernel.org/majordomo-info.html