]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Default to log, attr, inodes v2, Drop the ability to turn unwritten extents off compl...
authorNiv Sardi <xaiki@sgi.com>
Fri, 16 Nov 2007 05:16:34 +0000 (05:16 +0000)
committerNiv Sardi <xaiki@sgi.com>
Fri, 16 Nov 2007 05:16:34 +0000 (05:16 +0000)
-
Default to log version 2

Change logversion to 2 in xfs_mkfs.c
-
Default to version 2 attributes.

Change attrversion from 0 to 2 in xfs_mkfs.c
-
Drop the ability to turn unwritten extents off completly

unwritten extents on linux are generally a bad idea, this option
should not be used.

Remove the mount option from xfs_mkfs.c:
  remove it from option list,
  remove it from mkfs output.

Update xfs.mkfs manpage.
-
V2 inodes per default, and move DFL bits to XFS_DFL_SB_VERSION_BITS,

Activate XFS_SB_VERSION_NLINKBIT per default, which will enable V2 INODES.
refactor bits that we want everytime in XFS_DFL_SB_VERSION_BITS.
-
reduce imaxpct for big filesystems,

imaxpct is set to 25% (XFS_DFL_IMAXIMUM_PCT) for FS < 1 TB,
then 5% for FS < 50 TB,
and then (over 50 TB) 1%.

It is implemented as a simple step function in calc_default_imaxpct()
-
less AGs for single disks configs.

get the underlying structure with get_subvol_stripe_wrapper(),
and pass sunit | swidth as an argument to calc_default_ag_geometry().

if it is set, we are in single disk, get XFS_AG_MAX_BLOCKS for FS >= 4TB,
and calculate ag numbers regarding to that.
get 4 AGs for FS < 4TB.

we calculate according to blocks or count if we have them, add an assert to
ensure we have one of the 2.
Merge of master-melb:xfs-cmds:30077a by kenmcd.

doc/CHANGES
growfs/xfs_growfs.c
man/man8/mkfs.xfs.8
man/man8/xfs_admin.8
mkfs/xfs_mkfs.c
mkfs/xfs_mkfs.h

index 1858a87a33df9dc0d5582966485f665d74865cdb..5a3e1659fa8c665717316bdc4d14d6cfa25843f5 100644 (file)
@@ -5,6 +5,7 @@ xfsprogs-2.9.x
          warning in certain device sizes.
        - Man page fixes. Thanks to Utako Kusaka <u-kusaka@wm.jp.nec.com>
          for this.
+       - Disable the ability to turn off unwritten extents in mkfs.
 
 xfsprogs-2.9.4 (7 Sep 2007)
        - Fixed xfs_repair segfaulting with directory block size different
index b029e1b52f43e0d2d533899292ab25b1bd4d0de4..5767f100f0c4a064a3e54dd9cfc91fa431264c55 100644 (file)
@@ -58,7 +58,6 @@ report_info(
        int             isint,
        char            *logname,
        char            *rtname,
-       int             unwritten,
        int             lazycount,
        int             dirversion,
        int             logversion,
@@ -68,7 +67,7 @@ report_info(
            "meta-data=%-22s isize=%-6u agcount=%u, agsize=%u blks\n"
            "         =%-22s sectsz=%-5u attr=%u\n"
            "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
-           "         =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
+           "         =%-22s sunit=%-6u swidth=%u blks"
            "naming   =version %-14u bsize=%-6u\n"
            "log      =%-22s bsize=%-6u blocks=%u, version=%u\n"
            "         =%-22s sectsz=%-5u sunit=%u blks, lazy-count=%u\n"
@@ -78,7 +77,7 @@ report_info(
                "", geo.sectsize, attrversion,
                "", geo.blocksize, (unsigned long long)geo.datablocks,
                        geo.imaxpct,
-               "", geo.sunit, geo.swidth, unwritten,
+               "", geo.sunit, geo.swidth,
                dirversion, geo.dirblocksize,
                isint ? _("internal") : logname ? logname : _("external"),
                        geo.blocksize, geo.logblocks, logversion,
@@ -115,7 +114,6 @@ main(int argc, char **argv)
        xfs_fsop_geom_t         ngeo;   /* new fs geometry */
        int                     rflag;  /* -r flag */
        long long               rsize;  /* new rt size in fs blocks */
-       int                     unwritten; /* unwritten extent flag */
        int                     lazycount; /* lazy superblock counters */
        int                     xflag;  /* -x flag */
        char                    *fname; /* mount point name */
@@ -236,7 +234,6 @@ main(int argc, char **argv)
                }
        }
        isint = geo.logstart > 0;
-       unwritten = geo.flags & XFS_FSOP_GEOM_FLAGS_EXTFLG ? 1 : 0;
        lazycount = geo.flags & XFS_FSOP_GEOM_FLAGS_LAZYSB ? 1 : 0;
        dirversion = geo.flags & XFS_FSOP_GEOM_FLAGS_DIRV2 ? 2 : 1;
        logversion = geo.flags & XFS_FSOP_GEOM_FLAGS_LOGV2 ? 2 : 1;
@@ -245,7 +242,7 @@ main(int argc, char **argv)
 
        if (nflag) {
                report_info(geo, datadev, isint, logdev, rtdev,
-                               unwritten, lazycount, dirversion, logversion,
+                               lazycount, dirversion, logversion,
                                attrversion);
                exit(0);
        }
@@ -282,7 +279,7 @@ main(int argc, char **argv)
        }
 
        report_info(geo, datadev, isint, logdev, rtdev,
-                       unwritten, lazycount, dirversion, logversion,
+                       lazycount, dirversion, logversion,
                        attrversion);
 
        ddsize = xi.dsize;
index 0d279015301e60791a9d744f9501e3a69d083d63..b6024c369eb95538bb042ab54af4ea8dd017bb14 100644 (file)
@@ -240,22 +240,6 @@ will automatically query the logical volume for appropriate
 and
 .B swidth
 values.
-.TP
-.BI unwritten[= value ]
-This is used to specify whether unwritten extents are flagged as such,
-or not.
-The
-.I value
-is either 0 or 1, with 1 signifying that unwritten
-extent flagging should occur.
-If the suboption is omitted, unwritten extent flagging is enabled.
-If unwritten extents are flagged, filesystem write performance
-will be negatively affected for preallocated file extents, since
-extra filesystem transactions are required to convert extent flags
-for the range of the file written.
-This suboption should be disabled if the filesystem
-needs to be used on operating system versions which do not support the
-flagging capability.
 .RE
 .TP
 .B \-f
index c0017b905891aa8d01f29a55bb03e2f22312d7ed..c38a94267a8f1eb0e69569df36b7019aec20540f 100644 (file)
@@ -31,7 +31,8 @@ command.
 .TP
 .B \-e
 Enables unwritten extent support on a filesystem that does not
-already have this enabled.
+already have this enabled (for legacy filesystems, it can't be
+disabled anymore at mkfs time).
 .TP
 .B \-f
 Specifies that the filesystem image to be processed is stored in a
index 6e84a4e365b600185446105e5255658d5922ab04..e15d6673f6dd7d3bf3c0fe7879b4dd5aa2c401e2 100644 (file)
@@ -56,25 +56,23 @@ char        *dopts[] = {
        "sunit",
 #define D_SWIDTH       5
        "swidth",
-#define D_UNWRITTEN    6
-       "unwritten",
-#define D_AGSIZE       7
+#define D_AGSIZE       6
        "agsize",
-#define D_SU           8
+#define D_SU           7
        "su",
-#define D_SW           9
+#define D_SW           8
        "sw",
-#define D_SECTLOG      10
+#define D_SECTLOG      9
        "sectlog",
-#define D_SECTSIZE     11
+#define D_SECTSIZE     10
        "sectsize",
-#define D_NOALIGN      12
+#define D_NOALIGN      11
        "noalign",
-#define D_RTINHERIT    13
+#define D_RTINHERIT    12
        "rtinherit",
-#define D_PROJINHERIT  14
+#define D_PROJINHERIT  13
        "projinherit",
-#define D_EXTSZINHERIT 15
+#define D_EXTSZINHERIT 14
        "extszinherit",
        NULL
 };
@@ -376,14 +374,38 @@ validate_log_size(__uint64_t logblocks, int blocklog, int min_logblocks)
        }
 }
 
+static int
+calc_default_imaxpct(
+       int             blocklog,
+       __uint64_t      dblocks)
+{
+       /*
+        * This returns the % of the disk space that is used for
+        * inodes, it changes relatively to the FS size:
+        *  - over  50 TB, use 1%,
+        *  - 1TB - 50 TB, use 5%,
+        *  - under  1 TB, use XFS_DFL_IMAXIMUM_PCT (25%).
+        */
+
+       if (dblocks < TERABYTES(1, blocklog)) {
+               return XFS_DFL_IMAXIMUM_PCT;
+       } else if (dblocks < TERABYTES(50, blocklog)) {
+               return 5;
+       }
+
+       return 1;
+}
+
+
 void
 calc_default_ag_geometry(
        int             blocklog,
        __uint64_t      dblocks,
+       int             multidisk,
        __uint64_t      *agsize,
        __uint64_t      *agcount)
 {
-       __uint64_t      blocks;
+       __uint64_t      blocks = 0;
        __uint64_t      count = 0;
        int             shift = 0;
 
@@ -415,6 +437,17 @@ calc_default_ag_geometry(
         *
         * This scales us up smoothly between min/max AG sizes.
         */
+
+       if (!multidisk) {
+               if (dblocks >= TERABYTES(4, blocklog)) {
+                        blocks = XFS_AG_MAX_BLOCKS(blocklog);
+                        goto done;
+                }
+                count = 4;
+
+                goto done;
+        }
+
        if (dblocks > GIGABYTES(512, blocklog))
                shift = 5;
        else if (dblocks > GIGABYTES(8, blocklog))
@@ -426,8 +459,12 @@ calc_default_ag_geometry(
        blocks = dblocks >> shift;
 
 done:
+       ASSERT (count || blocks);
        if (!count)
                count = dblocks / blocks + (dblocks % blocks != 0);
+       if (!blocks)
+               blocks = dblocks / count;
+
        *agsize = blocks;
        *agcount = count;
 }
@@ -604,7 +641,6 @@ main(
        int                     dsw;
        int                     dsunit;
        int                     dswidth;
-       int                     extent_flagging;
        int                     force_overwrite;
        struct fsxattr          fsx;
        int                     iaflag;
@@ -677,7 +713,7 @@ main(
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       attrversion = 0;
+       attrversion = 2;
        blflag = bsflag = slflag = ssflag = lslflag = lssflag = 0;
        blocklog = blocksize = 0;
        sectorlog = lsectorlog = XFS_MIN_SECTORSIZE_LOG;
@@ -686,7 +722,7 @@ main(
        ilflag = imflag = ipflag = isflag = 0;
        liflag = laflag = lsflag = ldflag = lvflag = 0;
        loginternal = 1;
-       logversion = 1;
+       logversion = 2;
        logagno = logblocks = rtblocks = rtextblocks = 0;
        Nflag = nlflag = nsflag = nvflag = 0;
        dirblocklog = dirblocksize = dirversion = 0;
@@ -697,7 +733,6 @@ main(
        dsize = logsize = rtsize = rtextsize = protofile = NULL;
        dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0;
        nodsflag = norsflag = 0;
-       extent_flagging = 1;
        force_overwrite = 0;
        worst_freelist = 0;
        lazy_sb_counters = 0;
@@ -877,14 +912,6 @@ main(
                                                         D_NOALIGN);
                                        nodsflag = 1;
                                        break;
-                               case D_UNWRITTEN:
-                                       if (!value)
-                                               reqval('d', dopts, D_UNWRITTEN);
-                                       c = atoi(value);
-                                       if (c < 0 || c > 1)
-                                               illegal(value, "d unwritten");
-                                       extent_flagging = c;
-                                       break;
                                case D_SECTLOG:
                                        if (!value)
                                                reqval('d', dopts, D_SECTLOG);
@@ -1768,10 +1795,14 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
                agsize /= blocksize;
                agcount = dblocks / agsize + (dblocks % agsize != 0);
 
-       } else if (daflag)      /* User-specified AG size */
+       } else if (daflag)      /* User-specified AG count */
                agsize = dblocks / agcount + (dblocks % agcount != 0);
-       else
-               calc_default_ag_geometry(blocklog, dblocks, &agsize, &agcount);
+       else {
+               get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
+                                         &xlv_dsunit, &xlv_dswidth, &sectoralign),
+                       calc_default_ag_geometry(blocklog, dblocks, xlv_dsunit | xlv_dswidth,
+                                                &agsize, &agcount);
+       }
 
        /*
         * If the last AG is too small, reduce the filesystem size
@@ -1990,7 +2021,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
                   "meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
                   "         =%-22s sectsz=%-5u attr=%u\n"
                   "data     =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
-                  "         =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
+                  "         =%-22s sunit=%-6u swidth=%u blks\n"
                   "naming   =version %-14u bsize=%-6u\n"
                   "log      =%-22s bsize=%-6d blocks=%lld, version=%d\n"
                   "         =%-22s sectsz=%-5u sunit=%d blks, lazy-count=%d\n"
@@ -1998,8 +2029,8 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
                        dfile, isize, (long long)agcount, (long long)agsize,
                        "", sectorsize, attrversion,
                        "", blocksize, (long long)dblocks,
-                               imflag ? imaxpct : XFS_DFL_IMAXIMUM_PCT,
-                       "", dsunit, dswidth, extent_flagging,
+                              calc_default_imaxpct(blocklog, dblocks),
+                       "", dsunit, dswidth,
                        dirversion, dirversion == 1 ? blocksize : dirblocksize,
                        logfile, 1 << blocklog, (long long)logblocks,
                        logversion, "", lsectorsize, lsunit, lazy_sb_counters,
@@ -2035,7 +2066,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
                (__uint8_t)(rtextents ?
                        libxfs_highbit32((unsigned int)rtextents) : 0);
        sbp->sb_inprogress = 1; /* mkfs is in progress */
-       sbp->sb_imax_pct = imflag ? imaxpct : XFS_DFL_IMAXIMUM_PCT;
+       sbp->sb_imax_pct = calc_default_imaxpct(blocklog, dblocks);
        sbp->sb_icount = 0;
        sbp->sb_ifree = 0;
        sbp->sb_fdblocks = dblocks - agcount * XFS_PREALLOC_BLOCKS(mp) -
@@ -2066,7 +2097,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
        }
        sbp->sb_features2 = XFS_SB_VERSION2_MKFS(lazy_sb_counters, attrversion == 2, 0);
        sbp->sb_versionnum = XFS_SB_VERSION_MKFS(
-                       iaflag, dsunit != 0, extent_flagging,
+                       iaflag, dsunit != 0,
                        dirversion == 2, logversion == 2, attrversion == 1,
                        (sectorsize != BBSIZE || lsectorsize != BBSIZE),
                        sbp->sb_features2 != 0);
@@ -2537,7 +2568,7 @@ usage( void )
 /* blocksize */                [-b log=n|size=num]\n\
 /* data subvol */      [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\
                            (sunit=value,swidth=value|su=num,sw=num),\n\
-                           sectlog=n|sectsize=num,unwritten=0|1]\n\
+                           sectlog=n|sectsize=num\n\
 /* inode size */       [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2]\n\
 /* log subvol */       [-l agnum=n,internal,size=num,logdev=xxx,version=n\n\
                            sunit=value|su=num,sectlog=n|sectsize=num,\n\
index 1ab85fdf28a21efb52c0447b0cea0a7b35d7beca..5cc841cf0c9863407ccd0ca2a858fad58b1fdd9f 100644 (file)
 #ifndef __XFS_MKFS_H__
 #define        __XFS_MKFS_H__
 
-#define XFS_SB_VERSION_MKFS(ia,dia,extflag,dir2,log2,attr1,sflag,more) (\
-       ((ia)||(dia)||(extflag)||(dir2)||(log2)||(attr1)||(sflag)||(more)) ? \
+#define XFS_DFL_SB_VERSION_BITS \
+                (XFS_SB_VERSION_NLINKBIT | \
+                 XFS_SB_VERSION_EXTFLGBIT)
+
+#define XFS_SB_VERSION_MKFS(ia,dia,dir2,log2,attr1,sflag,more) (\
+       ((ia)||(dia)||(dir2)||(log2)||(attr1)||(sflag)||(more)) ? \
        ( XFS_SB_VERSION_4 |                                            \
                ((ia) ? XFS_SB_VERSION_ALIGNBIT : 0) |                  \
                ((dia) ? XFS_SB_VERSION_DALIGNBIT : 0) |                \
-               ((extflag) ? XFS_SB_VERSION_EXTFLGBIT : 0) |            \
                ((dir2) ? XFS_SB_VERSION_DIRV2BIT : 0) |                \
                ((log2) ? XFS_SB_VERSION_LOGV2BIT : 0) |                \
                ((attr1) ? XFS_SB_VERSION_ATTRBIT : 0) |                \
                ((sflag) ? XFS_SB_VERSION_SECTORBIT : 0) |              \
                ((more) ? XFS_SB_VERSION_MOREBITSBIT : 0) |             \
+               XFS_DFL_SB_VERSION_BITS |                               \
        0 ) : XFS_SB_VERSION_1 )
 
 #define XFS_SB_VERSION2_MKFS(lazycount, attr2, parent) (\