btrfs-progs: fi resize: warn if new size is < 256M

The lower kernel limit is 256M otherwise it's considered an invalid
parameter.

Issue: #875
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2024-09-17 14:47:01 +02:00
parent aca8a3a05b
commit 158a25af0d
2 changed files with 8 additions and 0 deletions

View File

@ -269,6 +269,11 @@ resize [options] [<devid>:][+/-]<size>[kKmMgGtTpPeE]|[<devid>:]max <path>
take a long time if there are data in the device area that's beyond the new take a long time if there are data in the device area that's beyond the new
end. Relocation of the data takes time. end. Relocation of the data takes time.
Note that there's a lower limit on the new size (either specified
as an absolute size or difference) that is checked by kernel and
rejected eventually as invalid. Lower values will print a warning but
still pass the request to kernel. The currently known value is 256MiB.
See also section *EXAMPLES*. See also section *EXAMPLES*.
``Options`` ``Options``

View File

@ -1408,6 +1408,9 @@ static int check_resize_args(const char *amount, const char *path, u64 *devid_re
di_args[dev_idx].path, di_args[dev_idx].path,
pretty_size_mode(di_args[dev_idx].total_bytes, UNITS_DEFAULT), pretty_size_mode(di_args[dev_idx].total_bytes, UNITS_DEFAULT),
res_str); 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: out:
free(di_args); free(di_args);