All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: sandeen@sandeen.net, djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com
Subject: [PATCH 2/2] xfs_repair: enable bigtime upgrade via repair
Date: Mon, 08 Feb 2021 20:11:14 -0800	[thread overview]
Message-ID: <161284387398.3058138.5317754248430984165.stgit@magnolia> (raw)
In-Reply-To: <161284386265.3058138.14199712814454514885.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Upgrade existing V5 filesystems to support large timestamps up to 2486.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 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;


  parent reply	other threads:[~2021-02-09  4:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09  4:11 [PATCHSET v5 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
2021-02-09  9:18   ` Christoph Hellwig
2021-02-09 17:35   ` Brian Foster
2021-02-09  4:11 ` Darrick J. Wong [this message]
2021-02-09  9:18   ` [PATCH 2/2] xfs_repair: enable bigtime " Christoph Hellwig
2021-02-09 17:35   ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161284387398.3058138.5317754248430984165.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.