On Mon, Feb 08, 2021 at 08:11:14PM -0800, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Upgrade existing V5 filesystems to support large timestamps up to 2486. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> > man/man8/xfs_admin.8 | 6 ++++++ > repair/globals.c | 1 + > repair/globals.h | 1 + > repair/phase1.c | 23 +++++++++++++++++++++++ > repair/xfs_repair.c | 11 +++++++++++ > 5 files changed, 42 insertions(+) > > > diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 > index da05171d..13d71643 100644 > --- a/man/man8/xfs_admin.8 > +++ b/man/man8/xfs_admin.8 > @@ -135,6 +135,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" > diff --git a/repair/globals.c b/repair/globals.c > index 89063b10..28f0b6a0 100644 > --- a/repair/globals.c > +++ b/repair/globals.c > @@ -52,6 +52,7 @@ int lazy_count; /* What to set if to if converting */ > > bool add_needsrepair; /* forcibly set needsrepair while repairing */ > bool add_inobtcount; /* add inode btree counts to AGI */ > +bool add_bigtime; /* add support for timestamps up to 2486 */ > > /* misc status variables */ > > diff --git a/repair/globals.h b/repair/globals.h > index a0051794..be784cf6 100644 > --- a/repair/globals.h > +++ b/repair/globals.h > @@ -94,6 +94,7 @@ extern int lazy_count; /* What to set if to if converting */ > > extern bool add_needsrepair; > extern bool add_inobtcount; > +extern bool add_bigtime; > > /* misc status variables */ > > diff --git a/repair/phase1.c b/repair/phase1.c > index 96661c6b..89056215 100644 > --- a/repair/phase1.c > +++ b/repair/phase1.c > @@ -77,6 +77,27 @@ set_inobtcount( > sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; > } > > +static void > +set_bigtime( > + struct xfs_sb *sb) > +{ > + if (!xfs_sb_version_hascrc(sb)) { > + printf( > + _("Large timestamp feature only supported on V5 filesystems.\n")); > + exit(0); > + } > + > + if (xfs_sb_version_hasbigtime(sb)) { > + printf(_("Filesystem already supports large timestamps.\n")); > + return; > + } > + > + printf(_("Adding large timestamp support to filesystem.\n")); > + primary_sb_modified = 1; > + sb->sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | > + XFS_SB_FEAT_INCOMPAT_BIGTIME); > +} > + > /* > * this has got to be big enough to hold 4 sectors > */ > @@ -177,6 +198,8 @@ _("Cannot disable lazy-counters on V5 fs\n")); > set_needsrepair(sb); > if (add_inobtcount) > set_inobtcount(sb); > + if (add_bigtime) > + set_bigtime(sb); > > /* shared_vn should be zero */ > if (sb->sb_shared_vn) { > diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c > index 0ff2e2bc..60f97e8c 100644 > --- a/repair/xfs_repair.c > +++ b/repair/xfs_repair.c > @@ -69,6 +69,7 @@ enum c_opt_nums { > CONVERT_LAZY_COUNT = 0, > CONVERT_NEEDSREPAIR, > CONVERT_INOBTCOUNT, > + CONVERT_BIGTIME, > C_MAX_OPTS, > }; > > @@ -76,6 +77,7 @@ static char *c_opts[] = { > [CONVERT_LAZY_COUNT] = "lazycount", > [CONVERT_NEEDSREPAIR] = "needsrepair", > [CONVERT_INOBTCOUNT] = "inobtcount", > + [CONVERT_BIGTIME] = "bigtime", > [C_MAX_OPTS] = NULL, > }; > > @@ -327,6 +329,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; >