diff mbox series

[2/2] btrfs-progs: set the proper minimum size for a zoned file system

Message ID 5e89618345f65a3aa4f89c4b7894d28767ea8c42.1688648758.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: some zoned mkfs fixups | expand

Commit Message

Josef Bacik July 6, 2023, 1:06 p.m. UTC
We currently limit the size of the file system to 5 * the zone size,
however we actually want to limit it to 7 * the zone size.  Fix up the
comment and the math to match our actual minimum zoned file system size.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 mkfs/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig July 6, 2023, 2:31 p.m. UTC | #1
On Thu, Jul 06, 2023 at 09:06:57AM -0400, Josef Bacik wrote:
> +	if (opt_zoned && block_count && block_count < 7 * zone_size(file)) {
>  		error("size %llu is too small to make a usable filesystem",
>  			block_count);
>  		error("minimum size for a zoned btrfs filesystem is %llu",
> -			5 * zone_size(file));
> +			7 * zone_size(file));

Wouldn't it be useful to have a helper for this?  Yes, open coding it
only twice and right next to each other is probably ok, but I fear
we'll grow more uses.  And a helper is a really nice way to document
the details anyway.
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index e61ea959..a5af028c 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1441,12 +1441,14 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 	 * 1 zone for the system block group
 	 * 1 zone for a metadata block group
 	 * 1 zone for a data block group
+	 * 1 zone for a relocation block group
+	 * 1 zone for the tree log
 	 */
-	if (opt_zoned && block_count && block_count < 5 * zone_size(file)) {
+	if (opt_zoned && block_count && block_count < 7 * zone_size(file)) {
 		error("size %llu is too small to make a usable filesystem",
 			block_count);
 		error("minimum size for a zoned btrfs filesystem is %llu",
-			5 * zone_size(file));
+			7 * zone_size(file));
 		goto error;
 	}