]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/btrfs/volumes.c
block: add a bi_error field to struct bio
[mirror_ubuntu-bionic-kernel.git] / fs / btrfs / volumes.c
index fbe7c104531c9e5eaf8b347f46d0b8a783f88322..8f2ca18c71f4232fbc95c02760fa48ebfc5948db 100644 (file)
@@ -5741,23 +5741,23 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
        return 0;
 }
 
-static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio, int err)
+static inline void btrfs_end_bbio(struct btrfs_bio *bbio, struct bio *bio)
 {
        bio->bi_private = bbio->private;
        bio->bi_end_io = bbio->end_io;
-       bio_endio(bio, err);
+       bio_endio(bio);
 
        btrfs_put_bbio(bbio);
 }
 
-static void btrfs_end_bio(struct bio *bio, int err)
+static void btrfs_end_bio(struct bio *bio)
 {
        struct btrfs_bio *bbio = bio->bi_private;
        int is_orig_bio = 0;
 
-       if (err) {
+       if (bio->bi_error) {
                atomic_inc(&bbio->error);
-               if (err == -EIO || err == -EREMOTEIO) {
+               if (bio->bi_error == -EIO || bio->bi_error == -EREMOTEIO) {
                        unsigned int stripe_index =
                                btrfs_io_bio(bio)->stripe_index;
                        struct btrfs_device *dev;
@@ -5795,17 +5795,16 @@ static void btrfs_end_bio(struct bio *bio, int err)
                 * beyond the tolerance of the btrfs bio
                 */
                if (atomic_read(&bbio->error) > bbio->max_errors) {
-                       err = -EIO;
+                       bio->bi_error = -EIO;
                } else {
                        /*
                         * this bio is actually up to date, we didn't
                         * go over the max number of errors
                         */
-                       set_bit(BIO_UPTODATE, &bio->bi_flags);
-                       err = 0;
+                       bio->bi_error = 0;
                }
 
-               btrfs_end_bbio(bbio, bio, err);
+               btrfs_end_bbio(bbio, bio);
        } else if (!is_orig_bio) {
                bio_put(bio);
        }
@@ -5826,7 +5825,7 @@ static noinline void btrfs_schedule_bio(struct btrfs_root *root,
        struct btrfs_pending_bios *pending_bios;
 
        if (device->missing || !device->bdev) {
-               bio_endio(bio, -EIO);
+               bio_io_error(bio);
                return;
        }
 
@@ -5973,8 +5972,8 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
 
                btrfs_io_bio(bio)->mirror_num = bbio->mirror_num;
                bio->bi_iter.bi_sector = logical >> 9;
-
-               btrfs_end_bbio(bbio, bio, -EIO);
+               bio->bi_error = -EIO;
+               btrfs_end_bbio(bbio, bio);
        }
 }