Commit cadbc0a0 authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: rename btrfs_device::scrub_device to scrub_ctx

btrfs_device::scrub_device is not a device which is being scrubbed,
but it holds the scrub context, so rename to reflect the same. No
functional changes here.
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 922ea899
...@@ -4145,7 +4145,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, ...@@ -4145,7 +4145,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
} }
btrfs_dev_replace_lock(&fs_info->dev_replace, 0); btrfs_dev_replace_lock(&fs_info->dev_replace, 0);
if (dev->scrub_device || if (dev->scrub_ctx ||
(!is_dev_replace && (!is_dev_replace &&
btrfs_dev_replace_is_ongoing(&fs_info->dev_replace))) { btrfs_dev_replace_is_ongoing(&fs_info->dev_replace))) {
btrfs_dev_replace_unlock(&fs_info->dev_replace, 0); btrfs_dev_replace_unlock(&fs_info->dev_replace, 0);
...@@ -4170,7 +4170,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, ...@@ -4170,7 +4170,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
return PTR_ERR(sctx); return PTR_ERR(sctx);
} }
sctx->readonly = readonly; sctx->readonly = readonly;
dev->scrub_device = sctx; dev->scrub_ctx = sctx;
mutex_unlock(&fs_info->fs_devices->device_list_mutex); mutex_unlock(&fs_info->fs_devices->device_list_mutex);
/* /*
...@@ -4205,7 +4205,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, ...@@ -4205,7 +4205,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
memcpy(progress, &sctx->stat, sizeof(*progress)); memcpy(progress, &sctx->stat, sizeof(*progress));
mutex_lock(&fs_info->scrub_lock); mutex_lock(&fs_info->scrub_lock);
dev->scrub_device = NULL; dev->scrub_ctx = NULL;
scrub_workers_put(fs_info); scrub_workers_put(fs_info);
mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->scrub_lock);
...@@ -4262,16 +4262,16 @@ int btrfs_scrub_cancel_dev(struct btrfs_fs_info *fs_info, ...@@ -4262,16 +4262,16 @@ int btrfs_scrub_cancel_dev(struct btrfs_fs_info *fs_info,
struct scrub_ctx *sctx; struct scrub_ctx *sctx;
mutex_lock(&fs_info->scrub_lock); mutex_lock(&fs_info->scrub_lock);
sctx = dev->scrub_device; sctx = dev->scrub_ctx;
if (!sctx) { if (!sctx) {
mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->scrub_lock);
return -ENOTCONN; return -ENOTCONN;
} }
atomic_inc(&sctx->cancel_req); atomic_inc(&sctx->cancel_req);
while (dev->scrub_device) { while (dev->scrub_ctx) {
mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->scrub_lock);
wait_event(fs_info->scrub_pause_wait, wait_event(fs_info->scrub_pause_wait,
dev->scrub_device == NULL); dev->scrub_ctx == NULL);
mutex_lock(&fs_info->scrub_lock); mutex_lock(&fs_info->scrub_lock);
} }
mutex_unlock(&fs_info->scrub_lock); mutex_unlock(&fs_info->scrub_lock);
...@@ -4288,7 +4288,7 @@ int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid, ...@@ -4288,7 +4288,7 @@ int btrfs_scrub_progress(struct btrfs_fs_info *fs_info, u64 devid,
mutex_lock(&fs_info->fs_devices->device_list_mutex); mutex_lock(&fs_info->fs_devices->device_list_mutex);
dev = btrfs_find_device(fs_info, devid, NULL, NULL); dev = btrfs_find_device(fs_info, devid, NULL, NULL);
if (dev) if (dev)
sctx = dev->scrub_device; sctx = dev->scrub_ctx;
if (sctx) if (sctx)
memcpy(progress, &sctx->stat, sizeof(*progress)); memcpy(progress, &sctx->stat, sizeof(*progress));
mutex_unlock(&fs_info->fs_devices->device_list_mutex); mutex_unlock(&fs_info->fs_devices->device_list_mutex);
......
...@@ -131,7 +131,7 @@ struct btrfs_device { ...@@ -131,7 +131,7 @@ struct btrfs_device {
struct completion flush_wait; struct completion flush_wait;
/* per-device scrub information */ /* per-device scrub information */
struct scrub_ctx *scrub_device; struct scrub_ctx *scrub_ctx;
struct btrfs_work work; struct btrfs_work work;
struct rcu_head rcu; struct rcu_head rcu;
......
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