]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm bufio: update last_accessed when relinking a buffer
authorJoe Thornber <ejt@redhat.com>
Tue, 30 Sep 2014 08:32:46 +0000 (09:32 +0100)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:04:46 +0000 (17:04 +0800)
commit eb76faf53b1ff7a77ce3f78cc98ad392ac70c2a0 upstream.

The 'last_accessed' member of the dm_buffer structure was only set when
the the buffer was created.  This led to each buffer being discarded
after dm_bufio_max_age time even if it was used recently.  In practice
this resulted in all thinp metadata being evicted soon after being read
-- this is particularly problematic for metadata intensive workloads
like multithreaded small random IO.

'last_accessed' is now updated each time the buffer is moved to the head
of the LRU list, so the buffer is now properly discarded if it was not
used in dm_bufio_max_age time.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/md/dm-bufio.c

index 6f99500790b3557ca17f23074f81d091be933171..5abc8d62bb56b195502bd0131a0f632f41b8efb7 100644 (file)
@@ -467,6 +467,7 @@ static void __relink_lru(struct dm_buffer *b, int dirty)
        b->list_mode = dirty;
        list_del(&b->lru_list);
        list_add(&b->lru_list, &c->lru[dirty]);
+       b->last_accessed = jiffies;
 }
 
 /*----------------------------------------------------------------