[PATCH 14/17] btrfs: remove now spurious bio submission helpers

Christoph Hellwig
2022-09-01T07:44:11Z

Just call btrfs_submit_bio and btrfs_submit_compressed_read directly from
submit_one_bio now that all additional functionality has moved into
btrfs_submit_bio.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/ctree.h | 3 ---
fs/btrfs/disk-io.c | 6 ------
fs/btrfs/disk-io.h | 1 -
fs/btrfs/extent_io.c | 11 ++++++-----
fs/btrfs/inode.c | 22 ----------------------
5 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 33c3c394e43e3..5e57e3c6a1fd6 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3372,9 +3372,6 @@ void btrfs_inode_safe_disk_i_size_write(struct btrfs_inode *inode, u64 new_i_siz
u64 btrfs_file_extent_end(const struct btrfs_path *path);

/* inode.c */
-void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirror_num);
-void btrfs_submit_data_read_bio(struct inode *inode, struct bio *bio,
- int mirror_num, enum btrfs_compression_type compress_type);
bool btrfs_data_csum_ok(struct btrfs_bio *bbio, struct btrfs_device *dev,
u32 bio_offset, struct bio_vec *bv);
struct extent_map *btrfs_get_extent_fiemap(struct btrfs_inode *inode,
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index ceee039b65ea0..014c06c74155f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -648,12 +648,6 @@ int btree_csum_one_bio(struct btrfs_bio *bbio)
return ret;
}

-void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_num)
-{
- bio->bi_opf |= REQ_META;
- btrfs_submit_bio(btrfs_sb(inode->i_sb), bio, mirror_num);
-}
-
#ifdef CONFIG_MIGRATION
static int btree_migrate_folio(struct address_space *mapping,
struct folio *dst, struct folio *src, enum migrate_mode mode)
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h
index 9d4e0e36f7bb9..3a7ef2352c968 100644
--- a/fs/btrfs/disk-io.h
+++ b/fs/btrfs/disk-io.h
@@ -80,7 +80,6 @@ void btrfs_drop_and_free_fs_root(struct btrfs_fs_info *fs_info,
int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
struct page *page, u64 start, u64 end,
int mirror);
-void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_num);
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info);
#endif
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 46a3f0e33fb69..33e80f8dd0b1b 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -198,12 +198,13 @@ static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
btrfs_bio(bio)->file_offset = page_offset(bv->bv_page) + bv->bv_offset;

if (!is_data_inode(inode))
- btrfs_submit_metadata_bio(inode, bio, mirror_num);
- else if (btrfs_op(bio) == BTRFS_MAP_WRITE)
- btrfs_submit_data_write_bio(inode, bio, mirror_num);
+ bio->bi_opf |= REQ_META;
+
+ if (btrfs_op(bio) == BTRFS_MAP_READ &&
+ bio_ctrl->compress_type != BTRFS_COMPRESS_NONE)
+ btrfs_submit_compressed_read(inode, bio, mirror_num);
else
- btrfs_submit_data_read_bio(inode, bio, mirror_num,
- bio_ctrl->compress_type);
+ btrfs_submit_bio(btrfs_sb(inode->i_sb), bio, mirror_num);

/* The bio is owned by the end_io handler now */
bio_ctrl->bio = NULL;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 25194e75c0812..9c562d36e4570 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2662,28 +2662,6 @@ int btrfs_extract_ordered_extent(struct btrfs_bio *bbio)
return ret;
}

-void btrfs_submit_data_write_bio(struct inode *inode, struct bio *bio, int mirror_num)
-{
- struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-
- btrfs_submit_bio(fs_info, bio, mirror_num);
-}
-
-void btrfs_submit_data_read_bio(struct inode *inode, struct bio *bio,
- int mirror_num, enum btrfs_compression_type compress_type)
-{
- if (compress_type != BTRFS_COMPRESS_NONE) {
- /*
- * btrfs_submit_compressed_read will handle completing the bio
- * if there were any errors, so just return here.
- */
- btrfs_submit_compressed_read(inode, bio, mirror_num);
- return;
- }
-
- btrfs_submit_bio(btrfs_sb(inode->i_sb), bio, mirror_num);
-}
-
/*
* given a list of ordered sums record them in the inode. This happens
* at IO completion time based on sums calculated at bio submission time.
--
2.30.2