]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_growfs: support shrinking unused space
authorGao Xiang <hsiangkao@redhat.com>
Tue, 20 Apr 2021 20:15:38 +0000 (16:15 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 20 Apr 2021 20:15:38 +0000 (16:15 -0400)
This allows shrinking operation can pass into kernel. Currently,
only shrinking unused space in the tail AG functionality works.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
growfs/xfs_growfs.c
man/man8/xfs_growfs.8

index a68b515de40db5a475a0dbb1fd89ea37eaf5781d..d45ba703cc6fccc448b7bd2dc8cda6c8d98f70cb 100644 (file)
@@ -246,12 +246,11 @@ main(int argc, char **argv)
                        error = 1;
                }
 
-               if (!error && dsize < geo.datablocks) {
-                       fprintf(stderr, _("data size %lld too small,"
-                               " old size is %lld\n"),
+               if (!error && dsize < geo.datablocks)
+                       fprintf(stderr,
+_("[EXPERIMENTAL] try to shrink unused space %lld, old size is %lld\n"),
                                (long long)dsize, (long long)geo.datablocks);
-                       error = 1;
-               } else if (!error &&
+               if (!error &&
                           dsize == geo.datablocks && maxpct == geo.imaxpct) {
                        if (dflag)
                                fprintf(stderr, _(
index 60a88189dd8888c0efe0d14bf15e757083ab57ee..a01269270580b7a29aed7a30b4f4ec6c77824fe4 100644 (file)
@@ -60,14 +60,16 @@ becomes available for additional file storage.
 .SH OPTIONS
 .TP
 .BI "\-d | \-D " size
-Specifies that the data section of the filesystem should be grown. If the
+Specifies that the data section of the filesystem should be resized. If the
 .B \-D
 .I size
-option is given, the data section is grown to that
+option is given, the data section is changed to that
 .IR size ,
 otherwise the data section is grown to the largest size possible with the
 .B \-d
-option. The size is expressed in filesystem blocks.
+option. The size is expressed in filesystem blocks. A filesystem with only
+1 AG cannot be shrunk further, and a filesystem cannot be shrunk to the point
+where it would only have 1 AG.
 .TP
 .B \-e
 Allows the real-time extent size to be specified. In