diff options
author | NeilBrown <neilb@suse.de> | 2007-09-27 06:46:12 -0400 |
---|---|---|
committer | Jens Axboe <axboe@carl.home.kernel.dk> | 2007-10-10 03:25:57 -0400 |
commit | 9cc54d40b8ca01fcefc9151044b6996565061d90 (patch) | |
tree | a6336d7040dd6e656819257e00d493147c790496 /fs/bio.c | |
parent | d24517d793f21edab1a411da95f2c45cb88a84aa (diff) |
Only call bi_end_io once for any bio
Currently bi_end_io can be called multiple times as sub-requests
complete. However no ->bi_end_io function wants to know about that.
So only call when the bio is complete.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./fs/bio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff .prev/fs/bio.c ./fs/bio.c
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1018,6 +1018,8 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error) | |||
1018 | { | 1018 | { |
1019 | if (error) | 1019 | if (error) |
1020 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | 1020 | clear_bit(BIO_UPTODATE, &bio->bi_flags); |
1021 | else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | ||
1022 | error = -EIO; | ||
1021 | 1023 | ||
1022 | if (unlikely(bytes_done > bio->bi_size)) { | 1024 | if (unlikely(bytes_done > bio->bi_size)) { |
1023 | printk("%s: want %u bytes done, only %u left\n", __FUNCTION__, | 1025 | printk("%s: want %u bytes done, only %u left\n", __FUNCTION__, |
@@ -1028,7 +1030,7 @@ void bio_endio(struct bio *bio, unsigned int bytes_done, int error) | |||
1028 | bio->bi_size -= bytes_done; | 1030 | bio->bi_size -= bytes_done; |
1029 | bio->bi_sector += (bytes_done >> 9); | 1031 | bio->bi_sector += (bytes_done >> 9); |
1030 | 1032 | ||
1031 | if (bio->bi_end_io) | 1033 | if (bio->bi_size && bio->bi_end_io) |
1032 | bio->bi_end_io(bio, bytes_done, error); | 1034 | bio->bi_end_io(bio, bytes_done, error); |
1033 | } | 1035 | } |
1034 | 1036 | ||