[PATCH v2 22/26] xfs_db: add bigtime upgrade path

Darrick J. Wong
2020-11-16T21:15:31Z

From: Darrick J. Wong <darrick.wong@oracle.com>

Enable users to upgrade their filesystems to bigtime support.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
v2: rebase patch since the main feature upgrade patch got changed
slightly
---
db/sb.c | 15 +++++++++++++++
man/man8/xfs_admin.8 | 5 +++++
2 files changed, 20 insertions(+)

diff --git a/db/sb.c b/db/sb.c
index 3608508a7eb8..f66907e69da6 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -848,6 +848,21 @@ version_f(
}

v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
+ } else if (!strcasecmp(argv[1], "bigtime")) {
+ if (xfs_sb_version_hasbigtime(&mp->m_sb)) {
+ dbprintf(
+ _("bigtime feature is already enabled\n"));
+ exitcode = 1;
+ return 1;
+ }
+ if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+ dbprintf(
+ _("bigtime feature cannot be enabled on pre-V5 filesystems\n"));
+ exitcode = 1;
+ return 1;
+ }
+
+ v5features.incompat |= XFS_SB_FEAT_INCOMPAT_BIGTIME;
} else if (!strcasecmp(argv[1], "extflg")) {
switch (XFS_SB_VERSION_NUM(&mp->m_sb)) {
case XFS_SB_VERSION_1:
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index 65ca6afc1e12..c09fe62b6827 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -117,6 +117,11 @@ This reduces mount time by caching the size of the inode btrees in the
allocation group metadata.
Once enabled, the filesystem will not be writable by older kernels.
The filesystem cannot be downgraded after this feature is enabled.
+.TP
+.B bigtime
+Upgrade the filesystem to support larger timestamps up to the year 2486.
+Once enabled, the filesystem will not be readable by older kernels.
+The filesystem cannot be downgraded.
.RE
.TP
.BI \-U " uuid"