Btrfs: remove no longer used function to run delayed refs asynchronously
PATCH 1/1 Btrfs: remove no longer used function to run delayed refs asynchronously
From: Filipe Manana <[email protected]>
It used to be called from only two places (truncate path and releasing a transaction handle), but commits 28bad2125767c5 ("btrfs: fix truncate throttling") and db2462a6ad3dc4 ("btrfs: don't run delayed refs in the end transaction logic") removed their calls to this function, so it's not used anymore. Just remove it and all its helpers.
--- fs/btrfs/ctree.h | 2 -- fs/btrfs/extent-tree.c | 91 -------------------------------------------------- 2 files changed, 93 deletions(-)
fs/btrfs/ctree.h +0 -2
@@ -2698,8 +2698,6 @@ void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg);void btrfs_put_block_group (struct btrfs_block_group_cache *cache);int btrfs_run_delayed_refs (struct btrfs_trans_handle *trans,unsigned long count); -int btrfs_async_run_delayed_refs (struct btrfs_fs_info *fs_info, -unsigned long count,u64 transid,int wait);void btrfs_cleanup_ref_head_accounting (struct btrfs_fs_info *fs_info,struct btrfs_delayed_ref_root *delayed_refs,struct btrfs_delayed_ref_head *head);
fs/btrfs/extent-tree.c +0 -91
97 lines not on this page · raw message
Signature · 1 line
2.11.0
Quoted 9 lines · On 2019/4/17 下午5:28, [email protected] wrote:
From: Filipe Manana <[email protected]>
It used to be called from only two places (truncate path and releasing a transaction handle), but commits
28bad2125767c5("btrfs: fix truncate throttling") anddb2462a6ad3dc4("btrfs: don't run delayed refs in the end transaction logic") removed their calls to this function, so it's not used anymore. Just remove it and all its helpers.Signed-off-by Filipe Manana <[email protected]>
Glad to know that delayed refs can only be executed when committing a transaction.
Thanks,
Qu
Quoted 121 lines
--- fs/btrfs/ctree.h | 2 -- fs/btrfs/extent-tree.c | 91 -------------------------------------------------- 2 files changed, 93 deletions(-)fs/btrfs/ctree.h +0
-2@@ -2698,8 +2698,6 @@ void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg);void btrfs_put_block_group (struct btrfs_block_group_cache *cache);int btrfs_run_delayed_refs (struct btrfs_trans_handle *trans,unsigned long count); -int btrfs_async_run_delayed_refs (struct btrfs_fs_info *fs_info, -unsigned long count,u64 transid,int wait);void btrfs_cleanup_ref_head_accounting (struct btrfs_fs_info *fs_info,struct btrfs_delayed_ref_root *delayed_refs,struct btrfs_delayed_ref_head *head);fs/btrfs/extent-tree.c +0
-91@@ -2877,97 +2877,6 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans)return btrfs_check_space_for_delayed_refs (trans->fs_info); } -struct async_delayed_refs { -struct btrfs_root *root; -u64 transid; -int count; -int error; -int sync; -struct completion wait; -struct btrfs_work work; -}; - -static inline struct async_delayed_refs * -to_async_delayed_refs (struct btrfs_work *work) -{ - return container_of(work, struct async_delayed_refs, work); -} - -static void delayed_ref_async_start (struct btrfs_work *work) -{ -struct async_delayed_refs *async =to_async_delayed_refs (work); -struct btrfs_trans_handle *trans; -struct btrfs_fs_info *fs_info = async->root->fs_info; -int ret; - -/* if the commit is already started, we don't need to wait here */ -if (btrfs_transaction_blocked (fs_info)) - goto done; - - trans =btrfs_join_transaction (async->root); -if (IS_ERR (trans)) { - async->error =PTR_ERR (trans); - goto done; - } - -/* -* trans->sync means that when we call end_transaction, we won't -* wait on delayed refs -*/ - trans->sync = true; - -/* Don't bother flushing if we got into a different transaction */ -if (trans->transid > async->transid) - goto end; - - ret =btrfs_run_delayed_refs (trans, async->count); -if (ret) - async->error = ret; -end: - ret =btrfs_end_transaction (trans); -if (ret && !async->error) - async->error = ret; -done: -if (async->sync) -complete (&async->wait); -else -kfree (async); -} - -int btrfs_async_run_delayed_refs (struct btrfs_fs_info *fs_info, -unsigned long count,u64 transid,int wait) -{ -struct async_delayed_refs *async; -int ret; - - async =kmalloc (sizeof (*async),GFP_NOFS ); -if (!async) -return -ENOMEM ; - - async->root = fs_info->tree_root; - async->count = count; - async->error =0 ; - async->transid = transid; -if (wait) - async->sync =1 ; -else - async->sync =0 ; -init_completion (&async->wait); - -btrfs_init_work (&async->work, btrfs_extent_refs_helper, - delayed_ref_async_start,NULL ,NULL ); - -btrfs_queue_work (fs_info->extent_workers, &async->work); - -if (wait) { -wait_for_completion (&async->wait); - ret = async->error; -kfree (async); -return ret; - } -return 0 ; -} -/* * this starts processing the delayed reference count updates and * extent insertions we have queued up so far. count can be
Quoted 9 lines · On Wed, Apr 17, 2019 at 10:28:47AM +0100, [email protected] wrote:
From: Filipe Manana <[email protected]>
It used to be called from only two places (truncate path and releasing a transaction handle), but commits
28bad2125767c5("btrfs: fix truncate throttling") anddb2462a6ad3dc4("btrfs: don't run delayed refs in the end transaction logic") removed their calls to this function, so it's not used anymore. Just remove it and all its helpers.Signed-off-by Filipe Manana <[email protected]>
Added to misc-next, thanks.