Commit 8ba3169d authored by David Sterba's avatar David Sterba Committed by Greg Kroah-Hartman

btrfs: scrub: pass fs_info to scrub_setup_ctx

[ Upstream commit 92f7ba43 ]

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: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent df732920
...@@ -578,12 +578,11 @@ static void scrub_put_ctx(struct scrub_ctx *sctx) ...@@ -578,12 +578,11 @@ static void scrub_put_ctx(struct scrub_ctx *sctx)
scrub_free_ctx(sctx); scrub_free_ctx(sctx);
} }
static noinline_for_stack static noinline_for_stack struct scrub_ctx *scrub_setup_ctx(
struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) struct btrfs_fs_info *fs_info, int is_dev_replace)
{ {
struct scrub_ctx *sctx; struct scrub_ctx *sctx;
int i; int i;
struct btrfs_fs_info *fs_info = dev->fs_info;
sctx = kzalloc(sizeof(*sctx), GFP_KERNEL); sctx = kzalloc(sizeof(*sctx), GFP_KERNEL);
if (!sctx) if (!sctx)
...@@ -592,7 +591,7 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) ...@@ -592,7 +591,7 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace)
sctx->is_dev_replace = is_dev_replace; sctx->is_dev_replace = is_dev_replace;
sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO; sctx->pages_per_rd_bio = SCRUB_PAGES_PER_RD_BIO;
sctx->curr = -1; sctx->curr = -1;
sctx->fs_info = dev->fs_info; sctx->fs_info = fs_info;
for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) { for (i = 0; i < SCRUB_BIOS_PER_SCTX; ++i) {
struct scrub_bio *sbio; struct scrub_bio *sbio;
...@@ -3881,7 +3880,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, ...@@ -3881,7 +3880,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
return ret; return ret;
} }
sctx = scrub_setup_ctx(dev, is_dev_replace); sctx = scrub_setup_ctx(fs_info, is_dev_replace);
if (IS_ERR(sctx)) { if (IS_ERR(sctx)) {
mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->scrub_lock);
mutex_unlock(&fs_info->fs_devices->device_list_mutex); mutex_unlock(&fs_info->fs_devices->device_list_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment