linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xfs_growfs: support shrinking unused space
       [not found] <20210326024631.12921-1-hsiangkao.ref@aol.com>
@ 2021-03-26  2:46 ` Gao Xiang
  2021-03-26  2:49   ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2021-03-26  2:46 UTC (permalink / raw)
  To: linux-xfs; +Cc: Darrick J. Wong, Eric Sandeen, Gao Xiang

From: Gao Xiang <hsiangkao@redhat.com>

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>
---
v1: https://lore.kernel.org/r/20201028114010.545331-1-hsiangkao@redhat.com
change since v1:
 - update manpage description (Darrick);

 growfs/xfs_growfs.c   | 9 ++++-----
 man/man8/xfs_growfs.8 | 8 +++++---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
index a68b515de40d..d45ba703cc6f 100644
--- a/growfs/xfs_growfs.c
+++ b/growfs/xfs_growfs.c
@@ -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, _(
diff --git a/man/man8/xfs_growfs.8 b/man/man8/xfs_growfs.8
index 60a88189dd88..a01269270580 100644
--- a/man/man8/xfs_growfs.8
+++ b/man/man8/xfs_growfs.8
@@ -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
-- 
2.20.1


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

* Re: [PATCH v2] xfs_growfs: support shrinking unused space
  2021-03-26  2:46 ` [PATCH v2] xfs_growfs: support shrinking unused space Gao Xiang
@ 2021-03-26  2:49   ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2021-03-26  2:49 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-xfs, Eric Sandeen, Gao Xiang

On Fri, Mar 26, 2021 at 10:46:31AM +0800, Gao Xiang wrote:
> From: Gao Xiang <hsiangkao@redhat.com>
> 
> 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>

Looks like a reasonable start,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> v1: https://lore.kernel.org/r/20201028114010.545331-1-hsiangkao@redhat.com
> change since v1:
>  - update manpage description (Darrick);
> 
>  growfs/xfs_growfs.c   | 9 ++++-----
>  man/man8/xfs_growfs.8 | 8 +++++---
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
> index a68b515de40d..d45ba703cc6f 100644
> --- a/growfs/xfs_growfs.c
> +++ b/growfs/xfs_growfs.c
> @@ -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, _(
> diff --git a/man/man8/xfs_growfs.8 b/man/man8/xfs_growfs.8
> index 60a88189dd88..a01269270580 100644
> --- a/man/man8/xfs_growfs.8
> +++ b/man/man8/xfs_growfs.8
> @@ -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
> -- 
> 2.20.1
> 

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

end of thread, other threads:[~2021-03-26  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210326024631.12921-1-hsiangkao.ref@aol.com>
2021-03-26  2:46 ` [PATCH v2] xfs_growfs: support shrinking unused space Gao Xiang
2021-03-26  2:49   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).