Commit e60e5c50 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds

[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: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5b00226d
...@@ -2867,22 +2867,22 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[]) ...@@ -2867,22 +2867,22 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
else if (test_set_buffer_locked(bh)) else if (test_set_buffer_locked(bh))
continue; continue;
get_bh(bh);
if (rw == WRITE || rw == SWRITE) { if (rw == WRITE || rw == SWRITE) {
if (test_clear_buffer_dirty(bh)) { if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
submit_bh(WRITE, bh); submit_bh(WRITE, bh);
continue; continue;
} }
} else { } else {
if (!buffer_uptodate(bh)) { if (!buffer_uptodate(bh)) {
bh->b_end_io = end_buffer_read_sync; bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
submit_bh(rw, bh); submit_bh(rw, bh);
continue; continue;
} }
} }
unlock_buffer(bh); unlock_buffer(bh);
put_bh(bh);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment