@@ -87,6 +87,11 @@ updating the metadata blocks.
+
NOTE: versions up to 3.11 set the nodesize to 4k.
+*-Q|--quota*::
+Enable btrfs quota support. Result filesystem will have quota enabled and all
+qgroup accounting correct.
+See also `btrfs-quota`(8).
+
*-s|--sectorsize <size>*::
Specify the sectorsize, the minimum data block allocation unit.
+
@@ -949,6 +949,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
char *source_dir = NULL;
bool source_dir_set = false;
bool shrink_rootdir = false;
+ bool enable_quota = false;
u64 source_dir_size = 0;
u64 min_dev_size;
u64 shrink_size;
@@ -985,13 +986,14 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
{ "nodiscard", no_argument, NULL, 'K' },
{ "features", required_argument, NULL, 'O' },
{ "uuid", required_argument, NULL, 'U' },
+ { "quota", required_argument, NULL, 'Q' },
{ "quiet", 0, NULL, 'q' },
{ "shrink", no_argument, NULL, GETOPT_VAL_SHRINK },
{ "help", no_argument, NULL, GETOPT_VAL_HELP },
{ NULL, 0, NULL, 0}
};
- c = getopt_long(argc, argv, "A:b:fl:n:s:m:d:L:O:r:U:VMKq",
+ c = getopt_long(argc, argv, "A:b:fl:n:s:m:d:L:O:r:U:VMKqQ",
long_options, NULL);
if (c < 0)
break;
@@ -1066,6 +1068,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
case 'q':
verbose = 0;
break;
+ case 'Q':
+ enable_quota = true;
+ break;
case GETOPT_VAL_SHRINK:
shrink_rootdir = true;
break;
@@ -1470,6 +1475,15 @@ raid_groups:
}
}
+ if (enable_quota) {
+ ret = setup_quota_root(fs_info);
+ if (ret < 0) {
+ error("failed to initialize quota: %d (%s)", ret,
+ strerror(-ret));
+ goto out;
+ }
+ }
+
if (verbose) {
char features_buf[64];