summaryrefslogtreecommitdiff
path: root/qgroup.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2015-02-27 16:26:33 +0800
committerDavid Sterba <dsterba@suse.cz>2015-03-24 00:07:59 +0100
commit9922c42701f8a49d3df743a95c4f7a54c84c7452 (patch)
tree121dd77ff9b992beb0f1f93747b29a9cc2ca656c /qgroup.c
parentf18f8b7afc6f4c714ece79bbd56064d012cbbea4 (diff)
downloadbtrfs-progs-9922c42701f8a49d3df743a95c4f7a54c84c7452.tar.gz
btrfs-progs: Update qgroup status flags and replace qgroup level/subvid calculation with inline function
Ctree.h of btrfs-progs contains wrong flags for btrfs_qgroup_status. Update it with the one in kernel. Also, introduce the inline function btrfs_qgroup_(level/subvid) to get the level/subvolid of qgroup, to replace the old open-coded bit operations. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'qgroup.c')
-rw-r--r--qgroup.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/qgroup.c b/qgroup.c
index 5a4e393..388e382 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -172,8 +172,9 @@ static int print_parent_column(struct btrfs_qgroup *qgroup)
int len = 0;
list_for_each_entry(list, &qgroup->qgroups, next_qgroup) {
- len += printf("%llu/%llu", (list->qgroup)->qgroupid >> 48,
- ((1ll << 48) - 1) & (list->qgroup)->qgroupid);
+ len += printf("%llu/%llu",
+ btrfs_qgroup_level(list->qgroup->qgroupid),
+ btrfs_qgroup_subvid(list->qgroup->qgroupid));
if (!list_is_last(&list->next_qgroup, &qgroup->qgroups))
len += printf(",");
}
@@ -189,8 +190,9 @@ static int print_child_column(struct btrfs_qgroup *qgroup)
int len = 0;
list_for_each_entry(list, &qgroup->members, next_member) {
- len += printf("%llu/%llu", (list->member)->qgroupid >> 48,
- ((1ll << 48) - 1) & (list->member)->qgroupid);
+ len += printf("%llu/%llu",
+ btrfs_qgroup_level(list->member->qgroupid),
+ btrfs_qgroup_subvid(list->member->qgroupid));
if (!list_is_last(&list->next_member, &qgroup->members))
len += printf(",");
}
@@ -219,8 +221,9 @@ static void print_qgroup_column(struct btrfs_qgroup *qgroup,
switch (column) {
case BTRFS_QGROUP_QGROUPID:
- len = printf("%llu/%llu", qgroup->qgroupid >> 48,
- ((1ll << 48) - 1) & qgroup->qgroupid);
+ len = printf("%llu/%llu",
+ btrfs_qgroup_level(qgroup->qgroupid),
+ btrfs_qgroup_subvid(qgroup->qgroupid));
print_qgroup_column_add_blank(BTRFS_QGROUP_QGROUPID, len);
break;
case BTRFS_QGROUP_RFER:
@@ -921,8 +924,9 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
switch (column) {
case BTRFS_QGROUP_QGROUPID:
- sprintf(tmp, "%llu/%llu", (bq->qgroupid >> 48),
- bq->qgroupid & ((1ll << 48) - 1));
+ sprintf(tmp, "%llu/%llu",
+ btrfs_qgroup_level(bq->qgroupid),
+ btrfs_qgroup_subvid(bq->qgroupid));
len = strlen(tmp);
if (btrfs_qgroup_columns[column].max_len < len)
btrfs_qgroup_columns[column].max_len = len;
@@ -951,8 +955,8 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
len = 0;
list_for_each_entry(list, &bq->qgroups, next_qgroup) {
len += sprintf(tmp, "%llu/%llu",
- (list->qgroup)->qgroupid >> 48,
- ((1ll << 48) - 1) & (list->qgroup)->qgroupid);
+ btrfs_qgroup_level(list->qgroup->qgroupid),
+ btrfs_qgroup_subvid(list->qgroup->qgroupid));
if (!list_is_last(&list->next_qgroup, &bq->qgroups))
len += 1;
}
@@ -963,8 +967,8 @@ static void __update_columns_max_len(struct btrfs_qgroup *bq,
len = 0;
list_for_each_entry(list, &bq->members, next_member) {
len += sprintf(tmp, "%llu/%llu",
- (list->member)->qgroupid >> 48,
- ((1ll << 48) - 1) & (list->member)->qgroupid);
+ btrfs_qgroup_level(list->member->qgroupid),
+ btrfs_qgroup_subvid(list->member->qgroupid));
if (!list_is_last(&list->next_member, &bq->members))
len += 1;
}