Skip to content

Commit d5245d7

Browse files
Christoph Hellwigaxboe
authored andcommitted
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>
1 parent 4055351 commit d5245d7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/direct-io.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,12 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
477477
{
478478
struct bio_vec *bvec;
479479
unsigned i;
480-
int err;
480+
int err = bio->bi_error;
481481

482-
if (bio->bi_error)
482+
if (err)
483483
dio->io_error = -EIO;
484484

485485
if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
486-
err = bio->bi_error;
487486
bio_check_pages_dirty(bio); /* transfers ownership */
488487
} else {
489488
bio_for_each_segment_all(bvec, bio, i) {
@@ -494,7 +493,6 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
494493
set_page_dirty_lock(page);
495494
put_page(page);
496495
}
497-
err = bio->bi_error;
498496
bio_put(bio);
499497
}
500498
return err;

0 commit comments

Comments
 (0)