Commit 711f447b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: remove the finish_func argument to btrfs_mark_ordered_io_finished

finish_func is always set to finish_ordered_fn, so remove it and also
the now pointless and somewhat confusingly named
__endio_write_update_ordered wrapper.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1f4f639f
...@@ -114,7 +114,6 @@ struct kmem_cache *btrfs_free_space_bitmap_cachep; ...@@ -114,7 +114,6 @@ struct kmem_cache *btrfs_free_space_bitmap_cachep;
static int btrfs_setsize(struct inode *inode, struct iattr *attr); static int btrfs_setsize(struct inode *inode, struct iattr *attr);
static int btrfs_truncate(struct inode *inode, bool skip_writeback); static int btrfs_truncate(struct inode *inode, bool skip_writeback);
static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent);
static noinline int cow_file_range(struct btrfs_inode *inode, static noinline int cow_file_range(struct btrfs_inode *inode,
struct page *locked_page, struct page *locked_page,
u64 start, u64 end, int *page_started, u64 start, u64 end, int *page_started,
...@@ -125,10 +124,6 @@ static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start, ...@@ -125,10 +124,6 @@ static struct extent_map *create_io_em(struct btrfs_inode *inode, u64 start,
u64 ram_bytes, int compress_type, u64 ram_bytes, int compress_type,
int type); int type);
static void __endio_write_update_ordered(struct btrfs_inode *inode,
const u64 offset, const u64 bytes,
const bool uptodate);
/* /*
* btrfs_inode_lock - lock inode i_rwsem based on arguments passed * btrfs_inode_lock - lock inode i_rwsem based on arguments passed
* *
...@@ -223,7 +218,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode, ...@@ -223,7 +218,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
/* /*
* Here we just clear all Ordered bits for every page in the * Here we just clear all Ordered bits for every page in the
* range, then __endio_write_update_ordered() will handle * range, then btrfs_mark_ordered_io_finished() will handle
* the ordered extent accounting for the range. * the ordered extent accounting for the range.
*/ */
btrfs_page_clamp_clear_ordered(inode->root->fs_info, page, btrfs_page_clamp_clear_ordered(inode->root->fs_info, page,
...@@ -244,7 +239,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode, ...@@ -244,7 +239,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
offset = page_offset(locked_page) + PAGE_SIZE; offset = page_offset(locked_page) + PAGE_SIZE;
} }
return __endio_write_update_ordered(inode, offset, bytes, false); return btrfs_mark_ordered_io_finished(inode, NULL, offset, bytes, false);
} }
static int btrfs_dirty_inode(struct inode *inode); static int btrfs_dirty_inode(struct inode *inode);
...@@ -3086,7 +3081,7 @@ static int insert_ordered_extent_file_extent(struct btrfs_trans_handle *trans, ...@@ -3086,7 +3081,7 @@ static int insert_ordered_extent_file_extent(struct btrfs_trans_handle *trans,
* an ordered extent if the range of bytes in the file it covers are * an ordered extent if the range of bytes in the file it covers are
* fully written. * fully written.
*/ */
static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
{ {
struct btrfs_inode *inode = BTRFS_I(ordered_extent->inode); struct btrfs_inode *inode = BTRFS_I(ordered_extent->inode);
struct btrfs_root *root = inode->root; struct btrfs_root *root = inode->root;
...@@ -3295,21 +3290,13 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) ...@@ -3295,21 +3290,13 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
return ret; return ret;
} }
static void finish_ordered_fn(struct btrfs_work *work)
{
struct btrfs_ordered_extent *ordered_extent;
ordered_extent = container_of(work, struct btrfs_ordered_extent, work);
btrfs_finish_ordered_io(ordered_extent);
}
void btrfs_writepage_endio_finish_ordered(struct btrfs_inode *inode, void btrfs_writepage_endio_finish_ordered(struct btrfs_inode *inode,
struct page *page, u64 start, struct page *page, u64 start,
u64 end, bool uptodate) u64 end, bool uptodate)
{ {
trace_btrfs_writepage_end_io_hook(inode, start, end, uptodate); trace_btrfs_writepage_end_io_hook(inode, start, end, uptodate);
btrfs_mark_ordered_io_finished(inode, page, start, end + 1 - start, btrfs_mark_ordered_io_finished(inode, page, start, end + 1 - start, uptodate);
finish_ordered_fn, uptodate);
} }
/* /*
...@@ -7827,8 +7814,8 @@ static int btrfs_dio_iomap_end(struct inode *inode, loff_t pos, loff_t length, ...@@ -7827,8 +7814,8 @@ static int btrfs_dio_iomap_end(struct inode *inode, loff_t pos, loff_t length,
pos += submitted; pos += submitted;
length -= submitted; length -= submitted;
if (write) if (write)
__endio_write_update_ordered(BTRFS_I(inode), pos, btrfs_mark_ordered_io_finished(BTRFS_I(inode), NULL,
length, false); pos, length, false);
else else
unlock_extent(&BTRFS_I(inode)->io_tree, pos, unlock_extent(&BTRFS_I(inode)->io_tree, pos,
pos + length - 1); pos + length - 1);
...@@ -7850,9 +7837,8 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip) ...@@ -7850,9 +7837,8 @@ static void btrfs_dio_private_put(struct btrfs_dio_private *dip)
return; return;
if (btrfs_op(&dip->bio) == BTRFS_MAP_WRITE) { if (btrfs_op(&dip->bio) == BTRFS_MAP_WRITE) {
__endio_write_update_ordered(BTRFS_I(dip->inode), btrfs_mark_ordered_io_finished(BTRFS_I(dip->inode), NULL,
dip->file_offset, dip->file_offset, dip->bytes,
dip->bytes,
!dip->bio.bi_status); !dip->bio.bi_status);
} else { } else {
unlock_extent(&BTRFS_I(dip->inode)->io_tree, unlock_extent(&BTRFS_I(dip->inode)->io_tree,
...@@ -7916,14 +7902,6 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip, ...@@ -7916,14 +7902,6 @@ static blk_status_t btrfs_check_read_dio_bio(struct btrfs_dio_private *dip,
return err; return err;
} }
static void __endio_write_update_ordered(struct btrfs_inode *inode,
const u64 offset, const u64 bytes,
const bool uptodate)
{
btrfs_mark_ordered_io_finished(inode, NULL, offset, bytes,
finish_ordered_fn, uptodate);
}
static blk_status_t btrfs_submit_bio_start_direct_io(struct inode *inode, static blk_status_t btrfs_submit_bio_start_direct_io(struct inode *inode,
struct bio *bio, struct bio *bio,
u64 dio_file_offset) u64 dio_file_offset)
......
...@@ -272,6 +272,14 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry, ...@@ -272,6 +272,14 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry,
spin_unlock_irq(&tree->lock); spin_unlock_irq(&tree->lock);
} }
static void finish_ordered_fn(struct btrfs_work *work)
{
struct btrfs_ordered_extent *ordered_extent;
ordered_extent = container_of(work, struct btrfs_ordered_extent, work);
btrfs_finish_ordered_io(ordered_extent);
}
/* /*
* Mark all ordered extents io inside the specified range finished. * Mark all ordered extents io inside the specified range finished.
* *
...@@ -281,16 +289,13 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry, ...@@ -281,16 +289,13 @@ void btrfs_add_ordered_sum(struct btrfs_ordered_extent *entry,
* Can be NULL for direct IO and compressed write. * Can be NULL for direct IO and compressed write.
* For these cases, callers are ensured they won't execute the * For these cases, callers are ensured they won't execute the
* endio function twice. * endio function twice.
* @finish_func: The function to be executed when all the IO of an ordered
* extent are finished.
* *
* This function is called for endio, thus the range must have ordered * This function is called for endio, thus the range must have ordered
* extent(s) covering it. * extent(s) covering it.
*/ */
void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode, void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode,
struct page *page, u64 file_offset, struct page *page, u64 file_offset,
u64 num_bytes, btrfs_func_t finish_func, u64 num_bytes, bool uptodate)
bool uptodate)
{ {
struct btrfs_ordered_inode_tree *tree = &inode->ordered_tree; struct btrfs_ordered_inode_tree *tree = &inode->ordered_tree;
struct btrfs_fs_info *fs_info = inode->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
...@@ -403,7 +408,7 @@ void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode, ...@@ -403,7 +408,7 @@ void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode,
refcount_inc(&entry->refs); refcount_inc(&entry->refs);
trace_btrfs_ordered_extent_mark_finished(inode, entry); trace_btrfs_ordered_extent_mark_finished(inode, entry);
spin_unlock_irqrestore(&tree->lock, flags); spin_unlock_irqrestore(&tree->lock, flags);
btrfs_init_work(&entry->work, finish_func, NULL, NULL); btrfs_init_work(&entry->work, finish_ordered_fn, NULL, NULL);
btrfs_queue_work(wq, &entry->work); btrfs_queue_work(wq, &entry->work);
spin_lock_irqsave(&tree->lock, flags); spin_lock_irqsave(&tree->lock, flags);
} }
......
...@@ -180,13 +180,14 @@ btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t) ...@@ -180,13 +180,14 @@ btrfs_ordered_inode_tree_init(struct btrfs_ordered_inode_tree *t)
t->last = NULL; t->last = NULL;
} }
int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent);
void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry); void btrfs_put_ordered_extent(struct btrfs_ordered_extent *entry);
void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode, void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode,
struct btrfs_ordered_extent *entry); struct btrfs_ordered_extent *entry);
void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode, void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode,
struct page *page, u64 file_offset, struct page *page, u64 file_offset,
u64 num_bytes, btrfs_func_t finish_func, u64 num_bytes, bool uptodate);
bool uptodate);
bool btrfs_dec_test_ordered_pending(struct btrfs_inode *inode, bool btrfs_dec_test_ordered_pending(struct btrfs_inode *inode,
struct btrfs_ordered_extent **cached, struct btrfs_ordered_extent **cached,
u64 file_offset, u64 io_size); u64 file_offset, u64 io_size);
......
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