aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2024-02-27 14:32:33 +1030
committerDavid Sterba <dsterba@suse.com>2024-03-04 22:55:07 +0100
commit4da5f22b23ba5de2190e762635763d1a8fd225f3 (patch)
tree47aa04ba63eec6b9d9bb835a2cb292d24b2ff4d4
parentaba8adabcccd634f7e168e0d0279b70176e0070b (diff)
downloadbtrfs-progs-4da5f22b23ba5de2190e762635763d1a8fd225f3.tar.gz
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>
-rw-r--r--cmds/qgroup.c41
-rw-r--r--cmds/qgroup.h2
-rw-r--r--cmds/subvolume.c23
3 files changed, 1 insertions, 65 deletions
diff --git a/cmds/qgroup.c b/cmds/qgroup.c
index 20cc14aa..72d68d91 100644
--- a/cmds/qgroup.c
+++ b/cmds/qgroup.c
@@ -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
diff --git a/cmds/qgroup.h b/cmds/qgroup.h
index db48c0c2..1fc10722 100644
--- a/cmds/qgroup.h
+++ b/cmds/qgroup.h
@@ -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
diff --git a/cmds/subvolume.c b/cmds/subvolume.c
index 30ddf178..00c5eacf 100644
--- a/cmds/subvolume.c
+++ b/cmds/subvolume.c
@@ -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);
}