Skip to content

Commit 735654e

Browse files
committed
btrfs: rename flags for vol args v2
Rename BTRFS_DEVICE_BY_ID so it's more descriptive that we specify the device by id, it'll be part of the public API. The mask of supported flags is also renamed, only for internal use. The error code for unknown flags is EOPNOTSUPP, fixed. Reviewed-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5c5c0df commit 735654e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

fs/btrfs/ioctl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,8 +2687,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
26872687
}
26882688

26892689
/* Check for compatibility reject unknown flags */
2690-
if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS)
2691-
return -ENOTTY;
2690+
if (vol_args->flags & ~BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED)
2691+
return -EOPNOTSUPP;
26922692

26932693
if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
26942694
1)) {
@@ -2697,7 +2697,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
26972697
}
26982698

26992699
mutex_lock(&root->fs_info->volume_mutex);
2700-
if (vol_args->flags & BTRFS_DEVICE_BY_ID) {
2700+
if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID) {
27012701
ret = btrfs_rm_device(root, NULL, vol_args->devid);
27022702
} else {
27032703
vol_args->name[BTRFS_SUBVOL_NAME_MAX] = '\0';
@@ -2707,7 +2707,7 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg)
27072707
atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
27082708

27092709
if (!ret) {
2710-
if (vol_args->flags & BTRFS_DEVICE_BY_ID)
2710+
if (vol_args->flags & BTRFS_DEVICE_SPEC_BY_ID)
27112711
btrfs_info(root->fs_info, "device deleted: id %llu",
27122712
vol_args->devid);
27132713
else

include/uapi/linux/btrfs.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ struct btrfs_ioctl_vol_args {
3636
#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0)
3737
#define BTRFS_SUBVOL_RDONLY (1ULL << 1)
3838
#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
39-
#define BTRFS_DEVICE_BY_ID (1ULL << 3)
40-
#define BTRFS_VOL_ARG_V2_FLAGS \
39+
#define BTRFS_DEVICE_SPEC_BY_ID (1ULL << 3)
40+
41+
#define BTRFS_VOL_ARG_V2_FLAGS_SUPPORTED \
4142
(BTRFS_SUBVOL_CREATE_ASYNC | \
4243
BTRFS_SUBVOL_RDONLY | \
4344
BTRFS_SUBVOL_QGROUP_INHERIT | \
44-
BTRFS_DEVICE_BY_ID)
45+
BTRFS_DEVICE_SPEC_BY_ID)
4546

4647
#define BTRFS_FSID_SIZE 16
4748
#define BTRFS_UUID_SIZE 16

0 commit comments

Comments
 (0)