summaryrefslogtreecommitdiff
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2018-08-10 13:53:20 +0800
committerDavid Sterba <dsterba@suse.com>2018-10-15 17:23:26 +0200
commit16220c467ad34c8f103566a79ac047ed391f51f2 (patch)
tree3f207d27fd9146fd1cc49408c35c4f7c1e889d27 /fs/btrfs/volumes.c
parentf8b00e0f06e54efed0dc919518841ad0dd2199cd (diff)
btrfs: add assertions where number of devices could go below 0
In preparation to add helper function to deduce the num_devices with replace running, use assert instead of BUG_ON or WARN_ON. The number of devices would not normally drop to 0 due to other checks so the assert is sufficient. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> [ update changelog, adjust the assert condition ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index f4405e430da6..3946fe951b60 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1868,7 +1868,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,
num_devices = fs_devices->num_devices;
btrfs_dev_replace_read_lock(&fs_info->dev_replace);
if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
- WARN_ON(num_devices < 1);
+ ASSERT(num_devices > 1);
num_devices--;
}
btrfs_dev_replace_read_unlock(&fs_info->dev_replace);
@@ -3743,7 +3743,7 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
num_devices = fs_info->fs_devices->num_devices;
btrfs_dev_replace_read_lock(&fs_info->dev_replace);
if (btrfs_dev_replace_is_ongoing(&fs_info->dev_replace)) {
- BUG_ON(num_devices < 1);
+ ASSERT(num_devices > 1);
num_devices--;
}
btrfs_dev_replace_read_unlock(&fs_info->dev_replace);