[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 <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
OGAWA Hirofumi 2006-02-03 03:04:43 -08:00 committed by Linus Torvalds
parent 5b00226d4d
commit e60e5c50aa
1 changed files with 2 additions and 2 deletions

View File

@ -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);
} }
} }