aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-09-27 06:47:43 -0400
committerJens Axboe <axboe@carl.home.kernel.dk>2007-10-10 03:25:57 -0400
commit6712ecf8f648118c3363c142196418f89a510b90 (patch)
tree347d39a7d5a7ed96d3b1afecd28de2a0f98b98c9 /fs/bio.c
parent5bb23a688b2de23d7765a1dd439d89c038378978 (diff)
Drop 'size' argument from bio_endio and bi_end_io
As bi_end_io is only called once when the reqeust is complete, the 'size' argument is now redundant. Remove it. Now there is no need for bio_endio to subtract the size completed from bi_size. So don't do that either. While we are at it, change bi_end_io to return void. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/bio.c')
-rw-r--r--fs/bio.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 3adecd64ff6e..5f604f269dfa 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -798,13 +798,9 @@ void bio_unmap_user(struct bio *bio)
798 bio_put(bio); 798 bio_put(bio);
799} 799}
800 800
801static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int err) 801static void bio_map_kern_endio(struct bio *bio, int err)
802{ 802{
803 if (bio->bi_size)
804 return 1;
805
806 bio_put(bio); 803 bio_put(bio);
807 return 0;
808} 804}
809 805
810 806
@@ -1002,12 +998,10 @@ void bio_check_pages_dirty(struct bio *bio)
1002/** 998/**
1003 * bio_endio - end I/O on a bio 999 * bio_endio - end I/O on a bio
1004 * @bio: bio 1000 * @bio: bio
1005 * @bytes_done: number of bytes completed
1006 * @error: error, if any 1001 * @error: error, if any
1007 * 1002 *
1008 * Description: 1003 * Description:
1009 * bio_endio() will end I/O on @bytes_done number of bytes. This 1004 * bio_endio() will end I/O on the whole bio. bio_endio() is the
1010 * must always be the whole (remaining) bio. bio_endio() is the
1011 * preferred way to end I/O on a bio, it takes care of clearing 1005 * preferred way to end I/O on a bio, it takes care of clearing
1012 * BIO_UPTODATE on error. @error is 0 on success, and and one of the 1006 * BIO_UPTODATE on error. @error is 0 on success, and and one of the
1013 * established -Exxxx (-EIO, for instance) error values in case 1007 * established -Exxxx (-EIO, for instance) error values in case
@@ -1015,22 +1009,15 @@ void bio_check_pages_dirty(struct bio *bio)
1015 * bio unless they own it and thus know that it has an end_io 1009 * bio unless they own it and thus know that it has an end_io
1016 * function. 1010 * function.
1017 **/ 1011 **/
1018void bio_endio(struct bio *bio, unsigned int bytes_done, int error) 1012void bio_endio(struct bio *bio, int error)
1019{ 1013{
1020 if (error) 1014 if (error)
1021 clear_bit(BIO_UPTODATE, &bio->bi_flags); 1015 clear_bit(BIO_UPTODATE, &bio->bi_flags);
1022 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) 1016 else if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
1023 error = -EIO; 1017 error = -EIO;
1024 1018
1025 if (unlikely(bytes_done != bio->bi_size)) {
1026 printk("%s: want %u bytes done, only %u left\n", __FUNCTION__,
1027 bytes_done, bio->bi_size);
1028 bytes_done = bio->bi_size;
1029 }
1030
1031 bio->bi_size = 0; /* expected by some callees - will be removed */
1032 if (bio->bi_end_io) 1019 if (bio->bi_end_io)
1033 bio->bi_end_io(bio, bytes_done, error); 1020 bio->bi_end_io(bio, error);
1034} 1021}
1035 1022
1036void bio_pair_release(struct bio_pair *bp) 1023void bio_pair_release(struct bio_pair *bp)
@@ -1038,37 +1025,29 @@ void bio_pair_release(struct bio_pair *bp)
1038 if (atomic_dec_and_test(&bp->cnt)) { 1025 if (atomic_dec_and_test(&bp->cnt)) {
1039 struct bio *master = bp->bio1.bi_private; 1026 struct bio *master = bp->bio1.bi_private;
1040 1027
1041 bio_endio(master, master->bi_size, bp->error); 1028 bio_endio(master, bp->error);
1042 mempool_free(bp, bp->bio2.bi_private); 1029 mempool_free(bp, bp->bio2.bi_private);
1043 } 1030 }
1044} 1031}
1045 1032
1046static int bio_pair_end_1(struct bio * bi, unsigned int done, int err) 1033static void bio_pair_end_1(struct bio *bi, int err)
1047{ 1034{
1048 struct bio_pair *bp = container_of(bi, struct bio_pair, bio1); 1035 struct bio_pair *bp = container_of(bi, struct bio_pair, bio1);
1049 1036
1050 if (err) 1037 if (err)
1051 bp->error = err; 1038 bp->error = err;
1052 1039
1053 if (bi->bi_size)
1054 return 1;
1055
1056 bio_pair_release(bp); 1040 bio_pair_release(bp);
1057 return 0;
1058} 1041}
1059 1042
1060static int bio_pair_end_2(struct bio * bi, unsigned int done, int err) 1043static void bio_pair_end_2(struct bio *bi, int err)
1061{ 1044{
1062 struct bio_pair *bp = container_of(bi, struct bio_pair, bio2); 1045 struct bio_pair *bp = container_of(bi, struct bio_pair, bio2);
1063 1046
1064 if (err) 1047 if (err)
1065 bp->error = err; 1048 bp->error = err;
1066 1049
1067 if (bi->bi_size)
1068 return 1;
1069
1070 bio_pair_release(bp); 1050 bio_pair_release(bp);
1071 return 0;
1072} 1051}
1073 1052
1074/* 1053/*