提交 32b593bf 编写于 作者: F Filipe Manana 提交者: David Sterba

Btrfs: remove no longer used function to run delayed refs asynchronously

It used to be called from only two places (truncate path and releasing a
transaction handle), but commits 28bad212 ("btrfs: fix truncate
throttling") and db2462a6 ("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.
Reviewed-by: NQu Wenruo <wqu@suse.com>
Signed-off-by: NFilipe Manana <fdmanana@suse.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 e3de9b15
......@@ -2701,8 +2701,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);
......
......@@ -2876,91 +2876,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;
}
/* 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册