Skip to content

Commit

Permalink
[PATCH] Trivial optimization of ll_rw_block()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
OGAWA Hirofumi authored and Linus Torvalds committed Feb 3, 2006
1 parent 5b00226 commit e60e5c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit e60e5c5

Please sign in to comment.