mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 09:46:55 +00:00
btrfs-progs: make btrfs_qgroup_level helper match the kernel
We return __u16 in the kernel, as this is actually the size of btrfs_qgroup_level. Adjust the existing helpers and update all the callers to deal with the new size appropriately. This will make syncing the kernel code cleaner. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
03451430de
commit
53f8b8fd01
@ -1290,7 +1290,7 @@ static int report_qgroup_difference(struct qgroup_count *count, int verbose)
|
|||||||
is_different = excl_diff || ref_diff;
|
is_different = excl_diff || ref_diff;
|
||||||
|
|
||||||
if (verbose || (is_different && qgroup_printable(count))) {
|
if (verbose || (is_different && qgroup_printable(count))) {
|
||||||
printf("Counts for qgroup id: %llu/%llu %s\n",
|
printf("Counts for qgroup id: %u/%llu %s\n",
|
||||||
btrfs_qgroup_level(count->qgroupid),
|
btrfs_qgroup_level(count->qgroupid),
|
||||||
btrfs_qgroup_subvolid(count->qgroupid),
|
btrfs_qgroup_subvolid(count->qgroupid),
|
||||||
is_different ? "are different" : "");
|
is_different ? "are different" : "");
|
||||||
@ -1564,7 +1564,7 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
|
|||||||
struct btrfs_key key;
|
struct btrfs_key key;
|
||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
printf("Repair qgroup %llu/%llu\n",
|
printf("Repair qgroup %u/%llu\n",
|
||||||
btrfs_qgroup_level(count->qgroupid),
|
btrfs_qgroup_level(count->qgroupid),
|
||||||
btrfs_qgroup_subvolid(count->qgroupid));
|
btrfs_qgroup_subvolid(count->qgroupid));
|
||||||
|
|
||||||
@ -1578,7 +1578,7 @@ static int repair_qgroup_info(struct btrfs_fs_info *info,
|
|||||||
key.offset = count->qgroupid;
|
key.offset = count->qgroupid;
|
||||||
ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
|
ret = btrfs_search_slot(trans, root, &key, &path, 0, 1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error("could not find disk item for qgroup %llu/%llu",
|
error("could not find disk item for qgroup %u/%llu",
|
||||||
btrfs_qgroup_level(count->qgroupid),
|
btrfs_qgroup_level(count->qgroupid),
|
||||||
btrfs_qgroup_subvolid(count->qgroupid));
|
btrfs_qgroup_subvolid(count->qgroupid));
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
|
@ -245,7 +245,7 @@ static int print_parent_column(struct btrfs_qgroup *qgroup)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
list_for_each_entry(list, &qgroup->qgroups, next_qgroup) {
|
list_for_each_entry(list, &qgroup->qgroups, next_qgroup) {
|
||||||
len += printf("%llu/%llu",
|
len += printf("%u/%llu",
|
||||||
btrfs_qgroup_level(list->qgroup->qgroupid),
|
btrfs_qgroup_level(list->qgroup->qgroupid),
|
||||||
btrfs_qgroup_subvolid(list->qgroup->qgroupid));
|
btrfs_qgroup_subvolid(list->qgroup->qgroupid));
|
||||||
if (!list_is_last(&list->next_qgroup, &qgroup->qgroups))
|
if (!list_is_last(&list->next_qgroup, &qgroup->qgroups))
|
||||||
@ -263,7 +263,7 @@ static int print_child_column(struct btrfs_qgroup *qgroup)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
list_for_each_entry(list, &qgroup->members, next_member) {
|
list_for_each_entry(list, &qgroup->members, next_member) {
|
||||||
len += printf("%llu/%llu",
|
len += printf("%u/%llu",
|
||||||
btrfs_qgroup_level(list->member->qgroupid),
|
btrfs_qgroup_level(list->member->qgroupid),
|
||||||
btrfs_qgroup_subvolid(list->member->qgroupid));
|
btrfs_qgroup_subvolid(list->member->qgroupid));
|
||||||
if (!list_is_last(&list->next_member, &qgroup->members))
|
if (!list_is_last(&list->next_member, &qgroup->members))
|
||||||
@ -336,7 +336,7 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
|
|||||||
switch (column) {
|
switch (column) {
|
||||||
|
|
||||||
case BTRFS_QGROUP_QGROUPID:
|
case BTRFS_QGROUP_QGROUPID:
|
||||||
len = printf("%llu/%llu",
|
len = printf("%u/%llu",
|
||||||
btrfs_qgroup_level(qgroup->qgroupid),
|
btrfs_qgroup_level(qgroup->qgroupid),
|
||||||
btrfs_qgroup_subvolid(qgroup->qgroupid));
|
btrfs_qgroup_subvolid(qgroup->qgroupid));
|
||||||
print_qgroup_column_add_blank(BTRFS_QGROUP_QGROUPID, len);
|
print_qgroup_column_add_blank(BTRFS_QGROUP_QGROUPID, len);
|
||||||
@ -842,7 +842,7 @@ static int update_qgroup_relation(struct qgroup_lookup *qgroup_lookup,
|
|||||||
|
|
||||||
child = qgroup_tree_search(qgroup_lookup, child_id);
|
child = qgroup_tree_search(qgroup_lookup, child_id);
|
||||||
if (!child) {
|
if (!child) {
|
||||||
error("cannot find the qgroup %llu/%llu",
|
error("cannot find the qgroup %u/%llu",
|
||||||
btrfs_qgroup_level(child_id),
|
btrfs_qgroup_level(child_id),
|
||||||
btrfs_qgroup_subvolid(child_id));
|
btrfs_qgroup_subvolid(child_id));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -850,7 +850,7 @@ static int update_qgroup_relation(struct qgroup_lookup *qgroup_lookup,
|
|||||||
|
|
||||||
parent = qgroup_tree_search(qgroup_lookup, parent_id);
|
parent = qgroup_tree_search(qgroup_lookup, parent_id);
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
error("cannot find the qgroup %llu/%llu",
|
error("cannot find the qgroup %u/%llu",
|
||||||
btrfs_qgroup_level(parent_id),
|
btrfs_qgroup_level(parent_id),
|
||||||
btrfs_qgroup_subvolid(parent_id));
|
btrfs_qgroup_subvolid(parent_id));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -1113,7 +1113,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
|
|||||||
switch (column) {
|
switch (column) {
|
||||||
|
|
||||||
case BTRFS_QGROUP_QGROUPID:
|
case BTRFS_QGROUP_QGROUPID:
|
||||||
sprintf(tmp, "%llu/%llu",
|
sprintf(tmp, "%u/%llu",
|
||||||
btrfs_qgroup_level(bq->qgroupid),
|
btrfs_qgroup_level(bq->qgroupid),
|
||||||
btrfs_qgroup_subvolid(bq->qgroupid));
|
btrfs_qgroup_subvolid(bq->qgroupid));
|
||||||
len = strlen(tmp);
|
len = strlen(tmp);
|
||||||
@ -1145,7 +1145,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
|
|||||||
case BTRFS_QGROUP_PARENT:
|
case BTRFS_QGROUP_PARENT:
|
||||||
len = 0;
|
len = 0;
|
||||||
list_for_each_entry(list, &bq->qgroups, next_qgroup) {
|
list_for_each_entry(list, &bq->qgroups, next_qgroup) {
|
||||||
len += sprintf(tmp, "%llu/%llu",
|
len += sprintf(tmp, "%u/%llu",
|
||||||
btrfs_qgroup_level(list->qgroup->qgroupid),
|
btrfs_qgroup_level(list->qgroup->qgroupid),
|
||||||
btrfs_qgroup_subvolid(list->qgroup->qgroupid));
|
btrfs_qgroup_subvolid(list->qgroup->qgroupid));
|
||||||
if (!list_is_last(&list->next_qgroup, &bq->qgroups))
|
if (!list_is_last(&list->next_qgroup, &bq->qgroups))
|
||||||
@ -1157,7 +1157,7 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
|
|||||||
case BTRFS_QGROUP_CHILD:
|
case BTRFS_QGROUP_CHILD:
|
||||||
len = 0;
|
len = 0;
|
||||||
list_for_each_entry(list, &bq->members, next_member) {
|
list_for_each_entry(list, &bq->members, next_member) {
|
||||||
len += sprintf(tmp, "%llu/%llu",
|
len += sprintf(tmp, "%u/%llu",
|
||||||
btrfs_qgroup_level(list->member->qgroupid),
|
btrfs_qgroup_level(list->member->qgroupid),
|
||||||
btrfs_qgroup_subvolid(list->member->qgroupid));
|
btrfs_qgroup_subvolid(list->member->qgroupid));
|
||||||
if (!list_is_last(&list->next_member, &bq->members))
|
if (!list_is_last(&list->next_member, &bq->members))
|
||||||
|
@ -1071,7 +1071,7 @@ enum btrfs_raid_types {
|
|||||||
|
|
||||||
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
||||||
|
|
||||||
static inline u64 btrfs_qgroup_level(u64 qgroupid)
|
static inline __u16 btrfs_qgroup_level(u64 qgroupid)
|
||||||
{
|
{
|
||||||
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ void print_objectid(FILE *stream, u64 objectid, u8 type)
|
|||||||
fprintf(stream, "%llu", (unsigned long long)objectid);
|
fprintf(stream, "%llu", (unsigned long long)objectid);
|
||||||
return;
|
return;
|
||||||
case BTRFS_QGROUP_RELATION_KEY:
|
case BTRFS_QGROUP_RELATION_KEY:
|
||||||
fprintf(stream, "%llu/%llu", btrfs_qgroup_level(objectid),
|
fprintf(stream, "%u/%llu", btrfs_qgroup_level(objectid),
|
||||||
btrfs_qgroup_subvolid(objectid));
|
btrfs_qgroup_subvolid(objectid));
|
||||||
return;
|
return;
|
||||||
case BTRFS_UUID_KEY_SUBVOL:
|
case BTRFS_UUID_KEY_SUBVOL:
|
||||||
@ -815,7 +815,7 @@ void btrfs_print_key(struct btrfs_disk_key *disk_key)
|
|||||||
case BTRFS_QGROUP_RELATION_KEY:
|
case BTRFS_QGROUP_RELATION_KEY:
|
||||||
case BTRFS_QGROUP_INFO_KEY:
|
case BTRFS_QGROUP_INFO_KEY:
|
||||||
case BTRFS_QGROUP_LIMIT_KEY:
|
case BTRFS_QGROUP_LIMIT_KEY:
|
||||||
printf(" %llu/%llu)", btrfs_qgroup_level(offset),
|
printf(" %u/%llu)", btrfs_qgroup_level(offset),
|
||||||
btrfs_qgroup_subvolid(offset));
|
btrfs_qgroup_subvolid(offset));
|
||||||
break;
|
break;
|
||||||
case BTRFS_UUID_KEY_SUBVOL:
|
case BTRFS_UUID_KEY_SUBVOL:
|
||||||
|
@ -1104,7 +1104,7 @@ enum btrfs_raid_types {
|
|||||||
|
|
||||||
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
||||||
|
|
||||||
static inline u64 btrfs_qgroup_level(u64 qgroupid)
|
static inline __u16 btrfs_qgroup_level(u64 qgroupid)
|
||||||
{
|
{
|
||||||
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
||||||
}
|
}
|
||||||
|
@ -908,7 +908,7 @@ struct btrfs_free_space_info {
|
|||||||
#define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
|
#define BTRFS_FREE_SPACE_USING_BITMAPS (1ULL << 0)
|
||||||
|
|
||||||
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
#define BTRFS_QGROUP_LEVEL_SHIFT 48
|
||||||
static __inline__ __u64 btrfs_qgroup_level(__u64 qgroupid)
|
static __inline__ __u16 btrfs_qgroup_level(__u64 qgroupid)
|
||||||
{
|
{
|
||||||
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user