summaryrefslogtreecommitdiff
path: root/fs/btrfs/bio.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-01-21 07:50:04 +0100
committerDavid Sterba <dsterba@suse.com>2023-02-15 19:38:51 +0100
commit7276aa7d38255b40e578267c3634ebc05f5d5236 (patch)
tree05805675b1b445b3f2f2c6fb2df71c7beb7189db /fs/btrfs/bio.c
parent9ba0004bd95e059983b4ca8defad82ab41627e51 (diff)
btrfs: save the bio iter for checksum validation in common code
All callers of btrfs_submit_bio that want to validate checksums currently have to store a copy of the iter in the btrfs_bio. Move the assignment into common code. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/bio.c')
-rw-r--r--fs/btrfs/bio.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index 088817618f57..8285aa49586a 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -63,7 +63,6 @@ struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size,
btrfs_bio_init(bbio, inode, end_io, private);
bio_trim(bio, offset >> 9, size >> 9);
- bbio->iter = bio->bi_iter;
return bio;
}
@@ -254,6 +253,10 @@ void btrfs_submit_bio(struct btrfs_fs_info *fs_info, struct bio *bio, int mirror
BUG();
}
+ /* Save the iter for the end_io handler for data reads. */
+ if (bio_op(bio) == REQ_OP_READ && !(bio->bi_opf & REQ_META))
+ bbio->iter = bio->bi_iter;
+
if (!bioc) {
/* Single mirror read/write fast path */
bbio->mirror_num = mirror_num;