diff mbox series

[WIP,RFC] xfs_growfs: allow shrinking unused space in the last AG

Message ID 20201028114010.545331-1-hsiangkao@redhat.com (mailing list archive)
State Deferred, archived
Headers show
Series [WIP,RFC] xfs_growfs: allow shrinking unused space in the last AG | expand

Commit Message

Gao Xiang Oct. 28, 2020, 11:40 a.m. UTC
This allows shrinking operation can pass into kernel.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
preliminary version.

 growfs/xfs_growfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Darrick J. Wong March 24, 2021, 5:32 p.m. UTC | #1
On Wed, Oct 28, 2020 at 07:40:10PM +0800, Gao Xiang wrote:
> This allows shrinking operation can pass into kernel.
> 
> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
> ---
> preliminary version.

...which is going to need a manpage update:

"-d | -D size

"Specifies that the data section of the filesystem should be resized. If
the -D size option is given, the data section is changed to that size,
otherwise the data section is grown to the largest size possible with
the -d 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."

--D

> 
>  growfs/xfs_growfs.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
> index a68b515d..d45ba703 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, _(
> -- 
> 2.18.1
>
Gao Xiang March 25, 2021, 12:44 a.m. UTC | #2
On Wed, Mar 24, 2021 at 10:32:15AM -0700, Darrick J. Wong wrote:
> On Wed, Oct 28, 2020 at 07:40:10PM +0800, Gao Xiang wrote:
> > This allows shrinking operation can pass into kernel.
> > 
> > Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
> > ---
> > preliminary version.
> 
> ...which is going to need a manpage update:
> 
> "-d | -D size
> 
> "Specifies that the data section of the filesystem should be resized. If
> the -D size option is given, the data section is changed to that size,
> otherwise the data section is grown to the largest size possible with
> the -d 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."

Ah, ok, will update this. thanks for pointing out.

Thanks,
Gao Xiang

> 
> --D
> 
> > 
> >  growfs/xfs_growfs.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
> > index a68b515d..d45ba703 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, _(
> > -- 
> > 2.18.1
> > 
>
diff mbox series

Patch

diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
index a68b515d..d45ba703 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, _(