Skip to content

Commit

Permalink
btrfs-progs: remove unused qgroup functions
Browse files Browse the repository at this point in the history
Remove functions that after the previous two patches are no longer
referenced.

Signed-off-by: Mark Harmstone <[email protected]>
Co-authored-by: Omar Sandoval <[email protected]>
  • Loading branch information
2 people authored and kdave committed Sep 17, 2024
1 parent 4419306 commit e55ee92
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
64 changes: 0 additions & 64 deletions cmds/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1688,70 +1688,6 @@ static int qgroup_parse_sort_string(const char *opt_arg,
return ret;
}

int btrfs_qgroup_inherit_size(struct btrfs_qgroup_inherit *p)
{
return sizeof(*p) + sizeof(p->qgroups[0]) *
(p->num_qgroups + 2 * p->num_ref_copies +
2 * p->num_excl_copies);
}

static int qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n,
int pos)
{
struct btrfs_qgroup_inherit *out;
int nitems = 0;

if (*inherit) {
nitems = (*inherit)->num_qgroups +
(*inherit)->num_ref_copies +
(*inherit)->num_excl_copies;
}

out = calloc(1, sizeof(*out) + sizeof(out->qgroups[0]) * (nitems + n));
if (out == NULL) {
error_msg(ERROR_MSG_MEMORY, NULL);
return -ENOMEM;
}

if (*inherit) {
struct btrfs_qgroup_inherit *i = *inherit;
int s = sizeof(out->qgroups[0]);

out->num_qgroups = i->num_qgroups;
out->num_ref_copies = i->num_ref_copies;
out->num_excl_copies = i->num_excl_copies;
memcpy(out->qgroups, i->qgroups, pos * s);
memcpy(out->qgroups + pos + n, i->qgroups + pos,
(nitems - pos) * s);
}
free(*inherit);
*inherit = out;

return 0;
}

int btrfs_qgroup_inherit_add_group(struct btrfs_qgroup_inherit **inherit, char *arg)
{
int ret;
u64 qgroupid = parse_qgroupid_or_path(arg);
int pos = 0;

if (qgroupid == 0) {
error("invalid qgroup specification, qgroupid must not 0");
return -EINVAL;
}

if (*inherit)
pos = (*inherit)->num_qgroups;
ret = qgroup_inherit_realloc(inherit, 1, pos);
if (ret)
return ret;

(*inherit)->qgroups[(*inherit)->num_qgroups++] = qgroupid;

return 0;
}

static const char * const qgroup_cmd_group_usage[] = {
"btrfs qgroup <command> [options] <path>",
NULL
Expand Down
2 changes: 0 additions & 2 deletions cmds/qgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ struct btrfs_qgroup_stats {
struct btrfs_qgroup_limit limit;
};

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_query(int fd, u64 qgroupid, struct btrfs_qgroup_stats *stats);

#endif

0 comments on commit e55ee92

Please sign in to comment.