aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/volumes.c7
-rw-r--r--fs/btrfs/volumes.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 31f9036f3171..4ca3c92a54b3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5415,8 +5415,12 @@ static void btrfs_end_bio(struct bio *bio, int err)
5415 set_bit(BIO_UPTODATE, &bio->bi_flags); 5415 set_bit(BIO_UPTODATE, &bio->bi_flags);
5416 err = 0; 5416 err = 0;
5417 } 5417 }
5418
5419 if (likely(bbio->flags & BTRFS_BIO_ORIG_BIO_SUBMITTED))
5420 bio_endio_nodec(bio, err);
5421 else
5422 bio_endio(bio, err);
5418 kfree(bbio); 5423 kfree(bbio);
5419 bio_endio_nodec(bio, err);
5420 } else if (!is_orig_bio) { 5424 } else if (!is_orig_bio) {
5421 bio_put(bio); 5425 bio_put(bio);
5422 } 5426 }
@@ -5671,6 +5675,7 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
5671 BUG_ON(!bio); /* -ENOMEM */ 5675 BUG_ON(!bio); /* -ENOMEM */
5672 } else { 5676 } else {
5673 bio = first_bio; 5677 bio = first_bio;
5678 bbio->flags |= BTRFS_BIO_ORIG_BIO_SUBMITTED;
5674 } 5679 }
5675 5680
5676 submit_stripe_bio(root, bbio, bio, 5681 submit_stripe_bio(root, bbio, bio,
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 1a15bbeb65e2..2aaa00c47816 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -190,11 +190,14 @@ struct btrfs_bio_stripe {
190struct btrfs_bio; 190struct btrfs_bio;
191typedef void (btrfs_bio_end_io_t) (struct btrfs_bio *bio, int err); 191typedef void (btrfs_bio_end_io_t) (struct btrfs_bio *bio, int err);
192 192
193#define BTRFS_BIO_ORIG_BIO_SUBMITTED 0x1
194
193struct btrfs_bio { 195struct btrfs_bio {
194 atomic_t stripes_pending; 196 atomic_t stripes_pending;
195 struct btrfs_fs_info *fs_info; 197 struct btrfs_fs_info *fs_info;
196 bio_end_io_t *end_io; 198 bio_end_io_t *end_io;
197 struct bio *orig_bio; 199 struct bio *orig_bio;
200 unsigned long flags;
198 void *private; 201 void *private;
199 atomic_t error; 202 atomic_t error;
200 int max_errors; 203 int max_errors;