Skip to contentSkip to conversation

aa-040-touch_buffer

PATCH Andrew Morton 1 participant 1 message Mar 20, 2002 VFS

lore
Share & tools
lore
#0 lore raw

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.

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

fs/buffer.c renamed from fs/buffer.c~aa-040-touch_buffer +3 -2
@@ -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);