public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: resize: remove the misleading warning for the 'max' option
@ 2025-01-10 16:11 Anand Jain
  2025-02-03 21:47 ` Anand Jain
  2025-03-18  9:46 ` Dominique Martinet
  0 siblings, 2 replies; 3+ messages in thread
From: Anand Jain @ 2025-01-10 16:11 UTC (permalink / raw)
  To: linux-btrfs, dsterba

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 --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);
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-18  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 16:11 [PATCH] btrfs-progs: resize: remove the misleading warning for the 'max' option Anand Jain
2025-02-03 21:47 ` Anand Jain
2025-03-18  9:46 ` Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox