Skip to content

Commit 33c4418

Browse files
josefbacikkdave
authored andcommitted
btrfs: pass btrfs_fs_info for deleting snapshots and cleaner
We're passing a root around here, but we only really need the fs_info, so fix up btrfs_clean_one_deleted_snapshot() to take an fs_info instead, and then fix up all the callers appropriately. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c067da8 commit 33c4418

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

fs/btrfs/disk-io.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,8 +1947,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
19471947

19481948
static int cleaner_kthread(void *arg)
19491949
{
1950-
struct btrfs_root *root = arg;
1951-
struct btrfs_fs_info *fs_info = root->fs_info;
1950+
struct btrfs_fs_info *fs_info = (struct btrfs_fs_info *)arg;
19521951
int again;
19531952

19541953
while (1) {
@@ -1981,7 +1980,7 @@ static int cleaner_kthread(void *arg)
19811980

19821981
btrfs_run_delayed_iputs(fs_info);
19831982

1984-
again = btrfs_clean_one_deleted_snapshot(root);
1983+
again = btrfs_clean_one_deleted_snapshot(fs_info);
19851984
mutex_unlock(&fs_info->cleaner_mutex);
19861985

19871986
/*
@@ -3806,7 +3805,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
38063805
goto fail_sysfs;
38073806
}
38083807

3809-
fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
3808+
fs_info->cleaner_kthread = kthread_run(cleaner_kthread, fs_info,
38103809
"btrfs-cleaner");
38113810
if (IS_ERR(fs_info->cleaner_kthread))
38123811
goto fail_sysfs;

fs/btrfs/transaction.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,10 +2505,10 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
25052505
* because btrfs_commit_super will poke cleaner thread and it will process it a
25062506
* few seconds later.
25072507
*/
2508-
int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
2508+
int btrfs_clean_one_deleted_snapshot(struct btrfs_fs_info *fs_info)
25092509
{
2510+
struct btrfs_root *root;
25102511
int ret;
2511-
struct btrfs_fs_info *fs_info = root->fs_info;
25122512

25132513
spin_lock(&fs_info->trans_lock);
25142514
if (list_empty(&fs_info->dead_roots)) {

fs/btrfs/transaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid);
217217
void btrfs_add_dead_root(struct btrfs_root *root);
218218
int btrfs_defrag_root(struct btrfs_root *root);
219219
void btrfs_maybe_wake_unfinished_drop(struct btrfs_fs_info *fs_info);
220-
int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root);
220+
int btrfs_clean_one_deleted_snapshot(struct btrfs_fs_info *fs_info);
221221
int btrfs_commit_transaction(struct btrfs_trans_handle *trans);
222222
void btrfs_commit_transaction_async(struct btrfs_trans_handle *trans);
223223
int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans);

0 commit comments

Comments
 (0)