]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: format bigtime filesystems
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 20 Nov 2020 22:03:28 +0000 (17:03 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 20 Nov 2020 22:03:28 +0000 (17:03 -0500)
Allow formatting with large timestamps.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
man/man8/mkfs.xfs.8
mkfs/xfs_mkfs.c

index 1a6a5f93f0eadc49b05722df9085449006cf00c1..9e72a841f868c52fa4aabb29eab9d7c76ec696e5 100644 (file)
@@ -150,6 +150,22 @@ valid
 are:
 .RS 1.2i
 .TP
+.BI bigtime= value
+This option enables filesystems that can handle inode timestamps from December
+1901 to July 2486, and quota timer expirations from January 1970 to July 2486.
+The value is either 0 to disable the feature, or 1 to enable large timestamps.
+.IP
+If this feature is not enabled, the filesystem can only handle timestamps from
+December 1901 to January 2038, and quota timers from January 1970 to February
+2106.
+.IP
+By default,
+.B mkfs.xfs
+will not enable this feature.
+If the option
+.B \-m crc=0
+is used, the large timestamp feature is not supported and is disabled.
+.TP
 .BI crc= value
 This is used to create a filesystem which maintains and checks CRC information
 in all metadata objects on disk. The value is either 0 to disable the feature,
index 1f98743f8102b7720026b8e41fcad1571fbe969c..049fa9ee57f76dfaaf8a3f80ced0feebdac15c3f 100644 (file)
@@ -120,6 +120,7 @@ enum {
        M_RMAPBT,
        M_REFLINK,
        M_INOBTCNT,
+       M_BIGTIME,
        M_MAX_OPTS,
 };
 
@@ -662,6 +663,7 @@ static struct opt_params mopts = {
                [M_RMAPBT] = "rmapbt",
                [M_REFLINK] = "reflink",
                [M_INOBTCNT] = "inobtcount",
+               [M_BIGTIME] = "bigtime",
        },
        .subopt_params = {
                { .index = M_CRC,
@@ -698,6 +700,12 @@ static struct opt_params mopts = {
                  .maxval = 1,
                  .defaultval = 1,
                },
+               { .index = M_BIGTIME,
+                 .conflicts = { { NULL, LAST_CONFLICT } },
+                 .minval = 0,
+                 .maxval = 1,
+                 .defaultval = 1,
+               },
        },
 };
 
@@ -749,6 +757,7 @@ struct sb_feat_args {
        bool    rmapbt;                 /* XFS_SB_FEAT_RO_COMPAT_RMAPBT */
        bool    reflink;                /* XFS_SB_FEAT_RO_COMPAT_REFLINK */
        bool    inobtcnt;               /* XFS_SB_FEAT_RO_COMPAT_INOBTCNT */
+       bool    bigtime;                /* XFS_SB_FEAT_INCOMPAT_BIGTIME */
        bool    nodalign;
        bool    nortalign;
 };
@@ -872,7 +881,7 @@ usage( void )
        fprintf(stderr, _("Usage: %s\n\
 /* blocksize */                [-b size=num]\n\
 /* metadata */         [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,\n\
-                           inobtcnt=0|1]\n\
+                           inobtcnt=0|1,bigtime=0|1]\n\
 /* data subvol */      [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\
                            (sunit=value,swidth=value|su=num,sw=num|noalign),\n\
                            sectsize=num\n\
@@ -1576,6 +1585,9 @@ meta_opts_parser(
        case M_INOBTCNT:
                cli->sb_feat.inobtcnt = getnum(value, opts, subopt);
                break;
+       case M_BIGTIME:
+               cli->sb_feat.bigtime = getnum(value, opts, subopt);
+               break;
        default:
                return -EINVAL;
        }
@@ -2006,6 +2018,13 @@ _("inode btree counters not supported without CRC support\n"));
                        usage();
                }
                cli->sb_feat.inobtcnt = false;
+
+               if (cli->sb_feat.bigtime && cli_opt_set(&mopts, M_BIGTIME)) {
+                       fprintf(stderr,
+_("timestamps later than 2038 not supported without CRC support\n"));
+                       usage();
+               }
+               cli->sb_feat.bigtime = false;
        }
 
        if (!cli->sb_feat.finobt) {
@@ -2984,6 +3003,8 @@ sb_set_features(
                sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_REFLINK;
        if (fp->inobtcnt)
                sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
+       if (fp->bigtime)
+               sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_BIGTIME;
 
        /*
         * Sparse inode chunk support has two main inode alignment requirements.
@@ -3650,6 +3671,7 @@ main(
                        .parent_pointers = false,
                        .nodalign = false,
                        .nortalign = false,
+                       .bigtime = false,
                },
        };