Skip to content

Commit

Permalink
btrfs: drop extent_io_ops::set_range_writeback callback
Browse files Browse the repository at this point in the history
The data and metadata callback implementation both use the same
function. We can remove the call indirection and intermediate helper
completely.

Reviewed-by: Nikolay Borisov <[email protected]>
Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed Aug 6, 2018
1 parent 00032d3 commit 5cdc84b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
size_t size, struct bio *bio,
unsigned long bio_flags);
void btrfs_set_range_writeback(void *private_data, u64 start, u64 end);
void btrfs_set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end);
vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf);
int btrfs_readpage(struct file *file, struct page *page);
void btrfs_evict_inode(struct inode *inode);
Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4528,7 +4528,6 @@ static const struct extent_io_ops btree_extent_io_ops = {
.submit_bio_hook = btree_submit_bio_hook,
.readpage_end_io_hook = btree_readpage_end_io_hook,
.readpage_io_failed_hook = btree_io_failed_hook,
.set_range_writeback = btrfs_set_range_writeback,

/* optional callbacks */
};
10 changes: 1 addition & 9 deletions fs/btrfs/extent_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1380,14 +1380,6 @@ void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)
}
}

/*
* helper function to set both pages and extents in the tree writeback
*/
static void set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
{
tree->ops->set_range_writeback(tree->private_data, start, end);
}

/* find the first state struct with 'bits' set after 'start', and
* return it. tree->lock must be held. NULL will returned if
* nothing was found after 'start'
Expand Down Expand Up @@ -3416,7 +3408,7 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
continue;
}

set_range_writeback(tree, cur, cur + iosize - 1);
btrfs_set_range_writeback(tree, cur, cur + iosize - 1);
if (!PageWriteback(page)) {
btrfs_err(BTRFS_I(inode)->root->fs_info,
"page %lu not writeback, cur %llu end %llu",
Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/extent_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ struct extent_io_ops {
struct page *page, u64 start, u64 end,
int mirror);
int (*readpage_io_failed_hook)(struct page *page, int failed_mirror);
void (*set_range_writeback)(void *private_data, u64 start, u64 end);

/*
* Optional hooks, called if the pointer is not NULL
Expand Down
5 changes: 2 additions & 3 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -10487,9 +10487,9 @@ static void btrfs_check_extent_io_range(void *private_data, const char *caller,
}
}

void btrfs_set_range_writeback(void *private_data, u64 start, u64 end)
void btrfs_set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
{
struct inode *inode = private_data;
struct inode *inode = tree->private_data;
unsigned long index = start >> PAGE_SHIFT;
unsigned long end_index = end >> PAGE_SHIFT;
struct page *page;
Expand Down Expand Up @@ -10546,7 +10546,6 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
.submit_bio_hook = btrfs_submit_bio_hook,
.readpage_end_io_hook = btrfs_readpage_end_io_hook,
.readpage_io_failed_hook = btrfs_readpage_io_failed_hook,
.set_range_writeback = btrfs_set_range_writeback,

/* optional callbacks */
.fill_delalloc = run_delalloc_range,
Expand Down

0 comments on commit 5cdc84b

Please sign in to comment.