diff mbox series

[2/2] btrfs-progs: mkfs: use pretty_size_mode() on min size error

Message ID 20220909214810.761928-3-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: minor mkfs fs size error message enhancements | expand

Commit Message

Luis Chamberlain Sept. 9, 2022, 9:48 p.m. UTC
Use a human pretty output for the error message about the
minimum required size for a btrfs filesystem.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 mkfs/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Wang Yugui Sept. 9, 2022, 11:10 p.m. UTC | #1
Hi,

> Use a human pretty output for the error message about the
> minimum required size for a btrfs filesystem.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>  mkfs/main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mkfs/main.c b/mkfs/main.c
> index ebf462587bd5..8a0018abd01e 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -1388,10 +1388,10 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>  	}
>  	/* Check device/block_count after the nodesize is determined */
>  	if (block_count && block_count < min_dev_size) {
> -		error("size %llu is too small to make a usable filesystem",
> -			block_count);
> -		error("minimum size for btrfs filesystem is %llu",
> -			min_dev_size);
> +		error("Size %s is too small to make a usable filesystem",
> +			pretty_size_mode(block_count, UNITS_DEFAULT));
> +		error("minimum size for btrfs filesystem is %s",
> +			pretty_size_mode(min_dev_size, UNITS_DEFAULT));
>  		goto error;
>  	}
>  	/*
> -- 
> 2.35.1

Could we do a rename 'block_count' to 'byte_count' here?

It is a size based on byte, not based on block (sector).

and '--byte-count' is used as a param of mkfs.btrfs.

Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2022/09/10
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index ebf462587bd5..8a0018abd01e 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1388,10 +1388,10 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 	}
 	/* Check device/block_count after the nodesize is determined */
 	if (block_count && block_count < min_dev_size) {
-		error("size %llu is too small to make a usable filesystem",
-			block_count);
-		error("minimum size for btrfs filesystem is %llu",
-			min_dev_size);
+		error("Size %s is too small to make a usable filesystem",
+			pretty_size_mode(block_count, UNITS_DEFAULT));
+		error("minimum size for btrfs filesystem is %s",
+			pretty_size_mode(min_dev_size, UNITS_DEFAULT));
 		goto error;
 	}
 	/*