diff options
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 35 |
1 files changed, 7 insertions, 28 deletions
@@ -798,13 +798,9 @@ void bio_unmap_user(struct bio *bio) | |||
798 | bio_put(bio); | 798 | bio_put(bio); |
799 | } | 799 | } |
800 | 800 | ||
801 | static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int err) | 801 | static 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 | **/ |
1018 | void bio_endio(struct bio *bio, unsigned int bytes_done, int error) | 1012 | void 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 | ||
1036 | void bio_pair_release(struct bio_pair *bp) | 1023 | void 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 | ||
1046 | static int bio_pair_end_1(struct bio * bi, unsigned int done, int err) | 1033 | static 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 | ||
1060 | static int bio_pair_end_2(struct bio * bi, unsigned int done, int err) | 1043 | static 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 | /* |