]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: enable bigtime upgrade via repair
authorDarrick J. Wong <djwong@kernel.org>
Wed, 24 Feb 2021 01:20:57 +0000 (20:20 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 24 Feb 2021 01:20:57 +0000 (20:20 -0500)
Upgrade existing V5 filesystems to support large timestamps up to 2486.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
man/man8/xfs_admin.8
repair/globals.c
repair/globals.h
repair/phase2.c
repair/xfs_repair.c

index eb9b6523df1dd83376712ccf5467fc01ece03122..ad28e0f68c4ec4845dcc67ebb52e04c4e4adc0e2 100644 (file)
@@ -143,6 +143,12 @@ This reduces mount time by speeding up metadata space reservation calculations.
 The filesystem cannot be downgraded after this feature is enabled.
 Once enabled, the filesystem will not be writable by older kernels.
 This feature was added to Linux 5.10.
+.TP 0.4i
+.B bigtime
+Upgrade a filesystem to support larger timestamps up to the year 2486.
+The filesystem cannot be downgraded after this feature is enabled.
+Once enabled, the filesystem will not be mountable by older kernels.
+This feature was added to Linux 5.10.
 .RE
 .TP
 .BI \-U " uuid"
index 47d90bd326c1c0eda8a2ee6ff0d86bd38a818932..506a4e728c707f45c27da361d0efd172fbc2a04f 100644 (file)
@@ -49,6 +49,7 @@ int   rt_spec;                /* Realtime dev specified as option */
 int    convert_lazy_count;     /* Convert lazy-count mode on/off */
 int    lazy_count;             /* What to set if to if converting */
 bool   add_inobtcount;         /* add inode btree counts to AGI */
+bool   add_bigtime;            /* add support for timestamps up to 2486 */
 
 /* misc status variables */
 
index 5b6fe4d4fb0a79ade926b35eec5fd8d49ec152b6..929b82be387a3f99c50da18c5d8a77b51d99d684 100644 (file)
@@ -90,6 +90,7 @@ extern int    rt_spec;                /* Realtime dev specified as option */
 extern int     convert_lazy_count;     /* Convert lazy-count mode on/off */
 extern int     lazy_count;             /* What to set if to if converting */
 extern bool    add_inobtcount;         /* add inode btree counts to AGI */
+extern bool    add_bigtime;            /* add support for timestamps up to 2486 */
 
 /* misc status variables */
 
index 96074a1dfdec8be6e288c4f18691d471eba52ad4..cb9adf1d3db5dc0c1f2dcec696f4374e48be0f76 100644 (file)
@@ -158,6 +158,27 @@ set_inobtcount(
        return true;
 }
 
+static bool
+set_bigtime(
+       struct xfs_mount        *mp)
+{
+       if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+               printf(
+       _("Large timestamp feature only supported on V5 filesystems.\n"));
+               exit(0);
+       }
+
+       if (xfs_sb_version_hasbigtime(&mp->m_sb)) {
+               printf(_("Filesystem already supports large timestamps.\n"));
+               exit(0);
+       }
+
+       printf(_("Adding large timestamp support to filesystem.\n"));
+       mp->m_sb.sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR |
+                                         XFS_SB_FEAT_INCOMPAT_BIGTIME);
+       return true;
+}
+
 /* Perform the user's requested upgrades on filesystem. */
 static void
 upgrade_filesystem(
@@ -169,6 +190,8 @@ upgrade_filesystem(
 
        if (add_inobtcount)
                dirty |= set_inobtcount(mp);
+       if (add_bigtime)
+               dirty |= set_bigtime(mp);
 
         if (no_modify || !dirty)
                 return;
index 8a9caf15c09f592c8c1525d3da0d4f97db9df3e1..38406eea408065c87344ee0dce9b34369100b5d3 100644 (file)
@@ -66,12 +66,14 @@ static char *o_opts[] = {
 enum c_opt_nums {
        CONVERT_LAZY_COUNT = 0,
        CONVERT_INOBTCOUNT,
+       CONVERT_BIGTIME,
        C_MAX_OPTS,
 };
 
 static char *c_opts[] = {
        [CONVERT_LAZY_COUNT]    = "lazycount",
        [CONVERT_INOBTCOUNT]    = "inobtcount",
+       [CONVERT_BIGTIME]       = "bigtime",
        [C_MAX_OPTS]            = NULL,
 };
 
@@ -313,6 +315,15 @@ process_args(int argc, char **argv)
                _("-c inobtcount only supports upgrades\n"));
                                        add_inobtcount = true;
                                        break;
+                               case CONVERT_BIGTIME:
+                                       if (!val)
+                                               do_abort(
+               _("-c bigtime requires a parameter\n"));
+                                       if (strtol(val, NULL, 0) != 1)
+                                               do_abort(
+               _("-c bigtime only supports upgrades\n"));
+                                       add_bigtime = true;
+                                       break;
                                default:
                                        unknown('c', val);
                                        break;