btrfs: drop extent_io_ops::merge_bio_hook callback
authorDavid Sterba <dsterba@suse.com>
Wed, 18 Jul 2018 17:28:09 +0000 (19:28 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Aug 2018 11:12:56 +0000 (13:12 +0200)
The data and metadata callback implementation both use the same
function. We can remove the call indirection completely.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/inode.c

index 70dace47258baf9e4ec6046d3b9ec3e880f92806..9bfa66592aa7b2a16722858ce3887848c19e5256 100644 (file)
@@ -299,7 +299,6 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
        struct bio *bio = NULL;
        struct compressed_bio *cb;
        unsigned long bytes_left;
-       struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        int pg_index = 0;
        struct page *page;
        u64 first_byte = disk_start;
@@ -338,9 +337,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
                page = compressed_pages[pg_index];
                page->mapping = inode->i_mapping;
                if (bio->bi_iter.bi_size)
-                       submit = io_tree->ops->merge_bio_hook(page, 0,
-                                                          PAGE_SIZE,
-                                                          bio, 0);
+                       submit = btrfs_merge_bio_hook(page, 0, PAGE_SIZE, bio, 0);
 
                page->mapping = NULL;
                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,
                page->index = em_start >> PAGE_SHIFT;
 
                if (comp_bio->bi_iter.bi_size)
-                       submit = tree->ops->merge_bio_hook(page, 0,
-                                                       PAGE_SIZE,
-                                                       comp_bio, 0);
+                       submit = btrfs_merge_bio_hook(page, 0, PAGE_SIZE,
+                                       comp_bio, 0);
 
                page->mapping = NULL;
                if (submit || bio_add_page(comp_bio, page, PAGE_SIZE, 0) <
index 126460214512d783e7865e17627d47880c9983a0..0c9c029ade72c64e769be520fd355dcd33fd5c79 100644 (file)
@@ -4527,8 +4527,6 @@ static const struct extent_io_ops btree_extent_io_ops = {
        /* mandatory callbacks */
        .submit_bio_hook = btree_submit_bio_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,
        .set_range_writeback = btrfs_set_range_writeback,
 
index 7a19437c6eda86ea20802a27f380fe3bd6762af3..20af0efd7c17dba981cd5572eef3e6f9b5ba82b2 100644 (file)
@@ -2784,8 +2784,8 @@ static int submit_extent_page(unsigned int opf, struct extent_io_tree *tree,
                else
                        contig = bio_end_sector(bio) == sector;
 
-               if (tree->ops && tree->ops->merge_bio_hook(page, offset,
-                                       page_size, bio, bio_flags))
+               if (tree->ops && btrfs_merge_bio_hook(page, offset, page_size,
+                                                     bio, bio_flags))
                        can_merge = false;
 
                if (prev_bio_flags != bio_flags || !contig || !can_merge ||
index 004517f3eb3513482970bb6b4d19104f71d4196f..5c07f87c2ec9e55b5826573e883ce323b2887fcd 100644 (file)
@@ -101,9 +101,6 @@ struct extent_io_ops {
        int (*readpage_end_io_hook)(struct btrfs_io_bio *io_bio, u64 phy_offset,
                                    struct page *page, u64 start, u64 end,
                                    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);
        void (*set_range_writeback)(void *private_data, u64 start, u64 end);
 
index f279e380f36e5714b43e527f2f1c00f063a54686..a72784d5666ffb209aa335184a657de8da84df39 100644 (file)
@@ -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
- * we don't create bios that span stripes or chunks
+ * Merge bio hook, this must check the chunk tree to make sure we don't create
+ * bios that span stripes or chunks
  *
  * return 1 if page cannot 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 = {
        /* mandatory callbacks */
        .submit_bio_hook = btrfs_submit_bio_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,
        .set_range_writeback = btrfs_set_range_writeback,