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: Christoph Hellwig <hch@lst.de>, Brian Foster <bfoster@redhat.com>,
	linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com
Subject: [PATCH 5/5] xfs_repair: enable bigtime upgrade via repair
Date: Fri, 12 Feb 2021 21:47:31 -0800	[thread overview]
Message-ID: <161319525117.423010.6467565288868099323.stgit@magnolia> (raw)
In-Reply-To: <161319522350.423010.5768275226481994478.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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
 man/man8/xfs_admin.8 |    6 ++++++
 repair/globals.c     |    1 +
 repair/globals.h     |    1 +
 repair/phase2.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 4ba718d8..25437ff1 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -145,6 +145,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 47d90bd3..506a4e72 100644
--- a/repair/globals.c
+++ b/repair/globals.c
@@ -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 */
 
diff --git a/repair/globals.h b/repair/globals.h
index 5b6fe4d4..929b82be 100644
--- a/repair/globals.h
+++ b/repair/globals.h
@@ -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 */
 
diff --git a/repair/phase2.c b/repair/phase2.c
index 96074a1d..cb9adf1d 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -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;
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 2d9dca6b..e6c29dca 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -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;


  parent reply	other threads:[~2021-02-13  5:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13  5:47 [PATCHSET v6 0/5] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-02-13  5:47 ` [PATCH 1/5] man: mark all deprecated V4 format options Darrick J. Wong
2021-02-25  7:39   ` Christoph Hellwig
2021-02-13  5:47 ` [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems Darrick J. Wong
2021-02-16 12:18   ` Brian Foster
2021-02-25  7:40   ` Christoph Hellwig
2021-02-13  5:47 ` [PATCH 3/5] xfs_admin: support adding features to V5 filesystems Darrick J. Wong
2021-02-13  5:47 ` [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
2021-02-16 12:18   ` Brian Foster
2021-02-13  5:47 ` Darrick J. Wong [this message]
2021-02-23  3:01 [PATCHSET v6.1 0/5] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-02-23  3:01 ` [PATCH 5/5] xfs_repair: enable bigtime upgrade via repair Darrick J. Wong

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=161319525117.423010.6467565288868099323.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.