xfs
[Top] [All Lists]

[PATCH] xfs_growfs: don't grow data if only -m is specified

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs_growfs: don't grow data if only -m is specified
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Thu, 27 Feb 2014 17:28:44 -0600
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
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@xxxxxxxxxx>
---

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, _(

<Prev in Thread] Current Thread [Next in Thread>