Commit 48253076 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: open code submit_encoded_read_bio

Open code the functionality in the only caller and remove the now
superfluous error handling there.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f8a02dc6
...@@ -9936,17 +9936,6 @@ struct btrfs_encoded_read_private { ...@@ -9936,17 +9936,6 @@ struct btrfs_encoded_read_private {
blk_status_t status; blk_status_t status;
}; };
static blk_status_t submit_encoded_read_bio(struct btrfs_inode *inode,
struct bio *bio, int mirror_num)
{
struct btrfs_encoded_read_private *priv = btrfs_bio(bio)->private;
struct btrfs_fs_info *fs_info = inode->root->fs_info;
atomic_inc(&priv->pending);
btrfs_submit_bio(fs_info, bio, mirror_num);
return BLK_STS_OK;
}
static void btrfs_encoded_read_endio(struct btrfs_bio *bbio) static void btrfs_encoded_read_endio(struct btrfs_bio *bbio)
{ {
struct btrfs_encoded_read_private *priv = bbio->private; struct btrfs_encoded_read_private *priv = bbio->private;
...@@ -9971,6 +9960,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, ...@@ -9971,6 +9960,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
u64 file_offset, u64 disk_bytenr, u64 file_offset, u64 disk_bytenr,
u64 disk_io_size, struct page **pages) u64 disk_io_size, struct page **pages)
{ {
struct btrfs_fs_info *fs_info = inode->root->fs_info;
struct btrfs_encoded_read_private priv = { struct btrfs_encoded_read_private priv = {
.inode = inode, .inode = inode,
.file_offset = file_offset, .file_offset = file_offset,
...@@ -9999,14 +9989,8 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, ...@@ -9999,14 +9989,8 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
if (!bytes || if (!bytes ||
bio_add_page(bio, pages[i], bytes, 0) < bytes) { bio_add_page(bio, pages[i], bytes, 0) < bytes) {
blk_status_t status; atomic_inc(&priv.pending);
btrfs_submit_bio(fs_info, bio, 0);
status = submit_encoded_read_bio(inode, bio, 0);
if (status) {
WRITE_ONCE(priv.status, status);
bio_put(bio);
goto out;
}
bio = NULL; bio = NULL;
continue; continue;
} }
...@@ -10017,7 +10001,6 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, ...@@ -10017,7 +10001,6 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode,
} }
} }
out:
if (atomic_dec_return(&priv.pending)) if (atomic_dec_return(&priv.pending))
io_wait_event(priv.wait, !atomic_read(&priv.pending)); io_wait_event(priv.wait, !atomic_read(&priv.pending));
/* See btrfs_encoded_read_endio() for ordering. */ /* See btrfs_encoded_read_endio() for ordering. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment