diff mbox series

btrfs-progs: resize: remove the misleading warning for the 'max' option

Message ID 5c9857b5fbc5b71984594f2f7e6f666cc435118a.1736525474.git.anand.jain@oracle.com (mailing list archive)
State New
Headers show
Series btrfs-progs: resize: remove the misleading warning for the 'max' option | expand

Commit Message

Anand Jain Jan. 10, 2025, 4:11 p.m. UTC
The disk max size cannot be 256MiB because Btrfs does not allow creating
a filesystem on disks smaller than 256MiB.

Remove the incorrect warning for the 'max' option.`

$ btrfs fi resize max /btrfs
Resize device id 1 (/dev/sda) from 3.00GiB to max
WARNING: the new size 0 (0.00B) is < 256MiB, this may be rejected by kernel

Fixes: 158a25af0d61 ("btrfs-progs: fi resize: warn if new size is < 256M")
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 cmds/filesystem.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/cmds/filesystem.c b/cmds/filesystem.c
index d2605bda3640..1771ea5b99db 100644
--- a/cmds/filesystem.c
+++ b/cmds/filesystem.c
@@ -1269,7 +1269,8 @@  static const char * const cmd_filesystem_resize_usage[] = {
 	NULL
 };
 
-static int check_resize_args(const char *amount, const char *path, u64 *devid_ret) {
+static int check_resize_args(const char *amount, const char *path, u64 *devid_ret)
+{
 	struct btrfs_ioctl_fs_info_args fi_args;
 	struct btrfs_ioctl_dev_info_args *di_args = NULL;
 	int ret, i, dev_idx = -1;
@@ -1402,15 +1403,16 @@  static int check_resize_args(const char *amount, const char *path, u64 *devid_re
 		}
 		new_size = round_down(new_size, fi_args.sectorsize);
 		res_str = pretty_size_mode(new_size, UNITS_DEFAULT);
+
+		if (new_size < 256 * SZ_1M)
+   warning("the new size %lld (%s) is < 256MiB, this may be rejected by kernel",
+			new_size, pretty_size_mode(new_size, UNITS_DEFAULT));
 	}
 
 	pr_verbose(LOG_DEFAULT, "Resize device id %lld (%s) from %s to %s\n", devid,
 		di_args[dev_idx].path,
 		pretty_size_mode(di_args[dev_idx].total_bytes, UNITS_DEFAULT),
 		res_str);
-	if (new_size < 256 * SZ_1M)
-		warning("the new size %lld (%s) is < 256MiB, this may be rejected by kernel",
-			new_size, pretty_size_mode(new_size, UNITS_DEFAULT));
 
 out:
 	free(di_args);