Commit 801da9d2 authored by Joe Thornber's avatar Joe Thornber Committed by Ben Hutchings

dm bufio: update last_accessed when relinking a buffer

commit eb76faf5 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: default avatarJoe Thornber <ejt@redhat.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b60b67ea
...@@ -468,6 +468,7 @@ static void __relink_lru(struct dm_buffer *b, int dirty) ...@@ -468,6 +468,7 @@ static void __relink_lru(struct dm_buffer *b, int dirty)
b->list_mode = dirty; b->list_mode = dirty;
list_del(&b->lru_list); list_del(&b->lru_list);
list_add(&b->lru_list, &c->lru[dirty]); list_add(&b->lru_list, &c->lru[dirty]);
b->last_accessed = jiffies;
} }
/*---------------------------------------------------------------- /*----------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment