]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/direct-io.c
block: add a bi_error field to struct bio
[mirror_ubuntu-bionic-kernel.git] / fs / direct-io.c
index 745d2342651a0b87fcb9dd5b5b50e95b9129e117..e1639c8c14d5da48ab30a5cc93d085c924bb0a6c 100644 (file)
@@ -285,7 +285,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio);
 /*
  * Asynchronous IO callback. 
  */
-static void dio_bio_end_aio(struct bio *bio, int error)
+static void dio_bio_end_aio(struct bio *bio)
 {
        struct dio *dio = bio->bi_private;
        unsigned long remaining;
@@ -318,7 +318,7 @@ static void dio_bio_end_aio(struct bio *bio, int error)
  * During I/O bi_private points at the dio.  After I/O, bi_private is used to
  * implement a singly-linked list of completed BIOs, at dio->bio_list.
  */
-static void dio_bio_end_io(struct bio *bio, int error)
+static void dio_bio_end_io(struct bio *bio)
 {
        struct dio *dio = bio->bi_private;
        unsigned long flags;
@@ -345,9 +345,9 @@ void dio_end_io(struct bio *bio, int error)
        struct dio *dio = bio->bi_private;
 
        if (dio->is_async)
-               dio_bio_end_aio(bio, error);
+               dio_bio_end_aio(bio);
        else
-               dio_bio_end_io(bio, error);
+               dio_bio_end_io(bio);
 }
 EXPORT_SYMBOL_GPL(dio_end_io);
 
@@ -457,11 +457,10 @@ static struct bio *dio_await_one(struct dio *dio)
  */
 static int dio_bio_complete(struct dio *dio, struct bio *bio)
 {
-       const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
        struct bio_vec *bvec;
        unsigned i;
 
-       if (!uptodate)
+       if (bio->bi_error)
                dio->io_error = -EIO;
 
        if (dio->is_async && dio->rw == READ) {
@@ -476,7 +475,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
                }
                bio_put(bio);
        }
-       return uptodate ? 0 : -EIO;
+       return bio->bi_error;
 }
 
 /*