]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
btrfs: scrub: pass fs_info to scrub_setup_ctx
authorDavid Sterba <dsterba@suse.com>
Tue, 4 Dec 2018 15:11:55 +0000 (16:11 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
BugLink: https://bugs.launchpad.net/bugs/1844558
[ Upstream commit 92f7ba434f51e8e9317f1d166105889aa230abd2 ]

We can pass fs_info directly as this is the only member of btrfs_device
that's bing used inside scrub_setup_ctx.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/btrfs/scrub.c

index befbf5be90e56f4d13016d81ba50fc9c5c098d7b..e2a1f59dabba56cafb18e9b9e7d5eaf21dc0572d 100644 (file)
@@ -680,12 +680,11 @@ static void scrub_put_ctx(struct scrub_ctx *sctx)
                scrub_free_ctx(sctx);
 }
 
-static noinline_for_stack
-struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace)
+static noinline_for_stack struct scrub_ctx *scrub_setup_ctx(
+               struct btrfs_fs_info *fs_info, int is_dev_replace)
 {
        struct scrub_ctx *sctx;
        int             i;
-       struct btrfs_fs_info *fs_info = dev->fs_info;
 
        sctx = kzalloc(sizeof(*sctx), GFP_KERNEL);
        if (!sctx)
@@ -694,7 +693,7 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace)
        sctx->is_dev_replace = is_dev_replace;
        sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO;
        sctx->curr = -1;
-       sctx->fs_info = dev->fs_info;
+       sctx->fs_info = fs_info;
        for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) {
                struct scrub_bio *sbio;
 
@@ -4191,7 +4190,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
                return ret;
        }
 
-       sctx = scrub_setup_ctx(dev, is_dev_replace);
+       sctx = scrub_setup_ctx(fs_info, is_dev_replace);
        if (IS_ERR(sctx)) {
                mutex_unlock(&fs_info->scrub_lock);
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);