Commit 7087a9d8 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Remove extent_io_ops::writepage_end_io_hook

This callback is ony ever called for data page writeout so there is no
need to actually abstract it via extent_io_ops. Lets just export it,
remove the definition of the callback and call it directly in the
functions that invoke the callback. Also rename the function to
btrfs_writepage_endio_finish_ordered since what it really does is
account finished io in the ordered extent data structures.  No
functional changes.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent d75855b4
...@@ -229,7 +229,6 @@ static noinline void end_compressed_writeback(struct inode *inode, ...@@ -229,7 +229,6 @@ static noinline void end_compressed_writeback(struct inode *inode,
*/ */
static void end_compressed_bio_write(struct bio *bio) static void end_compressed_bio_write(struct bio *bio)
{ {
struct extent_io_tree *tree;
struct compressed_bio *cb = bio->bi_private; struct compressed_bio *cb = bio->bi_private;
struct inode *inode; struct inode *inode;
struct page *page; struct page *page;
...@@ -248,14 +247,10 @@ static void end_compressed_bio_write(struct bio *bio) ...@@ -248,14 +247,10 @@ static void end_compressed_bio_write(struct bio *bio)
* call back into the FS and do all the end_io operations * call back into the FS and do all the end_io operations
*/ */
inode = cb->inode; inode = cb->inode;
tree = &BTRFS_I(inode)->io_tree;
cb->compressed_pages[0]->mapping = cb->inode->i_mapping; cb->compressed_pages[0]->mapping = cb->inode->i_mapping;
tree->ops->writepage_end_io_hook(cb->compressed_pages[0], btrfs_writepage_endio_finish_ordered(cb->compressed_pages[0],
cb->start, cb->start, cb->start + cb->len - 1, NULL,
cb->start + cb->len - 1, bio->bi_status ? BLK_STS_OK : BLK_STS_NOTSUPP);
NULL,
bio->bi_status ?
BLK_STS_OK : BLK_STS_NOTSUPP);
cb->compressed_pages[0]->mapping = NULL; cb->compressed_pages[0]->mapping = NULL;
end_compressed_writeback(inode, cb); end_compressed_writeback(inode, cb);
......
...@@ -3193,6 +3193,8 @@ int btrfs_run_delalloc_range(void *private_data, struct page *locked_page, ...@@ -3193,6 +3193,8 @@ int btrfs_run_delalloc_range(void *private_data, struct page *locked_page,
u64 start, u64 end, int *page_started, unsigned long *nr_written, u64 start, u64 end, int *page_started, unsigned long *nr_written,
struct writeback_control *wbc); struct writeback_control *wbc);
int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end); int btrfs_writepage_cow_fixup(struct page *page, u64 start, u64 end);
void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
u64 end, struct extent_state *state, int uptodate);
extern const struct dentry_operations btrfs_dentry_operations; extern const struct dentry_operations btrfs_dentry_operations;
/* ioctl.c */ /* ioctl.c */
......
...@@ -2412,14 +2412,9 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset, ...@@ -2412,14 +2412,9 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
void end_extent_writepage(struct page *page, int err, u64 start, u64 end) void end_extent_writepage(struct page *page, int err, u64 start, u64 end)
{ {
int uptodate = (err == 0); int uptodate = (err == 0);
struct extent_io_tree *tree;
int ret = 0; int ret = 0;
tree = &BTRFS_I(page->mapping->host)->io_tree; btrfs_writepage_endio_finish_ordered(page, start, end, NULL, uptodate);
if (tree->ops && tree->ops->writepage_end_io_hook)
tree->ops->writepage_end_io_hook(page, start, end, NULL,
uptodate);
if (!uptodate) { if (!uptodate) {
ClearPageUptodate(page); ClearPageUptodate(page);
...@@ -3342,9 +3337,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3342,9 +3337,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
end = page_end; end = page_end;
if (i_size <= start) { if (i_size <= start) {
if (tree->ops && tree->ops->writepage_end_io_hook) btrfs_writepage_endio_finish_ordered(page, start, page_end,
tree->ops->writepage_end_io_hook(page, start, NULL, 1);
page_end, NULL, 1);
goto done; goto done;
} }
...@@ -3355,9 +3349,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3355,9 +3349,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
u64 offset; u64 offset;
if (cur >= i_size) { if (cur >= i_size) {
if (tree->ops && tree->ops->writepage_end_io_hook) btrfs_writepage_endio_finish_ordered(page, cur,
tree->ops->writepage_end_io_hook(page, cur, page_end, NULL, 1);
page_end, NULL, 1);
break; break;
} }
em = btrfs_get_extent(BTRFS_I(inode), page, pg_offset, cur, em = btrfs_get_extent(BTRFS_I(inode), page, pg_offset, cur,
...@@ -3391,11 +3384,10 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode, ...@@ -3391,11 +3384,10 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
* end_io notification does not happen here for * end_io notification does not happen here for
* compressed extents * compressed extents
*/ */
if (!compressed && tree->ops && if (!compressed)
tree->ops->writepage_end_io_hook) btrfs_writepage_endio_finish_ordered(page, cur,
tree->ops->writepage_end_io_hook(page, cur, cur + iosize - 1,
cur + iosize - 1, NULL, 1);
NULL, 1);
else if (compressed) { else if (compressed) {
/* we don't want to end_page_writeback on /* we don't want to end_page_writeback on
* a compressed extent. this happens * a compressed extent. this happens
...@@ -4079,10 +4071,9 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end, ...@@ -4079,10 +4071,9 @@ int extent_write_locked_range(struct inode *inode, u64 start, u64 end,
if (clear_page_dirty_for_io(page)) if (clear_page_dirty_for_io(page))
ret = __extent_writepage(page, &wbc_writepages, &epd); ret = __extent_writepage(page, &wbc_writepages, &epd);
else { else {
if (tree->ops && tree->ops->writepage_end_io_hook) btrfs_writepage_endio_finish_ordered(page, start,
tree->ops->writepage_end_io_hook(page, start, start + PAGE_SIZE - 1,
start + PAGE_SIZE - 1, NULL, 1);
NULL, 1);
unlock_page(page); unlock_page(page);
} }
put_page(page); put_page(page);
......
...@@ -106,8 +106,6 @@ struct extent_io_ops { ...@@ -106,8 +106,6 @@ struct extent_io_ops {
/* /*
* Optional hooks, called if the pointer is not NULL * Optional hooks, called if the pointer is not NULL
*/ */
void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
struct extent_state *state, int uptodate);
void (*set_bit_hook)(void *private_data, struct extent_state *state, void (*set_bit_hook)(void *private_data, struct extent_state *state,
unsigned *bits); unsigned *bits);
void (*clear_bit_hook)(void *private_data, void (*clear_bit_hook)(void *private_data,
......
...@@ -847,14 +847,14 @@ static noinline void submit_compressed_extents(struct inode *inode, ...@@ -847,14 +847,14 @@ static noinline void submit_compressed_extents(struct inode *inode,
ins.offset, async_extent->pages, ins.offset, async_extent->pages,
async_extent->nr_pages, async_extent->nr_pages,
async_cow->write_flags)) { async_cow->write_flags)) {
struct extent_io_tree *tree = &BTRFS_I(inode)->io_tree;
struct page *p = async_extent->pages[0]; struct page *p = async_extent->pages[0];
const u64 start = async_extent->start; const u64 start = async_extent->start;
const u64 end = start + async_extent->ram_size - 1; const u64 end = start + async_extent->ram_size - 1;
p->mapping = inode->i_mapping; p->mapping = inode->i_mapping;
tree->ops->writepage_end_io_hook(p, start, end, btrfs_writepage_endio_finish_ordered(p, start, end,
NULL, 0); NULL, 0);
p->mapping = NULL; p->mapping = NULL;
extent_clear_unlock_delalloc(inode, start, end, end, extent_clear_unlock_delalloc(inode, start, end, end,
NULL, 0, NULL, 0,
...@@ -3159,7 +3159,7 @@ static void finish_ordered_fn(struct btrfs_work *work) ...@@ -3159,7 +3159,7 @@ static void finish_ordered_fn(struct btrfs_work *work)
btrfs_finish_ordered_io(ordered_extent); btrfs_finish_ordered_io(ordered_extent);
} }
static void btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end, void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start, u64 end,
struct extent_state *state, int uptodate) struct extent_state *state, int uptodate)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
...@@ -10526,7 +10526,6 @@ static const struct extent_io_ops btrfs_extent_io_ops = { ...@@ -10526,7 +10526,6 @@ static const struct extent_io_ops btrfs_extent_io_ops = {
.readpage_io_failed_hook = btrfs_readpage_io_failed_hook, .readpage_io_failed_hook = btrfs_readpage_io_failed_hook,
/* optional callbacks */ /* optional callbacks */
.writepage_end_io_hook = btrfs_writepage_end_io_hook,
.set_bit_hook = btrfs_set_bit_hook, .set_bit_hook = btrfs_set_bit_hook,
.clear_bit_hook = btrfs_clear_bit_hook, .clear_bit_hook = btrfs_clear_bit_hook,
.merge_extent_hook = btrfs_merge_extent_hook, .merge_extent_hook = btrfs_merge_extent_hook,
......
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