[LWN Logo]
[LWN.net]
From:	 Andrew Morton <akpm@zip.com.au>
To:	 lkml <linux-kernel@vger.kernel.org>
Subject: aa-040-touch_buffer
Date:	 Tue, 19 Mar 2002 19:56:38 -0800



Move the touch_buffer() from bread into getblk().

Fair enough.  The touch_buffer() call tells the VM "please don't evict
this page, I'm about to use it".  Doing it in getblk() will provide
better coverage than doing it in bread().  I would actually prefer to
do it in get_hash_table(), but that's a minor detail.



=====================================

--- 2.4.19-pre3/fs/buffer.c~aa-040-touch_buffer	Tue Mar 19 19:48:54 2002
+++ 2.4.19-pre3-akpm/fs/buffer.c	Tue Mar 19 19:49:15 2002
@@ -1032,8 +1032,10 @@ struct buffer_head * getblk(kdev_t dev, 
 		struct buffer_head * bh;
 
 		bh = get_hash_table(dev, block, size);
-		if (bh)
+		if (bh) {
+			touch_buffer(bh);
 			return bh;
+		}
 
 		if (!grow_buffers(dev, block, size))
 			free_more_memory();
@@ -1196,7 +1198,6 @@ struct buffer_head * bread(kdev_t dev, i
 	struct buffer_head * bh;
 
 	bh = getblk(dev, block, size);
-	touch_buffer(bh);
 	if (buffer_uptodate(bh))
 		return bh;
 	ll_rw_block(READ, 1, &bh);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/