]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: pass btrfs_fs_info for deleting snapshots and cleaner
authorJosef Bacik <josef@toxicpanda.com>
Fri, 18 Feb 2022 19:56:11 +0000 (14:56 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:52 +0000 (13:13 +0100)
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>
fs/btrfs/disk-io.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index ed62e81c0b669aaf11c75bd28eb201c93eb531e3..183baeffd9c9e05ba46b45b72797a74bad10e322 100644 (file)
@@ -1947,8 +1947,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
 
 static int cleaner_kthread(void *arg)
 {
-       struct btrfs_root *root = arg;
-       struct btrfs_fs_info *fs_info = root->fs_info;
+       struct btrfs_fs_info *fs_info = (struct btrfs_fs_info *)arg;
        int again;
 
        while (1) {
@@ -1981,7 +1980,7 @@ static int cleaner_kthread(void *arg)
 
                btrfs_run_delayed_iputs(fs_info);
 
-               again = btrfs_clean_one_deleted_snapshot(root);
+               again = btrfs_clean_one_deleted_snapshot(fs_info);
                mutex_unlock(&fs_info->cleaner_mutex);
 
                /*
@@ -3806,7 +3805,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
                goto fail_sysfs;
        }
 
-       fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
+       fs_info->cleaner_kthread = kthread_run(cleaner_kthread, fs_info,
                                               "btrfs-cleaner");
        if (IS_ERR(fs_info->cleaner_kthread))
                goto fail_sysfs;
index 37f6ec2a3c5695cdffc320bf0cb8d2affff0337c..b008c511095897c659050657ce2caca2306cf76c 100644 (file)
@@ -2505,10 +2505,10 @@ cleanup_transaction:
  * because btrfs_commit_super will poke cleaner thread and it will process it a
  * few seconds later.
  */
-int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
+int btrfs_clean_one_deleted_snapshot(struct btrfs_fs_info *fs_info)
 {
+       struct btrfs_root *root;
        int ret;
-       struct btrfs_fs_info *fs_info = root->fs_info;
 
        spin_lock(&fs_info->trans_lock);
        if (list_empty(&fs_info->dead_roots)) {
index ba8a9826eb37567bcd41a3bb1bb36beeb3cff611..970ff316069dd238789b844a554567bdd795f75d 100644 (file)
@@ -217,7 +217,7 @@ int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid);
 void btrfs_add_dead_root(struct btrfs_root *root);
 int btrfs_defrag_root(struct btrfs_root *root);
 void btrfs_maybe_wake_unfinished_drop(struct btrfs_fs_info *fs_info);
-int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root);
+int btrfs_clean_one_deleted_snapshot(struct btrfs_fs_info *fs_info);
 int btrfs_commit_transaction(struct btrfs_trans_handle *trans);
 void btrfs_commit_transaction_async(struct btrfs_trans_handle *trans);
 int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans);