summaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-27 12:46:13 +0200
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 09:25:57 +0200
commit5bb23a688b2de23d7765a1dd439d89c038378978 (patch)
tree15e5e07c28b5aacd19d76ccdd4f7b2b75804d347 /fs/bio.c
parent9cc54d40b8ca01fcefc9151044b6996565061d90 (diff)
downloadlinux-5bb23a688b2de23d7765a1dd439d89c038378978.tar.bz2
Don't decrement bi_size in bio_endio
The only caller of bio_endio that does not pass the full bi_size is end_that_request_first. Also, no ->bi_end_io method is really interested in bi_size being decremented. So move the decrement and related code into ll_rw_blk and merge it with order_bio_endio to form req_bio_endio which does endio functionality specific to request completion. As some ->bi_end_io methods do check bi_size of 0, we set it thus for now, but that will go in the next patch. Signed-off-by: Neil Brown <neilb@suse.de> ### Diffstat output ./block/ll_rw_blk.c | 42 +++++++++++++++++++++++++++--------------- ./fs/bio.c | 23 +++++++++++------------ 2 files changed, 38 insertions(+), 27 deletions(-) diff .prev/block/ll_rw_blk.c ./block/ll_rw_blk.c Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/bio.c')
-rw-r--r--fs/bio.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 5720b940bb5f..3adecd64ff6e 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1006,13 +1006,14 @@ void bio_check_pages_dirty(struct bio *bio)
* @error: error, if any
*
* Description:
- * bio_endio() will end I/O on @bytes_done number of bytes. This may be
- * just a partial part of the bio, or it may be the whole bio. bio_endio()
- * is the preferred way to end I/O on a bio, it takes care of decrementing
- * bi_size and clearing BIO_UPTODATE on error. @error is 0 on success, and
- * and one of the established -Exxxx (-EIO, for instance) error values in
- * case something went wrong. Noone should call bi_end_io() directly on
- * a bio unless they own it and thus know that it has an end_io function.
+ * bio_endio() will end I/O on @bytes_done number of bytes. This
+ * must always be the whole (remaining) bio. bio_endio() is the
+ * preferred way to end I/O on a bio, it takes care of clearing
+ * BIO_UPTODATE on error. @error is 0 on success, and and one of the
+ * established -Exxxx (-EIO, for instance) error values in case
+ * something went wrong. Noone should call bi_end_io() directly on a
+ * bio unless they own it and thus know that it has an end_io
+ * function.
**/
void bio_endio(struct bio *bio, unsigned int bytes_done, int error)
{
@@ -1021,16 +1022,14 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error)
else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
error = -EIO;
- if (unlikely(bytes_done > bio->bi_size)) {
+ if (unlikely(bytes_done != bio->bi_size)) {
printk("%s: want %u bytes done, only %u left\n", __FUNCTION__,
bytes_done, bio->bi_size);
bytes_done = bio->bi_size;
}
- bio->bi_size -= bytes_done;
- bio->bi_sector += (bytes_done >> 9);
-
- if (bio->bi_size && bio->bi_end_io)
+ bio->bi_size = 0; /* expected by some callees - will be removed */
+ if (bio->bi_end_io)
bio->bi_end_io(bio, bytes_done, error);
}