Message ID | fca7091998d0aff6e7e4118c09dfa3bce80469d0.1516991902.git.osandov@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 2018年01月27日 02:40, Omar Sandoval wrote: > From: Omar Sandoval <osandov@fb.com> > > The -c option to subvol create and the -c and -x options to subvol > snapshot have never been documented (and -x doesn't actually work > because it's not in the getopt option string). The functionality is > dubious and the kernel interface is being removed, so get rid of these. > Similar patch is already submitted. https://patchwork.kernel.org/patch/10125007/ Thanks, Qu > Signed-off-by: Omar Sandoval <osandov@fb.com> > --- > cmds-subvolume.c | 25 ++----------------------- > qgroup.c | 42 ------------------------------------------ > qgroup.h | 2 -- > 3 files changed, 2 insertions(+), 67 deletions(-) > > diff --git a/cmds-subvolume.c b/cmds-subvolume.c > index dc626a64..f8e34bc8 100644 > --- a/cmds-subvolume.c > +++ b/cmds-subvolume.c > @@ -129,18 +129,11 @@ static int cmd_subvol_create(int argc, char **argv) > DIR *dirstream = NULL; > > while (1) { > - int c = getopt(argc, argv, "c:i:"); > + int c = getopt(argc, argv, "i:"); > if (c < 0) > break; > > switch (c) { > - case 'c': > - res = qgroup_inherit_add_copy(&inherit, optarg, 0); > - if (res) { > - retval = res; > - goto out; > - } > - break; > case 'i': > res = qgroup_inherit_add_group(&inherit, optarg); > if (res) { > @@ -665,18 +658,11 @@ static int cmd_subvol_snapshot(int argc, char **argv) > > memset(&args, 0, sizeof(args)); > while (1) { > - int c = getopt(argc, argv, "c:i:r"); > + int c = getopt(argc, argv, "i:r"); > if (c < 0) > break; > > switch (c) { > - case 'c': > - res = qgroup_inherit_add_copy(&inherit, optarg, 0); > - if (res) { > - retval = res; > - goto out; > - } > - break; > case 'i': > res = qgroup_inherit_add_group(&inherit, optarg); > if (res) { > @@ -687,13 +673,6 @@ static int cmd_subvol_snapshot(int argc, char **argv) > case 'r': > readonly = 1; > break; > - case 'x': > - res = qgroup_inherit_add_copy(&inherit, optarg, 1); > - if (res) { > - retval = res; > - goto out; > - } > - break; > default: > usage(cmd_subvol_snapshot_usage); > } > diff --git a/qgroup.c b/qgroup.c > index 156825fd..e9158a26 100644 > --- a/qgroup.c > +++ b/qgroup.c > @@ -1310,45 +1310,3 @@ int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg) > > return 0; > } > - > -int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg, > - int type) > -{ > - int ret; > - u64 qgroup_src; > - u64 qgroup_dst; > - char *p; > - int pos = 0; > - > - p = strchr(arg, ':'); > - if (!p) { > -bad: > - error("invalid copy specification, missing separator :"); > - return -EINVAL; > - } > - *p = 0; > - qgroup_src = parse_qgroupid(arg); > - qgroup_dst = parse_qgroupid(p + 1); > - *p = ':'; > - > - if (!qgroup_src || !qgroup_dst) > - goto bad; > - > - if (*inherit) > - pos = (*inherit)->num_qgroups + > - (*inherit)->num_ref_copies * 2 * type; > - > - ret = qgroup_inherit_realloc(inherit, 2, pos); > - if (ret) > - return ret; > - > - (*inherit)->qgroups[pos++] = qgroup_src; > - (*inherit)->qgroups[pos++] = qgroup_dst; > - > - if (!type) > - ++(*inherit)->num_ref_copies; > - else > - ++(*inherit)->num_excl_copies; > - > - return 0; > -} > diff --git a/qgroup.h b/qgroup.h > index 875fbdf3..bb6610d7 100644 > --- a/qgroup.h > +++ b/qgroup.h > @@ -92,7 +92,5 @@ int btrfs_qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set, > int is_descending); > int qgroup_inherit_size(struct btrfs_qgroup_inherit *p); > int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg); > -int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg, > - int type); > > #endif >
diff --git a/cmds-subvolume.c b/cmds-subvolume.c index dc626a64..f8e34bc8 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -129,18 +129,11 @@ static int cmd_subvol_create(int argc, char **argv) DIR *dirstream = NULL; while (1) { - int c = getopt(argc, argv, "c:i:"); + int c = getopt(argc, argv, "i:"); if (c < 0) break; switch (c) { - case 'c': - res = qgroup_inherit_add_copy(&inherit, optarg, 0); - if (res) { - retval = res; - goto out; - } - break; case 'i': res = qgroup_inherit_add_group(&inherit, optarg); if (res) { @@ -665,18 +658,11 @@ static int cmd_subvol_snapshot(int argc, char **argv) memset(&args, 0, sizeof(args)); while (1) { - int c = getopt(argc, argv, "c:i:r"); + int c = getopt(argc, argv, "i:r"); if (c < 0) break; switch (c) { - case 'c': - res = qgroup_inherit_add_copy(&inherit, optarg, 0); - if (res) { - retval = res; - goto out; - } - break; case 'i': res = qgroup_inherit_add_group(&inherit, optarg); if (res) { @@ -687,13 +673,6 @@ static int cmd_subvol_snapshot(int argc, char **argv) case 'r': readonly = 1; break; - case 'x': - res = qgroup_inherit_add_copy(&inherit, optarg, 1); - if (res) { - retval = res; - goto out; - } - break; default: usage(cmd_subvol_snapshot_usage); } diff --git a/qgroup.c b/qgroup.c index 156825fd..e9158a26 100644 --- a/qgroup.c +++ b/qgroup.c @@ -1310,45 +1310,3 @@ int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg) return 0; } - -int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg, - int type) -{ - int ret; - u64 qgroup_src; - u64 qgroup_dst; - char *p; - int pos = 0; - - p = strchr(arg, ':'); - if (!p) { -bad: - error("invalid copy specification, missing separator :"); - return -EINVAL; - } - *p = 0; - qgroup_src = parse_qgroupid(arg); - qgroup_dst = parse_qgroupid(p + 1); - *p = ':'; - - if (!qgroup_src || !qgroup_dst) - goto bad; - - if (*inherit) - pos = (*inherit)->num_qgroups + - (*inherit)->num_ref_copies * 2 * type; - - ret = qgroup_inherit_realloc(inherit, 2, pos); - if (ret) - return ret; - - (*inherit)->qgroups[pos++] = qgroup_src; - (*inherit)->qgroups[pos++] = qgroup_dst; - - if (!type) - ++(*inherit)->num_ref_copies; - else - ++(*inherit)->num_excl_copies; - - return 0; -} diff --git a/qgroup.h b/qgroup.h index 875fbdf3..bb6610d7 100644 --- a/qgroup.h +++ b/qgroup.h @@ -92,7 +92,5 @@ int btrfs_qgroup_setup_comparer(struct btrfs_qgroup_comparer_set **comp_set, int is_descending); int qgroup_inherit_size(struct btrfs_qgroup_inherit *p); int qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg); -int qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg, - int type); #endif