提交 00032d38 编写于 作者: D David Sterba

btrfs: drop extent_io_ops::merge_bio_hook callback

The data and metadata callback implementation both use the same
function. We can remove the call indirection completely.
Reviewed-by: NNikolay Borisov <nborisov@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 05912a3c
...@@ -299,7 +299,6 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, ...@@ -299,7 +299,6 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
struct bio *bio = NULL; struct bio *bio = NULL;
struct compressed_bio *cb; struct compressed_bio *cb;
unsigned long bytes_left; unsigned long bytes_left;
struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
int pg_index = 0; int pg_index = 0;
struct page *page; struct page *page;
u64 first_byte = disk_start; u64 first_byte = disk_start;
...@@ -338,9 +337,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start, ...@@ -338,9 +337,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
page = compressed_pages[pg_index]; page = compressed_pages[pg_index];
page->mapping = inode->i_mapping; page->mapping = inode->i_mapping;
if (bio->bi_iter.bi_size) if (bio->bi_iter.bi_size)
submit = io_tree->ops->merge_bio_hook(page, 0, submit = btrfs_merge_bio_hook(page, 0, PAGE_SIZE, bio, 0);
PAGE_SIZE,
bio, 0);
page->mapping = NULL; page->mapping = NULL;
if (submit || bio_add_page(bio, page, PAGE_SIZE, 0) < if (submit || bio_add_page(bio, page, PAGE_SIZE, 0) <
...@@ -622,9 +619,8 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, ...@@ -622,9 +619,8 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
page->index = em_start >> PAGE_SHIFT; page->index = em_start >> PAGE_SHIFT;
if (comp_bio->bi_iter.bi_size) if (comp_bio->bi_iter.bi_size)
submit = tree->ops->merge_bio_hook(page, 0, submit = btrfs_merge_bio_hook(page, 0, PAGE_SIZE,
PAGE_SIZE, comp_bio, 0);
comp_bio, 0);
page->mapping = NULL; page->mapping = NULL;
if (submit || bio_add_page(comp_bio, page, PAGE_SIZE, 0) < if (submit || bio_add_page(comp_bio, page, PAGE_SIZE, 0) <
......
...@@ -4527,8 +4527,6 @@ static const struct extent_io_ops btree_extent_io_ops = { ...@@ -4527,8 +4527,6 @@ static const struct extent_io_ops btree_extent_io_ops = {
/* mandatory callbacks */ /* mandatory callbacks */
.submit_bio_hook = btree_submit_bio_hook, .submit_bio_hook = btree_submit_bio_hook,
.readpage_end_io_hook = btree_readpage_end_io_hook, .readpage_end_io_hook = btree_readpage_end_io_hook,
/* note we're sharing with inode.c for the merge bio hook */
.merge_bio_hook = btrfs_merge_bio_hook,
.readpage_io_failed_hook = btree_io_failed_hook, .readpage_io_failed_hook = btree_io_failed_hook,
.set_range_writeback = btrfs_set_range_writeback, .set_range_writeback = btrfs_set_range_writeback,
......
...@@ -2784,8 +2784,8 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree, ...@@ -2784,8 +2784,8 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
else else
contig = bio_end_sector(bio) == sector; contig = bio_end_sector(bio) == sector;
if (tree->ops && tree->ops->merge_bio_hook(page, offset, if (tree->ops && btrfs_merge_bio_hook(page, offset, page_size,
page_size, bio, bio_flags)) bio, bio_flags))
can_merge = false; can_merge = false;
if (prev_bio_flags != bio_flags || !contig || !can_merge || if (prev_bio_flags != bio_flags || !contig || !can_merge ||
......
...@@ -101,9 +101,6 @@ struct extent_io_ops { ...@@ -101,9 +101,6 @@ struct extent_io_ops {
int (*readpage_end_io_hook)(struct btrfs_io_bio *io_bio, u64 phy_offset, int (*readpage_end_io_hook)(struct btrfs_io_bio *io_bio, u64 phy_offset,
struct page *page, u64 start, u64 end, struct page *page, u64 start, u64 end,
int mirror); int mirror);
int (*merge_bio_hook)(struct page *page, unsigned long offset,
size_t size, struct bio *bio,
unsigned long bio_flags);
int (*readpage_io_failed_hook)(struct page *page, int failed_mirror); int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
void (*set_range_writeback)(void *private_data, u64 start, u64 end); void (*set_range_writeback)(void *private_data, u64 start, u64 end);
......
...@@ -1898,8 +1898,8 @@ static void btrfs_clear_bit_hook(void *private_data, ...@@ -1898,8 +1898,8 @@ static void btrfs_clear_bit_hook(void *private_data,
} }
/* /*
* extent_io.c merge_bio_hook, this must check the chunk tree to make sure * Merge bio hook, this must check the chunk tree to make sure we don't create
* we don't create bios that span stripes or chunks * bios that span stripes or chunks
* *
* return 1 if page cannot be merged to bio * return 1 if page cannot be merged to bio
* return 0 if page can be merged to bio * return 0 if page can be merged to bio
...@@ -10545,7 +10545,6 @@ static const struct extent_io_ops btrfs_extent_io_ops = { ...@@ -10545,7 +10545,6 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
/* mandatory callbacks */ /* mandatory callbacks */
.submit_bio_hook = btrfs_submit_bio_hook, .submit_bio_hook = btrfs_submit_bio_hook,
.readpage_end_io_hook = btrfs_readpage_end_io_hook, .readpage_end_io_hook = btrfs_readpage_end_io_hook,
.merge_bio_hook = btrfs_merge_bio_hook,
.readpage_io_failed_hook = btrfs_readpage_io_failed_hook, .readpage_io_failed_hook = btrfs_readpage_io_failed_hook,
.set_range_writeback = btrfs_set_range_writeback, .set_range_writeback = btrfs_set_range_writeback,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册