From 9922c42701f8a49d3df743a95c4f7a54c84c7452 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Fri, 27 Feb 2015 16:26:33 +0800 Subject: 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 Signed-off-by: David Sterba --- ctree.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ctree.h') diff --git a/ctree.h b/ctree.h index 901c3400..51fc8208 100644 --- a/ctree.h +++ b/ctree.h @@ -868,11 +868,21 @@ struct btrfs_csum_item { */ #define BTRFS_SPACE_INFO_GLOBAL_RSV (1ULL << 49) -#define BTRFS_QGROUP_STATUS_OFF 0 -#define BTRFS_QGROUP_STATUS_ON 1 -#define BTRFS_QGROUP_STATUS_SCANNING 2 +#define BTRFS_QGROUP_LEVEL_SHIFT 48 -#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1 << 0) +static inline u64 btrfs_qgroup_level(u64 qgroupid) +{ + return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT; +} + +static inline u64 btrfs_qgroup_subvid(u64 qgroupid) +{ + return qgroupid & ((1ULL << BTRFS_QGROUP_LEVEL_SHIFT) - 1); +} + +#define BTRFS_QGROUP_STATUS_FLAG_ON (1ULL << 0) +#define BTRFS_QGROUP_STATUS_FLAG_RESCAN (1ULL << 1) +#define BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT (1ULL << 2) struct btrfs_qgroup_status_item { __le64 version; -- cgit v1.2.3