btrfs-progs: qgroups: remove support for num_ref_copies/num_excl_copies

Remove btrfs_qgroup_inherit_add_copy() and the command line interface.

This was 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 has been 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 behavior from kernel, there is no
need to keep those hidden (and already disabled for "subvolume create")
case.

Remove btrfs_qgroup_inherit_add_copy() call, and cleanup the
undocumented options.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2024-02-27 14:32:33 +10:30 committed by David Sterba
parent aba8adabcc
commit 4da5f22b23
3 changed files with 1 additions and 65 deletions

View file

@ -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

View file

@ -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

View file

@ -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);
}