[dm-devel] [PATCH] dm-bufio: set last_accessed when relinking the buffer

Mikulas Patocka mpatocka at redhat.com
Tue Sep 30 15:54:37 UTC 2014


Hi

Here I'm sending the patch for dm-bufio last_accessed. (bug 1145230)

BTW. do you think that we also need to increase default max_age value (60 
seconds)? What do you think the default value should be?

Mikulas


From: Mikulas Patocka <mpatocka at redhat.com>

The variable last_accessed was set only once when the buffer was created.
In the result, the buffer was discarded after dm_bufio_max_age, even if it
was used recently.

This patch changes it so that last_accessed is set each time the buffer is
moved to the head of the LRU list, so the buffer is discarded if it was
not used in dm_bufio_max_age time.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Cc: stable at vger.kernel.org	# v3.2+

---
 drivers/md/dm-bufio.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-3.17-rc7/drivers/md/dm-bufio.c
===================================================================
--- linux-3.17-rc7.orig/drivers/md/dm-bufio.c	2014-09-30 17:41:31.000000000 +0200
+++ linux-3.17-rc7/drivers/md/dm-bufio.c	2014-09-30 17:41:57.000000000 +0200
@@ -465,6 +465,7 @@ static void __relink_lru(struct dm_buffe
 	c->n_buffers[dirty]++;
 	b->list_mode = dirty;
 	list_move(&b->lru_list, &c->lru[dirty]);
+	b->last_accessed = jiffies;
 }
 
 /*----------------------------------------------------------------




More information about the dm-devel mailing list