diff --git a/Documentation/btrfs-filesystem.rst b/Documentation/btrfs-filesystem.rst index 207f7b02..b036ae5e 100644 --- a/Documentation/btrfs-filesystem.rst +++ b/Documentation/btrfs-filesystem.rst @@ -269,6 +269,11 @@ resize [options] [:][+/-][kKmMgGtTpPeE]|[:]max take a long time if there are data in the device area that's beyond the new 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*. ``Options`` diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 41ad2f8d..d2605bda 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -1408,6 +1408,9 @@ static int check_resize_args(const char *amount, const char *path, u64 *devid_re 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);