* [PATCH 1/5] man: mark all deprecated V4 format options
2021-02-13 5:47 [PATCHSET v6 0/5] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
@ 2021-02-13 5:47 ` 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
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2021-02-13 5:47 UTC (permalink / raw)
To: sandeen, djwong; +Cc: linux-xfs, hch, bfoster
From: Darrick J. Wong <djwong@kernel.org>
Update the manual pages for the most popular tools to note which options
are only useful with the V4 XFS format, and that the V4 format is
deprecated and will be removed no later than September 2030.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
man/man8/mkfs.xfs.8 | 16 ++++++++++++++++
man/man8/xfs_admin.8 | 10 ++++++++++
2 files changed, 26 insertions(+)
diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8
index fac82d74..df25abaa 100644
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -223,6 +223,11 @@ of calculating and checking the CRCs is not noticeable in normal operation.
By default,
.B mkfs.xfs
will enable metadata CRCs.
+.IP
+Formatting a filesystem without CRCs selects the V4 format, which is deprecated
+and will be removed from upstream in September 2030.
+Distributors may choose to withdraw support for the V4 format earlier than
+this date.
.TP
.BI finobt= value
This option enables the use of a separate free inode btree index in each
@@ -592,6 +597,8 @@ This option can be used to turn off inode alignment when the
filesystem needs to be mountable by a version of IRIX
that does not have the inode alignment feature
(any release of IRIX before 6.2, and IRIX 6.2 without XFS patches).
+.IP
+This option only applies to the deprecated V4 format.
.TP
.BI attr= value
This is used to specify the version of extended attribute inline
@@ -602,6 +609,8 @@ between attribute and extent data.
The previous version 1, which has fixed regions for attribute and
extent data, is kept for backwards compatibility with kernels older
than version 2.6.16.
+.IP
+This option only applies to the deprecated V4 format.
.TP
.BI projid32bit[= value ]
This is used to enable 32bit quota project identifiers. The
@@ -609,6 +618,8 @@ This is used to enable 32bit quota project identifiers. The
is either 0 or 1, with 1 signifying that 32bit projid are to be enabled.
If the value is omitted, 1 is assumed. (This default changed
in release version 3.2.0.)
+.IP
+This option only applies to the deprecated V4 format.
.TP
.BI sparse[= value ]
Enable sparse inode chunk allocation. The
@@ -690,6 +701,7 @@ stripe-aligned log writes (see the sunit and su options, below).
The previous version 1, which is limited to 32k log buffers and does
not support stripe-aligned writes, is kept for backwards compatibility
with very old 2.4 kernels.
+This option only applies to the deprecated V4 format.
.TP
.BI sunit= value
This specifies the alignment to be used for log writes. The
@@ -744,6 +756,8 @@ is 1 (on) so you must specify
.B lazy-count=0
if you want to disable this feature for older kernels which don't support
it.
+.IP
+This option only applies to the deprecated V4 format.
.RE
.PP
.PD 0
@@ -803,6 +817,8 @@ will be stored in the directory structure. The default value is 1.
When CRCs are enabled (the default), the ftype functionality is always
enabled, and cannot be turned off.
.IP
+This option only applies to the deprecated V4 format.
+.IP
.RE
.TP
.BI \-p " protofile"
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index cccbb224..5ef99316 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -54,6 +54,8 @@ for a detailed description of the XFS log.
Enables unwritten extent support on a filesystem that does not
already have this enabled (for legacy filesystems, it can't be
disabled anymore at mkfs time).
+.IP
+This option only applies to the deprecated V4 format.
.TP
.B \-f
Specifies that the filesystem image to be processed is stored in a
@@ -67,12 +69,16 @@ option).
.B \-j
Enables version 2 log format (journal format supporting larger
log buffers).
+.IP
+This option only applies to the deprecated V4 format.
.TP
.B \-l
Print the current filesystem label.
.TP
.B \-p
Enable 32bit project identifier support (PROJID32BIT feature).
+.IP
+This option only applies to the deprecated V4 format.
.TP
.B \-u
Print the current filesystem UUID (Universally Unique IDentifier).
@@ -83,6 +89,8 @@ Enable (1) or disable (0) lazy-counters in the filesystem.
Lazy-counters may not be disabled on Version 5 superblock filesystems
(i.e. those with metadata CRCs enabled).
.IP
+In other words, this option only applies to the deprecated V4 format.
+.IP
This operation may take quite a bit of time on large filesystems as the
entire filesystem needs to be scanned when this option is changed.
.IP
@@ -92,6 +100,8 @@ information is kept in other parts of the filesystem to be able to
maintain the counter values without needing to keep them in the
superblock. This gives significant improvements in performance on some
configurations and metadata intensive workloads.
+.IP
+This option only applies to the deprecated V4 format.
.TP
.BI \-L " label"
Set the filesystem label to
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/5] man: mark all deprecated V4 format options
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
0 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2021-02-25 7:39 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch, bfoster
On Fri, Feb 12, 2021 at 09:47:09PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Update the manual pages for the most popular tools to note which options
> are only useful with the V4 XFS format, and that the V4 format is
> deprecated and will be removed no later than September 2030.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems
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-13 5:47 ` 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
` (2 subsequent siblings)
4 siblings, 2 replies; 11+ messages in thread
From: Darrick J. Wong @ 2021-02-13 5:47 UTC (permalink / raw)
To: sandeen, djwong; +Cc: linux-xfs, hch, bfoster
From: Darrick J. Wong <djwong@kernel.org>
Add some helper functions so that we can allow users to upgrade V5
filesystems in a sane manner. This just lands the boilerplate; the
actual feature validation and whatnot will land in the next patches.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
repair/phase2.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/repair/phase2.c b/repair/phase2.c
index 952ac4a5..f654edcc 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -131,6 +131,40 @@ zero_log(
libxfs_max_lsn = log->l_last_sync_lsn;
}
+/* Perform the user's requested upgrades on filesystem. */
+static void
+upgrade_filesystem(
+ struct xfs_mount *mp)
+{
+ struct xfs_buf *bp;
+ bool dirty = false;
+ int error;
+
+ if (no_modify || !dirty)
+ return;
+
+ bp = libxfs_getsb(mp);
+ if (!bp || bp->b_error) {
+ do_error(
+ _("couldn't get superblock for feature upgrade, err=%d\n"),
+ bp ? bp->b_error : ENOMEM);
+ } else {
+ libxfs_sb_to_disk(bp->b_addr, &mp->m_sb);
+
+ /*
+ * Write the primary super to disk immediately so that
+ * needsrepair will be set if repair doesn't complete.
+ */
+ error = -libxfs_bwrite(bp);
+ if (error)
+ do_error(
+ _("filesystem feature upgrade failed, err=%d\n"),
+ error);
+ }
+ if (bp)
+ libxfs_buf_relse(bp);
+}
+
/*
* ok, at this point, the fs is mounted but the root inode may be
* trashed and the ag headers haven't been checked. So we have
@@ -235,4 +269,10 @@ phase2(
do_warn(_("would correct\n"));
}
}
+
+ /*
+ * Upgrade the filesystem now that we've done a preliminary check of
+ * the superblocks, the AGs, the log, and the metadata inodes.
+ */
+ upgrade_filesystem(mp);
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems
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
1 sibling, 0 replies; 11+ messages in thread
From: Brian Foster @ 2021-02-16 12:18 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch
On Fri, Feb 12, 2021 at 09:47:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Add some helper functions so that we can allow users to upgrade V5
> filesystems in a sane manner. This just lands the boilerplate; the
> actual feature validation and whatnot will land in the next patches.
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> repair/phase2.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
>
> diff --git a/repair/phase2.c b/repair/phase2.c
> index 952ac4a5..f654edcc 100644
> --- a/repair/phase2.c
> +++ b/repair/phase2.c
> @@ -131,6 +131,40 @@ zero_log(
> libxfs_max_lsn = log->l_last_sync_lsn;
> }
>
> +/* Perform the user's requested upgrades on filesystem. */
> +static void
> +upgrade_filesystem(
> + struct xfs_mount *mp)
> +{
> + struct xfs_buf *bp;
> + bool dirty = false;
> + int error;
> +
> + if (no_modify || !dirty)
> + return;
> +
> + bp = libxfs_getsb(mp);
> + if (!bp || bp->b_error) {
> + do_error(
> + _("couldn't get superblock for feature upgrade, err=%d\n"),
> + bp ? bp->b_error : ENOMEM);
> + } else {
> + libxfs_sb_to_disk(bp->b_addr, &mp->m_sb);
> +
> + /*
> + * Write the primary super to disk immediately so that
> + * needsrepair will be set if repair doesn't complete.
> + */
> + error = -libxfs_bwrite(bp);
> + if (error)
> + do_error(
> + _("filesystem feature upgrade failed, err=%d\n"),
> + error);
> + }
> + if (bp)
> + libxfs_buf_relse(bp);
> +}
> +
> /*
> * ok, at this point, the fs is mounted but the root inode may be
> * trashed and the ag headers haven't been checked. So we have
> @@ -235,4 +269,10 @@ phase2(
> do_warn(_("would correct\n"));
> }
> }
> +
> + /*
> + * Upgrade the filesystem now that we've done a preliminary check of
> + * the superblocks, the AGs, the log, and the metadata inodes.
> + */
> + upgrade_filesystem(mp);
> }
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems
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
1 sibling, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2021-02-25 7:40 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch, bfoster
On Fri, Feb 12, 2021 at 09:47:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Add some helper functions so that we can allow users to upgrade V5
> filesystems in a sane manner. This just lands the boilerplate; the
> actual feature validation and whatnot will land in the next patches.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/5] xfs_admin: support adding features to V5 filesystems
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-13 5:47 ` [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems Darrick J. Wong
@ 2021-02-13 5:47 ` Darrick J. Wong
2021-02-13 5:47 ` [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
2021-02-13 5:47 ` [PATCH 5/5] xfs_repair: enable bigtime " Darrick J. Wong
4 siblings, 0 replies; 11+ messages in thread
From: Darrick J. Wong @ 2021-02-13 5:47 UTC (permalink / raw)
To: sandeen, djwong; +Cc: Christoph Hellwig, linux-xfs, hch, bfoster
From: Darrick J. Wong <djwong@kernel.org>
Teach the xfs_admin script how to add features to V5 filesystems.
Technically speaking we could add lazycount to the list, but that option
is only useful for the V4 format which is deprecated.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
db/xfs_admin.sh | 6 ++++--
man/man8/xfs_admin.8 | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
index 430872ef..7a467dbe 100755
--- a/db/xfs_admin.sh
+++ b/db/xfs_admin.sh
@@ -8,9 +8,10 @@ status=0
DB_OPTS=""
REPAIR_OPTS=""
REPAIR_DEV_OPTS=""
-USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-r rtdev] [-U uuid] device [logdev]"
+DB_LOG_OPTS=""
+USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-O v5_feature] [-r rtdev] [-U uuid] device [logdev]"
-while getopts "c:efjlL:pr:uU:V" c
+while getopts "c:efjlL:O:pr:uU:V" c
do
case $c in
c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;;
@@ -19,6 +20,7 @@ do
j) DB_OPTS=$DB_OPTS" -c 'version log2'";;
l) DB_OPTS=$DB_OPTS" -r -c label";;
L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
+ O) REPAIR_OPTS=$REPAIR_OPTS" -c $OPTARG=1";;
p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";;
r) REPAIR_DEV_OPTS=" -r '$OPTARG'";;
u) DB_OPTS=$DB_OPTS" -r -c uuid";;
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index 5ef99316..ae661648 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -6,6 +6,8 @@ xfs_admin \- change parameters of an XFS filesystem
[
.B \-eflpu
] [
+.BI \-O " featurelist"
+] [
.BR "\-c 0" | 1
] [
.B \-L
@@ -116,6 +118,26 @@ The filesystem label can be cleared using the special "\c
" value for
.IR label .
.TP
+.BI \-O " feature1" = "status" , "feature2" = "status..."
+Add or remove features on an existing V5 filesystem.
+The features should be specified as a comma-separated list.
+.I status
+should be either 0 to disable the feature or 1 to enable the feature.
+Note, however, that most features cannot be disabled.
+.IP
+.B NOTE:
+Administrators must ensure the filesystem is clean by running
+.B xfs_repair -n
+to inspect the filesystem before performing the upgrade.
+If corruption is found, recovery procedures (e.g. reformat followed by
+restoration from backup; or running
+.B xfs_repair
+without the
+.BR -n )
+must be followed to clean the filesystem.
+.IP
+There are no feature options currently.
+.TP
.BI \-U " uuid"
Set the UUID of the filesystem to
.IR uuid .
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair
2021-02-13 5:47 [PATCHSET v6 0/5] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
` (2 preceding siblings ...)
2021-02-13 5:47 ` [PATCH 3/5] xfs_admin: support adding features to V5 filesystems Darrick J. Wong
@ 2021-02-13 5:47 ` Darrick J. Wong
2021-02-16 12:18 ` Brian Foster
2021-02-13 5:47 ` [PATCH 5/5] xfs_repair: enable bigtime " Darrick J. Wong
4 siblings, 1 reply; 11+ messages in thread
From: Darrick J. Wong @ 2021-02-13 5:47 UTC (permalink / raw)
To: sandeen, djwong; +Cc: Christoph Hellwig, linux-xfs, hch, bfoster
From: Darrick J. Wong <djwong@kernel.org>
Use xfs_repair to add the inode btree counter feature to a filesystem.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
man/man8/xfs_admin.8 | 11 ++++++++++-
repair/globals.c | 1 +
repair/globals.h | 1 +
repair/phase2.c | 30 ++++++++++++++++++++++++++++++
repair/xfs_repair.c | 11 +++++++++++
5 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index ae661648..4ba718d8 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -136,7 +136,16 @@ without the
.BR -n )
must be followed to clean the filesystem.
.IP
-There are no feature options currently.
+Supported features are as follows:
+.RS 0.7i
+.TP 0.4i
+.B inobtcount
+Keep a count the number of blocks in each inode btree in the AGI.
+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.
+.RE
.TP
.BI \-U " uuid"
Set the UUID of the filesystem to
diff --git a/repair/globals.c b/repair/globals.c
index 537d068b..47d90bd3 100644
--- a/repair/globals.c
+++ b/repair/globals.c
@@ -48,6 +48,7 @@ char *rt_name; /* Name of realtime device */
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 */
/* misc status variables */
diff --git a/repair/globals.h b/repair/globals.h
index a9287320..5b6fe4d4 100644
--- a/repair/globals.h
+++ b/repair/globals.h
@@ -89,6 +89,7 @@ extern char *rt_name; /* Name of realtime device */
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 */
/* misc status variables */
diff --git a/repair/phase2.c b/repair/phase2.c
index f654edcc..96074a1d 100644
--- a/repair/phase2.c
+++ b/repair/phase2.c
@@ -131,6 +131,33 @@ zero_log(
libxfs_max_lsn = log->l_last_sync_lsn;
}
+static bool
+set_inobtcount(
+ struct xfs_mount *mp)
+{
+ if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+ printf(
+ _("Inode btree count feature only supported on V5 filesystems.\n"));
+ exit(0);
+ }
+
+ if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
+ printf(
+ _("Inode btree count feature requires free inode btree.\n"));
+ exit(0);
+ }
+
+ if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
+ printf(_("Filesystem already has inode btree counts.\n"));
+ exit(0);
+ }
+
+ printf(_("Adding inode btree counts to filesystem.\n"));
+ mp->m_sb.sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
+ mp->m_sb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+ return true;
+}
+
/* Perform the user's requested upgrades on filesystem. */
static void
upgrade_filesystem(
@@ -140,6 +167,9 @@ upgrade_filesystem(
bool dirty = false;
int error;
+ if (add_inobtcount)
+ dirty |= set_inobtcount(mp);
+
if (no_modify || !dirty)
return;
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 6b60b8f4..2d9dca6b 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -65,11 +65,13 @@ static char *o_opts[] = {
*/
enum c_opt_nums {
CONVERT_LAZY_COUNT = 0,
+ CONVERT_INOBTCOUNT,
C_MAX_OPTS,
};
static char *c_opts[] = {
[CONVERT_LAZY_COUNT] = "lazycount",
+ [CONVERT_INOBTCOUNT] = "inobtcount",
[C_MAX_OPTS] = NULL,
};
@@ -302,6 +304,15 @@ process_args(int argc, char **argv)
lazy_count = (int)strtol(val, NULL, 0);
convert_lazy_count = 1;
break;
+ case CONVERT_INOBTCOUNT:
+ if (!val)
+ do_abort(
+ _("-c inobtcount requires a parameter\n"));
+ if (strtol(val, NULL, 0) != 1)
+ do_abort(
+ _("-c inobtcount only supports upgrades\n"));
+ add_inobtcount = true;
+ break;
default:
unknown('c', val);
break;
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair
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
0 siblings, 0 replies; 11+ messages in thread
From: Brian Foster @ 2021-02-16 12:18 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: sandeen, Christoph Hellwig, linux-xfs
On Fri, Feb 12, 2021 at 09:47:25PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Use xfs_repair to add the inode btree counter feature to a filesystem.
>
> 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 | 11 ++++++++++-
> repair/globals.c | 1 +
> repair/globals.h | 1 +
> repair/phase2.c | 30 ++++++++++++++++++++++++++++++
> repair/xfs_repair.c | 11 +++++++++++
> 5 files changed, 53 insertions(+), 1 deletion(-)
>
>
> diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
> index ae661648..4ba718d8 100644
> --- a/man/man8/xfs_admin.8
> +++ b/man/man8/xfs_admin.8
> @@ -136,7 +136,16 @@ without the
> .BR -n )
> must be followed to clean the filesystem.
> .IP
> -There are no feature options currently.
> +Supported features are as follows:
> +.RS 0.7i
> +.TP 0.4i
> +.B inobtcount
> +Keep a count the number of blocks in each inode btree in the AGI.
> +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.
> +.RE
> .TP
> .BI \-U " uuid"
> Set the UUID of the filesystem to
> diff --git a/repair/globals.c b/repair/globals.c
> index 537d068b..47d90bd3 100644
> --- a/repair/globals.c
> +++ b/repair/globals.c
> @@ -48,6 +48,7 @@ char *rt_name; /* Name of realtime device */
> 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 */
>
> /* misc status variables */
>
> diff --git a/repair/globals.h b/repair/globals.h
> index a9287320..5b6fe4d4 100644
> --- a/repair/globals.h
> +++ b/repair/globals.h
> @@ -89,6 +89,7 @@ extern char *rt_name; /* Name of realtime device */
> 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 */
>
> /* misc status variables */
>
> diff --git a/repair/phase2.c b/repair/phase2.c
> index f654edcc..96074a1d 100644
> --- a/repair/phase2.c
> +++ b/repair/phase2.c
> @@ -131,6 +131,33 @@ zero_log(
> libxfs_max_lsn = log->l_last_sync_lsn;
> }
>
> +static bool
> +set_inobtcount(
> + struct xfs_mount *mp)
> +{
> + if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> + printf(
> + _("Inode btree count feature only supported on V5 filesystems.\n"));
> + exit(0);
> + }
> +
> + if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
> + printf(
> + _("Inode btree count feature requires free inode btree.\n"));
> + exit(0);
> + }
> +
> + if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
> + printf(_("Filesystem already has inode btree counts.\n"));
> + exit(0);
> + }
> +
> + printf(_("Adding inode btree counts to filesystem.\n"));
> + mp->m_sb.sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
> + mp->m_sb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> + return true;
> +}
> +
> /* Perform the user's requested upgrades on filesystem. */
> static void
> upgrade_filesystem(
> @@ -140,6 +167,9 @@ upgrade_filesystem(
> bool dirty = false;
> int error;
>
> + if (add_inobtcount)
> + dirty |= set_inobtcount(mp);
> +
> if (no_modify || !dirty)
> return;
>
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index 6b60b8f4..2d9dca6b 100644
> --- a/repair/xfs_repair.c
> +++ b/repair/xfs_repair.c
> @@ -65,11 +65,13 @@ static char *o_opts[] = {
> */
> enum c_opt_nums {
> CONVERT_LAZY_COUNT = 0,
> + CONVERT_INOBTCOUNT,
> C_MAX_OPTS,
> };
>
> static char *c_opts[] = {
> [CONVERT_LAZY_COUNT] = "lazycount",
> + [CONVERT_INOBTCOUNT] = "inobtcount",
> [C_MAX_OPTS] = NULL,
> };
>
> @@ -302,6 +304,15 @@ process_args(int argc, char **argv)
> lazy_count = (int)strtol(val, NULL, 0);
> convert_lazy_count = 1;
> break;
> + case CONVERT_INOBTCOUNT:
> + if (!val)
> + do_abort(
> + _("-c inobtcount requires a parameter\n"));
> + if (strtol(val, NULL, 0) != 1)
> + do_abort(
> + _("-c inobtcount only supports upgrades\n"));
> + add_inobtcount = true;
> + break;
> default:
> unknown('c', val);
> break;
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 5/5] xfs_repair: enable bigtime upgrade via repair
2021-02-13 5:47 [PATCHSET v6 0/5] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
` (3 preceding siblings ...)
2021-02-13 5:47 ` [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
@ 2021-02-13 5:47 ` Darrick J. Wong
4 siblings, 0 replies; 11+ messages in thread
From: Darrick J. Wong @ 2021-02-13 5:47 UTC (permalink / raw)
To: sandeen, djwong; +Cc: Christoph Hellwig, Brian Foster, linux-xfs, hch, bfoster
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;
^ permalink raw reply related [flat|nested] 11+ messages in thread