Skip to contentSkip to conversation

btrfs-progs: some zoned mkfs fixups

PATCH Superseded Josef Bacik 2 participants 5 messages Jul 6, 2023 Btrfs file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover btrfs-progs: some zoned mkfs fixups

Hello,

I'm trying to get the zoned block device tests running and I ran into an issue of a long running test because scratch_mkfs_sized failed and we tried to fill up a giant fs. Fix up the error message and the math so this is correct. Thanks,

Josef

Josef Bacik (2):
btrfs-progs: print out the correct minimum size for zoned file systems
btrfs-progs: set the proper minimum size for a zoned file system

 mkfs/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/2 btrfs-progs: print out the correct minimum size for zoned file systems

While trying to get the ZNS testing running I ran into a problem with making a small file system for one of the tests, but the error output didn't make sense because it said the minimum size was 114294784 bytes, and I was trying to make a file system of size 419430400 bytes. The problem here is that we were spitting out min_dev_size, which isn't the minimum size for the ZNS configuration. Fix the output to match the actual size limit.

---
 mkfs/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/main.c +1 -1
index 972ed111..e61ea959 100644
@@ -1446,7 +1446,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
 		error("size %llu is too small to make a usable filesystem",
 			block_count);
 		error("minimum size for a zoned btrfs filesystem is %llu",
-			min_dev_size);
+			5 * zone_size(file));
 		goto error;
 	}
 
Signature · 1 line
2.41.0
#3 lore raw

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

In reply to Josef Bacik

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.

---
 mkfs/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
mkfs/main.c +4 -2
index e61ea959..a5af028c 100644
@@ -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;
 	}
 
Signature · 1 line
2.41.0
#4 lore raw

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

In reply to Josef Bacik

mkfs/main.c int BOX_MAIN(mkfs)(int argc, char **argv) · line 1451

Quoted 6 lines · Josef Bacik
mkfs/main.c +2 -1
+	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.