[patch] touch_buffer in getblk

Andrea Arcangeli (andrea@suse.de)
Thu, 9 Sep 1999 14:56:25 +0200 (CEST)


Currently we do touch_buffer in brelse instead of in getblk. It make sense
to mark the page referenced in getblk so we'll less probably enter the
try_to_free_buffers path. Also it's possible to cleanup the fast-path of
getblk.

This patch against 2.3.17 will do that:

--- 2.3.17-pre1/fs/buffer.c Wed Sep 8 00:26:01 1999
+++ buffer.c Wed Sep 8 00:30:58 1999
@@ -787,30 +787,29 @@
atomic_set(&bh->b_count, 1);
}
spin_unlock(&free_list[isize].lock);
- if (!bh)
- goto refill;
-
- /* OK, FINALLY we know that this buffer is the only one of its kind,
- * we hold a reference (b_count>0), it is unlocked, and it is clean.
- */
- init_buffer(bh, end_buffer_io_sync, NULL);
- bh->b_dev = dev;
- bh->b_blocknr = block;
- bh->b_state = 1 << BH_Mapped;
-
- /* Insert the buffer into the regular lists */
- insert_into_queues(bh);
- goto out;
+ if (bh)
+ {
+ /* OK, FINALLY we know that this buffer is the only one of
+ its kind, we hold a reference (b_count>0), it is unlocked,
+ and it is clean. */
+ init_buffer(bh, end_buffer_io_sync, NULL);
+ bh->b_dev = dev;
+ bh->b_blocknr = block;
+ bh->b_state = 1 << BH_Mapped;
+
+ /* Insert the buffer into the regular lists */
+ insert_into_queues(bh);
+ out:
+ touch_buffer(bh);
+ return bh;
+ }

/*
* If we block while refilling the free list, somebody may
* create the buffer first ... search the hashes again.
*/
-refill:
refill_freelist(size);
goto repeat;
-out:
- return bh;
}

/*
@@ -881,8 +880,6 @@
*/
void __brelse(struct buffer_head * buf)
{
- touch_buffer(buf);
-
if (atomic_read(&buf->b_count)) {
atomic_dec(&buf->b_count);
return;

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/