summaryrefslogtreecommitdiff
path: root/fs/btrfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-06-17 12:04:13 +0200
committerDavid Sterba <dsterba@suse.com>2022-06-22 20:30:59 +0200
commit23417337ec8d30dc5c9e3b3ae5322d4c8bd7bf63 (patch)
tree381027e834794d6d9093aff3e2a866125c8a71ff /fs/btrfs
parentaed50f9ea295366883b92d0d3c65777b34c42dbf (diff)
downloadlinux-next-23417337ec8d30dc5c9e3b3ae5322d4c8bd7bf63.tar.gz
btrfs: do not return errors from btrfs_submit_dio_bio
Always consume the bio and call the end_io handler on error instead of returning an error and letting the caller handle it. This matches what the block layer submission and the other btrfs bio submission handlers do and avoids any confusion on who needs to handle errors. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Tested-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index de14c0d0b5f6..784c1ad4a963 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7997,8 +7997,8 @@ static void btrfs_end_dio_bio(struct bio *bio)
btrfs_dio_private_put(dip);
}
-static inline blk_status_t btrfs_submit_dio_bio(struct bio *bio,
- struct inode *inode, u64 file_offset, int async_submit)
+static void btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,
+ u64 file_offset, int async_submit)
{
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
struct btrfs_dio_private *dip = bio->bi_private;
@@ -8012,22 +8012,24 @@ static inline blk_status_t btrfs_submit_dio_bio(struct bio *bio,
if (async_submit && !atomic_read(&BTRFS_I(inode)->sync_writers) &&
btrfs_wq_submit_bio(inode, bio, 0, file_offset,
btrfs_submit_bio_start_direct_io))
- return BLK_STS_OK;
+ return;
/*
* If we aren't doing async submit, calculate the csum of the
* bio now.
*/
ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, file_offset, false);
- if (ret)
- return ret;
+ if (ret) {
+ bio->bi_status = ret;
+ bio_endio(bio);
+ return;
+ }
} else {
btrfs_bio(bio)->csum = btrfs_csum_ptr(fs_info, dip->csums,
file_offset - dip->file_offset);
}
map:
btrfs_submit_bio(fs_info, bio, 0);
- return BLK_STS_OK;
}
static void btrfs_submit_direct(const struct iomap_iter *iter,
@@ -8140,14 +8142,7 @@ static void btrfs_submit_direct(const struct iomap_iter *iter,
async_submit = 1;
}
- status = btrfs_submit_dio_bio(bio, inode, file_offset,
- async_submit);
- if (status) {
- bio_put(bio);
- if (submit_len > 0)
- refcount_dec(&dip->refs);
- goto out_err_em;
- }
+ btrfs_submit_dio_bio(bio, inode, file_offset, async_submit);
dio_data->submitted += clone_len;
clone_offset += clone_len;