@@ -1687,47 +1687,6 @@ int btrfs_qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *
return 0;
}
-int btrfs_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_or_path(arg);
- qgroup_dst = parse_qgroupid_or_path(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;
-}
static const char * const qgroup_cmd_group_usage[] = {
"btrfs qgroup <command> [options] <path>",
NULL
@@ -38,8 +38,6 @@ struct btrfs_qgroup_stats {
int btrfs_qgroup_inherit_size(struct btrfs_qgroup_inherit *p);
int btrfs_qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg);
-int btrfs_qgroup_inherit_add_copy(struct btrfs_qgroup_inherit **inherit, char *arg,
- int type);
int btrfs_qgroup_query(int fd, u64 qgroupid, struct btrfs_qgroup_stats *stats);
#endif
@@ -281,13 +281,6 @@ static int cmd_subvolume_create(const struct cmd_struct *cmd, int argc, char **a
break;
switch (c) {
- case 'c':
- ret = btrfs_qgroup_inherit_add_copy(&inherit, optarg, 0);
- if (ret) {
- retval = ret;
- goto out;
- }
- break;
case 'i':
ret = btrfs_qgroup_inherit_add_group(&inherit, optarg);
if (ret) {
@@ -685,18 +678,11 @@ static int cmd_subvolume_snapshot(const struct cmd_struct *cmd, int argc, char *
memset(&args, 0, sizeof(args));
optind = 0;
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 = btrfs_qgroup_inherit_add_copy(&inherit, optarg, 0);
- if (res) {
- retval = res;
- goto out;
- }
- break;
case 'i':
res = btrfs_qgroup_inherit_add_group(&inherit, optarg);
if (res) {
@@ -707,13 +693,6 @@ static int cmd_subvolume_snapshot(const struct cmd_struct *cmd, int argc, char *
case 'r':
readonly = true;
break;
- case 'x':
- res = btrfs_qgroup_inherit_add_copy(&inherit, optarg, 1);
- if (res) {
- retval = res;
- goto out;
- }
- break;
default:
usage_unknown_option(cmd, argv);
}
The function btrfs_qgroup_inherit_add_copy() is designed to add a pair of source/destination qgroups into btrfs_qgroup_inherit structure, so that rfer/excl numbers would be copied from the source qgroup into the destination one. This behavior is intentionally hidden since 2016, as such copy will cause qgroup inconsistent immediately and a rescan would reset whatever numbers copied anyway. Now we're going to reject the copy behaviors from kernel, there is no need to keep those hidden (and already disabled for "subvolume create") behaviors. This patch would remove btrfs_qgroup_inherit_add_copy() call, and cleanup those undocumented options. Signed-off-by: Qu Wenruo <wqu@suse.com> --- cmds/qgroup.c | 41 ----------------------------------------- cmds/qgroup.h | 2 -- cmds/subvolume.c | 23 +---------------------- 3 files changed, 1 insertion(+), 65 deletions(-)