diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2015-02-27 16:24:22 +0800 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-04-13 07:52:53 -0700 |
commit | 8465ecec9611d60cbbc8e374ecf68453e0dd5b50 (patch) | |
tree | eae55fdac84734729dfbfa6488ec76b6d322199c /fs/btrfs/ctree.h | |
parent | f5a6b1c53bdd44f79e3904c0f5e59f956b49b2c8 (diff) | |
download | lwn-8465ecec9611d60cbbc8e374ecf68453e0dd5b50.tar.gz lwn-8465ecec9611d60cbbc8e374ecf68453e0dd5b50.zip |
btrfs: Check qgroup level in kernel qgroup assign.
Although we have qgroup level check in btrfs-progs, it's not enough
since other programe may still call ioctl directly not using
btrfs-progs. For example, systemd.
But it's btrfs-progs to be blame since we don't provide a
full-function(like subvolume create things) btrfs library with enough
check, and only rely on kernel ioctl.
So Add level checks in kernel too.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 851f2355f3c8..8b851ac7c3fa 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1061,6 +1061,12 @@ struct btrfs_block_group_item { __le64 flags; } __attribute__ ((__packed__)); +#define BTRFS_QGROUP_LEVEL_SHIFT 48 +static inline u64 btrfs_qgroup_level(u64 qgroupid) +{ + return qgroupid >> BTRFS_QGROUP_LEVEL_SHIFT; +} + /* * is subvolume quota turned on? */ |