summaryrefslogtreecommitdiff
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-03 09:37:59 +0200
committerJens Axboe <axboe@fb.com>2017-06-09 09:27:32 -0600
commitd5245d7674d3f026a3178657936759d572d2d5d8 (patch)
tree0ac0a3c54ec6f63efcf6765130e721045bc3f87a /fs/direct-io.c
parent4055351cdbb44e8646ff67b346c80097e1d2c04c (diff)
fs: simplify dio_bio_complete
Only read bio->bi_error once in the common path. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 04247a6c3f73..bb711e4b86c2 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -477,13 +477,12 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
{
struct bio_vec *bvec;
unsigned i;
- int err;
+ int err = bio->bi_error;
- if (bio->bi_error)
+ if (err)
dio->io_error = -EIO;
if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
- err = bio->bi_error;
bio_check_pages_dirty(bio); /* transfers ownership */
} else {
bio_for_each_segment_all(bvec, bio, i) {
@@ -494,7 +493,6 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
set_page_dirty_lock(page);
put_page(page);
}
- err = bio->bi_error;
bio_put(bio);
}
return err;