mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
block: switch bios to blk_status_t
Replace bi_error with a new bi_status to allow for a clear conversion. Note that device mapper overloaded bi_error with a private value, which we'll have to keep arround at least for now and thus propagate to a proper blk_status_t value. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
fc17b6534e
commit
4e4cbee93d
106 changed files with 625 additions and 603 deletions
|
@ -262,8 +262,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
|
|||
if (vecs != inline_vecs)
|
||||
kfree(vecs);
|
||||
|
||||
if (unlikely(bio.bi_error))
|
||||
return bio.bi_error;
|
||||
if (unlikely(bio.bi_status))
|
||||
return blk_status_to_errno(bio.bi_status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -288,16 +288,18 @@ static void blkdev_bio_end_io(struct bio *bio)
|
|||
bool should_dirty = dio->should_dirty;
|
||||
|
||||
if (dio->multi_bio && !atomic_dec_and_test(&dio->ref)) {
|
||||
if (bio->bi_error && !dio->bio.bi_error)
|
||||
dio->bio.bi_error = bio->bi_error;
|
||||
if (bio->bi_status && !dio->bio.bi_status)
|
||||
dio->bio.bi_status = bio->bi_status;
|
||||
} else {
|
||||
if (!dio->is_sync) {
|
||||
struct kiocb *iocb = dio->iocb;
|
||||
ssize_t ret = dio->bio.bi_error;
|
||||
ssize_t ret;
|
||||
|
||||
if (likely(!ret)) {
|
||||
if (likely(!dio->bio.bi_status)) {
|
||||
ret = dio->size;
|
||||
iocb->ki_pos += ret;
|
||||
} else {
|
||||
ret = blk_status_to_errno(dio->bio.bi_status);
|
||||
}
|
||||
|
||||
dio->iocb->ki_complete(iocb, ret, 0);
|
||||
|
@ -363,7 +365,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
|
|||
|
||||
ret = bio_iov_iter_get_pages(bio, iter);
|
||||
if (unlikely(ret)) {
|
||||
bio->bi_error = -EIO;
|
||||
bio->bi_status = BLK_STS_IOERR;
|
||||
bio_endio(bio);
|
||||
break;
|
||||
}
|
||||
|
@ -413,7 +415,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
|
|||
__set_current_state(TASK_RUNNING);
|
||||
|
||||
if (!ret)
|
||||
ret = dio->bio.bi_error;
|
||||
ret = blk_status_to_errno(dio->bio.bi_status);
|
||||
if (likely(!ret))
|
||||
ret = dio->size;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue