Skip to contentSkip to conversation

xfs_growfs: allow shrinking unused space in the last AG

RFC PATCH In review Gao Xiang 2 participants 3 messages Oct 28, 2020 – Mar 25, 2021

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

RFC PATCH 1/1 xfs_growfs: allow shrinking unused space in the last AG

This allows shrinking operation can pass into kernel.

---
preliminary version.

 growfs/xfs_growfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
growfs/xfs_growfs.c +4 -5
index a68b515d..d45ba703 100644
@@ -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, _(
Signature · 1 line
2.18.1
#1 lore raw
Quoted 5 lines · Gao Xiang

This allows shrinking operation can pass into kernel.

---
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

Quoted 28 lines
 growfs/xfs_growfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
growfs/xfs_growfs.c +4 -5
index a68b515d..d45ba703 100644
@@ -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, _(
Signature · 1 line
2.18.1
author
#2 lore raw
Quoted 9 lines · Darrick J. Wong
Quoted 5 lines · Gao Xiang

This allows shrinking operation can pass into kernel.

---
preliminary version.

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

Quoted 8 lines

"-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

Quoted 32 lines

--D

Quoted 28 lines
 growfs/xfs_growfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
growfs/xfs_growfs.c +4 -5
index a68b515d..d45ba703 100644
@@ -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, _(
Signature · 1 line
2.18.1