From: OGAWA Hirofumi Date: Fri, 3 Feb 2006 11:04:43 +0000 (-0800) Subject: [PATCH] Trivial optimization of ll_rw_block() X-Git-Tag: v2.6.16.28-rc1~919 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;ds=sidebyside;h=e60e5c50aa5389db86e96fc52d02bc7db3d23f4a;p=karo-tx-linux.git [PATCH] Trivial optimization of ll_rw_block() The ll_rw_block() needs to get ref-count only if it submits a buffer(). This patch avoids the needless get/put of ref-count. Signed-off-by: OGAWA Hirofumi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/buffer.c b/fs/buffer.c index 5e4a90ee103f..62cfd17dc5fe 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2867,22 +2867,22 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[]) else if (test_set_buffer_locked(bh)) continue; - get_bh(bh); if (rw == WRITE || rw == SWRITE) { if (test_clear_buffer_dirty(bh)) { bh->b_end_io = end_buffer_write_sync; + get_bh(bh); submit_bh(WRITE, bh); continue; } } else { if (!buffer_uptodate(bh)) { bh->b_end_io = end_buffer_read_sync; + get_bh(bh); submit_bh(rw, bh); continue; } } unlock_buffer(bh); - put_bh(bh); } }