From: "Darrick J. Wong" <djwong@kernel.org>
To: sandeen@sandeen.net, djwong@kernel.org
Cc: Chandan Babu R <chandan.babu@oracle.com>,
Dave Chinner <david@fromorbit.com>,
linux-xfs@vger.kernel.org
Subject: [PATCH 2/2] xfs_repair: Add support for upgrading to large extent counters
Date: Tue, 28 Jun 2022 13:50:02 -0700 [thread overview]
Message-ID: <165644940234.1091400.1634326441233386426.stgit@magnolia> (raw)
In-Reply-To: <165644939119.1091400.7396096341976707391.stgit@magnolia>
From: Chandan Babu R <chandan.babu@oracle.com>
This commit adds support to xfs_repair to allow upgrading an existing
filesystem to support per-inode large extent counters.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
man/man8/xfs_admin.8 | 7 +++++++
repair/globals.c | 1 +
repair/globals.h | 1 +
repair/phase2.c | 24 ++++++++++++++++++++++++
repair/xfs_repair.c | 11 +++++++++++
5 files changed, 44 insertions(+)
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index ad28e0f6..4794d677 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -149,6 +149,13 @@ 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.
+.TP 0.4i
+.B nrext64
+Upgrade a filesystem to support large per-inode extent counters. The maximum
+data fork extent count will be 2^48 - 1, while the maximum attribute fork
+extent count will be 2^32 - 1. 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.19.
.RE
.TP
.BI \-U " uuid"
diff --git a/repair/globals.c b/repair/globals.c
index f8d4f1e4..c4084985 100644
--- a/repair/globals.c
+++ b/repair/globals.c
@@ -51,6 +51,7 @@ int lazy_count; /* What to set if to if converting */
bool features_changed; /* did we change superblock feature bits? */
bool add_inobtcount; /* add inode btree counts to AGI */
bool add_bigtime; /* add support for timestamps up to 2486 */
+bool add_nrext64;
/* misc status variables */
diff --git a/repair/globals.h b/repair/globals.h
index 0f98bd2b..b65e4a2d 100644
--- a/repair/globals.h
+++ b/repair/globals.h
@@ -92,6 +92,7 @@ extern int lazy_count; /* What to set if to if converting */
extern bool features_changed; /* did we change superblock feature bits? */
extern bool add_inobtcount; /* add inode btree counts to AGI */
extern bool add_bigtime; /* add support for timestamps up to 2486 */
+extern bool add_nrext64;
/* misc status variables */
diff --git a/repair/phase2.c b/repair/phase2.c
index a0fd1e9c..51567b19 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -181,6 +181,28 @@ set_bigtime(
return true;
}
+static bool
+set_nrext64(
+ struct xfs_mount *mp,
+ struct xfs_sb *new_sb)
+{
+ if (!xfs_has_crc(mp)) {
+ printf(
+ _("Nrext64 only supported on V5 filesystems.\n"));
+ exit(0);
+ }
+
+ if (xfs_has_large_extent_counts(mp)) {
+ printf(_("Filesystem already supports nrext64.\n"));
+ exit(0);
+ }
+
+ printf(_("Adding nrext64 to filesystem.\n"));
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NREXT64;
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+ return true;
+}
+
struct check_state {
struct xfs_sb sb;
uint64_t features;
@@ -384,6 +406,8 @@ upgrade_filesystem(
dirty |= set_inobtcount(mp, &new_sb);
if (add_bigtime)
dirty |= set_bigtime(mp, &new_sb);
+ if (add_nrext64)
+ dirty |= set_nrext64(mp, &new_sb);
if (!dirty)
return;
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index d08b0cec..c94671d8 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -67,6 +67,7 @@ enum c_opt_nums {
CONVERT_LAZY_COUNT = 0,
CONVERT_INOBTCOUNT,
CONVERT_BIGTIME,
+ CONVERT_NREXT64,
C_MAX_OPTS,
};
@@ -74,6 +75,7 @@ static char *c_opts[] = {
[CONVERT_LAZY_COUNT] = "lazycount",
[CONVERT_INOBTCOUNT] = "inobtcount",
[CONVERT_BIGTIME] = "bigtime",
+ [CONVERT_NREXT64] = "nrext64",
[C_MAX_OPTS] = NULL,
};
@@ -324,6 +326,15 @@ process_args(int argc, char **argv)
_("-c bigtime only supports upgrades\n"));
add_bigtime = true;
break;
+ case CONVERT_NREXT64:
+ if (!val)
+ do_abort(
+ _("-c nrext64 requires a parameter\n"));
+ if (strtol(val, NULL, 0) != 1)
+ do_abort(
+ _("-c nrext64 only supports upgrades\n"));
+ add_nrext64 = true;
+ break;
default:
unknown('c', val);
break;
next prev parent reply other threads:[~2022-06-28 20:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 20:49 [PATCHSET v3 0/2] xfs_repair: enable upgrading to nrext64 Darrick J. Wong
2022-06-28 20:49 ` [PATCH 1/2] xfs_repair: check filesystem geometry before allowing upgrades Darrick J. Wong
2022-06-28 20:50 ` Darrick J. Wong [this message]
2022-07-13 1:10 [PATCHSET v4 0/2] xfs_repair: enable upgrading to nrext64 Darrick J. Wong
2022-07-13 1:10 ` [PATCH 2/2] xfs_repair: Add support for upgrading to large extent counters 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=165644940234.1091400.1634326441233386426.stgit@magnolia \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=david@fromorbit.com \
--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.