btrfs-progs: mkfs: introduce quota runtime feature
Add support for enabling quotas at mkfs time. The qgroup accounting will be consistent, ie. works with --rootdir. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5ac6e02665
commit
6ee4ab24da
|
@ -244,6 +244,12 @@ option or by an ioctl. Some of them can be enabled early, at mkfs time. This
|
||||||
applies to features that need to be enabled once and then the status is
|
applies to features that need to be enabled once and then the status is
|
||||||
permanent, this does not replace mount options.
|
permanent, this does not replace mount options.
|
||||||
|
|
||||||
|
*quota*::
|
||||||
|
(kernel support since 3.4)
|
||||||
|
+
|
||||||
|
Enable quota support (qgroups). The qgroup accounting will be consistent,
|
||||||
|
can be used together with '--rootdir'. See also `btrfs-quota`(8).
|
||||||
|
|
||||||
BLOCK GROUPS, CHUNKS, RAID
|
BLOCK GROUPS, CHUNKS, RAID
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,9 @@ static const struct btrfs_feature mkfs_features[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct btrfs_feature runtime_features[] = {
|
static const struct btrfs_feature runtime_features[] = {
|
||||||
|
{ "quota", BTRFS_RUNTIME_FEATURE_QUOTA, NULL,
|
||||||
|
VERSION_TO_STRING2(3, 4), NULL, 0, NULL, 0,
|
||||||
|
"quota support (qgroups)" },
|
||||||
/* Keep this one last */
|
/* Keep this one last */
|
||||||
{ "list-all", BTRFS_FEATURE_LIST_ALL, NULL }
|
{ "list-all", BTRFS_FEATURE_LIST_ALL, NULL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
|
|
||||||
#define BTRFS_FEATURE_LIST_ALL (1ULL << 63)
|
#define BTRFS_FEATURE_LIST_ALL (1ULL << 63)
|
||||||
|
|
||||||
|
#define BTRFS_RUNTIME_FEATURE_QUOTA (1ULL << 0)
|
||||||
|
|
||||||
void btrfs_list_all_fs_features(u64 mask_disallowed);
|
void btrfs_list_all_fs_features(u64 mask_disallowed);
|
||||||
void btrfs_list_all_runtime_features(u64 mask_disallowed);
|
void btrfs_list_all_runtime_features(u64 mask_disallowed);
|
||||||
char *btrfs_parse_fs_features(char *namelist, u64 *flags);
|
char *btrfs_parse_fs_features(char *namelist, u64 *flags);
|
||||||
|
|
|
@ -1484,6 +1484,13 @@ raid_groups:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runtime_features & BTRFS_RUNTIME_FEATURE_QUOTA) {
|
||||||
|
ret = setup_quota_root(fs_info);
|
||||||
|
if (ret < 0) {
|
||||||
|
error("failed to initialize quota: %d (%m)", ret);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
char features_buf[64];
|
char features_buf[64];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue