All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_growfs: don't grow data if only -m is specified
@ 2014-02-27 23:28 Eric Sandeen
  2014-02-28  1:19 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2014-02-27 23:28 UTC (permalink / raw)
  To: xfs-oss

While writing an xfstest to check imaxpct behavior, I realized
that xfs_growfs -m XXX /mnt/point will not only change
imaxpct, but also grow the filesystem if it's not currently
occupying the entire block device.  This doesn't seem like
the expected behavior, so split it out such that if only
-m, and not -d, is specified, only the imaxpct will be
changed.

This is a change from previous behavior, but I think it
satisfies the principle of least surprise...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/growfs/xfs_growfs.c b/growfs/xfs_growfs.c
index 2df68fb..fb7eda8 100644
--- a/growfs/xfs_growfs.c
+++ b/growfs/xfs_growfs.c
@@ -189,7 +189,7 @@ main(int argc, char **argv)
 		usage();
 	if (iflag && xflag)
 		usage();
-	if (dflag + lflag + rflag == 0)
+	if (dflag + lflag + rflag + mflag == 0)
 		aflag = 1;
 
 	fs_table_initialise(0, NULL, 0, NULL);
@@ -305,12 +305,15 @@ main(int argc, char **argv)
 	drsize -= (drsize % 2);
 
 	error = 0;
-	if (dflag | aflag) {
+
+	if (dflag | mflag | aflag) {
 		xfs_growfs_data_t	in;
 
 		if (!mflag)
 			maxpct = geo.imaxpct;
-		if (!dsize)
+		if (!dflag && !aflag)	/* Only mflag, no data size change */
+			dsize = geo.datablocks;
+		else if (!dsize)
 			dsize = ddsize / (geo.blocksize / BBSIZE);
 		else if (dsize > ddsize / (geo.blocksize / BBSIZE)) {
 			fprintf(stderr, _(

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfs_growfs: don't grow data if only -m is specified
  2014-02-27 23:28 [PATCH] xfs_growfs: don't grow data if only -m is specified Eric Sandeen
@ 2014-02-28  1:19 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2014-02-28  1:19 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Thu, Feb 27, 2014 at 05:28:44PM -0600, Eric Sandeen wrote:
> While writing an xfstest to check imaxpct behavior, I realized
> that xfs_growfs -m XXX /mnt/point will not only change
> imaxpct, but also grow the filesystem if it's not currently
> occupying the entire block device.  This doesn't seem like
> the expected behavior, so split it out such that if only
> -m, and not -d, is specified, only the imaxpct will be
> changed.
> 
> This is a change from previous behavior, but I think it
> satisfies the principle of least surprise...

Seems reasonable to me. Code looks good, too.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2014-02-28  1:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 23:28 [PATCH] xfs_growfs: don't grow data if only -m is specified Eric Sandeen
2014-02-28  1:19 ` Dave Chinner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.