linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET v3 0/2] xfs_admin: support upgrading v5 filesystems
@ 2021-01-16  1:24 Darrick J. Wong
  2021-01-16  1:25 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
  2021-01-16  1:25 ` [PATCH 2/2] xfs_db: add bigtime " Darrick J. Wong
  0 siblings, 2 replies; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-16  1:24 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: Christoph Hellwig, linux-xfs

Hi all,

This submission extends xfs_db and xfs_admin to support adding the inode
btree counter and bigtime features to an existing v5 filesystem.

v2: Rebase to 5.10-rc0
v3: respond to reviewer comments

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=fs-upgrades
---
 db/sb.c              |   38 ++++++++++++++++++++++++++++++++++++++
 man/man8/xfs_admin.8 |   12 ++++++++++++
 man/man8/xfs_db.8    |    7 +++++++
 3 files changed, 57 insertions(+)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-16  1:24 [PATCHSET v3 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
@ 2021-01-16  1:25 ` Darrick J. Wong
  2021-01-16  1:25 ` [PATCH 2/2] xfs_db: add bigtime " Darrick J. Wong
  1 sibling, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-16  1:25 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: linux-xfs

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

Enable users to upgrade their filesystems to support inode btree block
counters.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 db/sb.c              |   22 ++++++++++++++++++++++
 man/man8/xfs_admin.8 |    7 +++++++
 man/man8/xfs_db.8    |    3 +++
 3 files changed, 32 insertions(+)


diff --git a/db/sb.c b/db/sb.c
index fcc2a0ed..767bc858 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -597,6 +597,7 @@ version_help(void)
 " 'version attr2'    - enable v2 inline extended attributes\n"
 " 'version log2'     - enable v2 log format\n"
 " 'version needsrepair' - flag filesystem as requiring repair\n"
+" 'version inobtcount' - enable inode btree counters\n"
 "\n"
 "The version function prints currently enabled features for a filesystem\n"
 "according to the version field of its primary superblock.\n"
@@ -852,6 +853,27 @@ version_f(
 			}
 
 			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+		} else if (!strcasecmp(argv[1], "inobtcount")) {
+			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature is already enabled\n"));
+				exitcode = 2;
+				return 1;
+			}
+			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
+				exitcode = 2;
+				return 1;
+			}
+			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
+				exitcode = 2;
+				return 1;
+			}
+
+			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
 		} 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 b423981d..a776b375 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
 Until
 .BR xfs_repair (8)
 is run, the filesystem will not be mountable.
+.TP
+.B inobtcount
+Upgrade a V5 filesystem to support the inode btree counters feature.
+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.
 .RE
 .TP
 .BI \-U " uuid"
diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
index 7331cf19..1b826e5d 100644
--- a/man/man8/xfs_db.8
+++ b/man/man8/xfs_db.8
@@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
 if the
 .B needsrepair
 option is specified and the filesystem is formatted with the V5 format.
+Support for the inode btree counters feature can be enabled by using the
+.B inobtcount
+option if the filesystem is formatted with the V5 format.
 .IP
 If no argument is given, the current version and feature bits are printed.
 With one argument, this command will write the updated version number


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] xfs_db: add bigtime upgrade path
  2021-01-16  1:24 [PATCHSET v3 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
  2021-01-16  1:25 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
@ 2021-01-16  1:25 ` Darrick J. Wong
  1 sibling, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-16  1:25 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: Christoph Hellwig, linux-xfs

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

Enable users to upgrade their filesystems to bigtime support.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 db/sb.c              |   16 ++++++++++++++++
 man/man8/xfs_admin.8 |    5 +++++
 man/man8/xfs_db.8    |    4 ++++
 3 files changed, 25 insertions(+)


diff --git a/db/sb.c b/db/sb.c
index 767bc858..2ab07533 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -598,6 +598,7 @@ version_help(void)
 " 'version log2'     - enable v2 log format\n"
 " 'version needsrepair' - flag filesystem as requiring repair\n"
 " 'version inobtcount' - enable inode btree counters\n"
+" 'version bigtime'  - enable timestamps beyond year 2038\n"
 "\n"
 "The version function prints currently enabled features for a filesystem\n"
 "according to the version field of its primary superblock.\n"
@@ -874,6 +875,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 = 2;
+				return 1;
+			}
+			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+				dbprintf(
+		_("bigtime feature cannot be enabled on pre-V5 filesystems\n"));
+				exitcode = 2;
+				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 a776b375..a5ef9f84 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -123,6 +123,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 a V5 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"
diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
index 1b826e5d..cd2ace12 100644
--- a/man/man8/xfs_db.8
+++ b/man/man8/xfs_db.8
@@ -979,6 +979,10 @@ option is specified and the filesystem is formatted with the V5 format.
 Support for the inode btree counters feature can be enabled by using the
 .B inobtcount
 option if the filesystem is formatted with the V5 format.
+Support for timestamps between the years 2038 and 2486 can be enabled by
+using the
+.B bigtime
+option if the filesystem is formatted with the V5 format.
 .IP
 If no argument is given, the current version and feature bits are printed.
 With one argument, this command will write the updated version number


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-02-03 19:43 [PATCHSET v4 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
@ 2021-02-03 19:43 ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2021-02-03 19:43 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: linux-xfs, hch

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

Enable users to upgrade their filesystems to support inode btree block
counters.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 db/sb.c              |   21 +++++++++++++++++++++
 man/man8/xfs_admin.8 |    7 +++++++
 man/man8/xfs_db.8    |    3 +++
 3 files changed, 31 insertions(+)


diff --git a/db/sb.c b/db/sb.c
index 223b84fe..c303c321 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -596,6 +596,7 @@ version_help(void)
 " 'version attr2'    - enable v2 inline extended attributes\n"
 " 'version log2'     - enable v2 log format\n"
 " 'version needsrepair' - flag filesystem as requiring repair\n"
+" 'version inobtcount' - enable inode btree counters\n"
 "\n"
 "The version function prints currently enabled features for a filesystem\n"
 "according to the version field of its primary superblock.\n"
@@ -856,6 +857,26 @@ version_f(
 			}
 
 			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+		} else if (!strcasecmp(argv[1], "inobtcount")) {
+			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature is already enabled\n"));
+				return 1;
+			}
+			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
+				exitcode = 2;
+				return 1;
+			}
+			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
+				exitcode = 2;
+				return 1;
+			}
+
+			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
 		} 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 d8a0125c..8421e28f 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -131,6 +131,13 @@ Flag the filesystem as needing repairs.
 Until
 .BR xfs_repair (8)
 is run, the filesystem will not be mountable.
+.TP
+.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"
diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
index 792d98c8..0335317e 100644
--- a/man/man8/xfs_db.8
+++ b/man/man8/xfs_db.8
@@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
 if the
 .B needsrepair
 option is specified and the filesystem is formatted with the V5 format.
+Support for the inode btree counters feature can be enabled by using the
+.B inobtcount
+option if the filesystem is formatted with the V5 format.
 .IP
 If no argument is given, the current version and feature bits are printed.
 With one argument, this command will write the updated version number


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-14  9:40       ` Brian Foster
@ 2021-01-15 20:40         ` Darrick J. Wong
  0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-15 20:40 UTC (permalink / raw)
  To: Brian Foster; +Cc: sandeen, darrick.wong, linux-xfs

On Thu, Jan 14, 2021 at 04:40:57AM -0500, Brian Foster wrote:
> On Wed, Jan 13, 2021 at 05:08:35PM -0800, Darrick J. Wong wrote:
> > On Wed, Jan 13, 2021 at 01:35:05PM -0500, Brian Foster wrote:
> > > On Fri, Jan 08, 2021 at 10:28:25PM -0800, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Enable users to upgrade their filesystems to support inode btree block
> > > > counters.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > > 
> > > These two look Ok to me, but I noticed that both commands have weird
> > > error semantics when run through xfs_admin and the associated features
> > > are already set. E.g.:
> > > 
> > > # xfs_admin -O inobtcount /dev/test/tmp 
> > > Upgrading V5 filesystem
> > > Upgraded V5 filesystem.  Please run xfs_repair.
> > > versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT,SPARSE_INODES,REFLINK,INOBTCNT
> > > Running xfs_repair to ensure filesystem consistency.
> > > # xfs_admin -O inobtcount /dev/test/tmp 
> > > inode btree counter feature is already enabled
> > > Running xfs_repair to ensure filesystem consistency.
> > > Conversion failed, is the filesystem unmounted?
> > > # mount /dev/test/tmp /mnt/
> > > # umount /mnt/
> > > 
> > > So it looks like we run repair again the second time around even though
> > > the bit was already set, which is probably unnecessary, but then also
> > > for some reason report the result as failed.
> > 
> > Hm.  I guess I could define a second exitcode that means "no action
> > taken", and have xfs_admin exit.
> > 
> 
> It's not totally clear to me what the expected flow is supposed to be if
> a particular feature upgrade fails or is otherwise interrupted partway
> through.

Me neither.  But let me try to work through some outcomes:

Upgrade succeeds -- xfs_db returns 0, needsrepair is set, repair runs
Cannot upgrade -- xfs_db returns 2, fs untouched
Feature already set -- xfs_db returns 2, fs untouched
FS corrupt -- xfs_db returns 1, fs untouched, repair runs
primary super write fails -- xfs_db returns 1, fs untouched, repair runs
secondary sb write fails -- xfs_db returns 1, primary super has
			    needsrepair set, repair runs

Does that seem thorough enough?  That's, uh, what the code in my dev
tree does now.  Will send out a v++ in a bit.

> If the expectation is for the user to rerun the xfs_admin
> command, it might be worth making sure that we somehow or another fall
> back through to repair when appropriate (whether it be unconditionally,
> by checking if NEEDSREPAIR is still set, etc.)..

My expectation is that if xfs_db fails, the admin should run xfs_repair
to fix anything that's wrong with the fs.  Maybe they can skip that if
the primary super write fails with EIO, but that's up to the sysadmin's
judgment.

--D

> Brian
> 
> > > (I also realized that repair is fixing up some agi metadata in this
> > > case, so my previous thought around a special repair verify mode is
> > > probably not relevant..).
> > 
> > <nod>
> > 
> > --D
> > 
> > > Brian
> > > 
> > > >  db/sb.c              |   22 ++++++++++++++++++++++
> > > >  man/man8/xfs_admin.8 |    7 +++++++
> > > >  man/man8/xfs_db.8    |    3 +++
> > > >  3 files changed, 32 insertions(+)
> > > > 
> > > > 
> > > > diff --git a/db/sb.c b/db/sb.c
> > > > index 93e4c405..b89ccdbe 100644
> > > > --- a/db/sb.c
> > > > +++ b/db/sb.c
> > > > @@ -597,6 +597,7 @@ version_help(void)
> > > >  " 'version attr2'    - enable v2 inline extended attributes\n"
> > > >  " 'version log2'     - enable v2 log format\n"
> > > >  " 'version needsrepair' - flag filesystem as requiring repair\n"
> > > > +" 'version inobtcount' - enable inode btree counters\n"
> > > >  "\n"
> > > >  "The version function prints currently enabled features for a filesystem\n"
> > > >  "according to the version field of its primary superblock.\n"
> > > > @@ -857,6 +858,27 @@ version_f(
> > > >  			}
> > > >  
> > > >  			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> > > > +		} else if (!strcasecmp(argv[1], "inobtcount")) {
> > > > +			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
> > > > +				dbprintf(
> > > > +		_("inode btree counter feature is already enabled\n"));
> > > > +				exitcode = 1;
> > > > +				return 1;
> > > > +			}
> > > > +			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
> > > > +				dbprintf(
> > > > +		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
> > > > +				exitcode = 1;
> > > > +				return 1;
> > > > +			}
> > > > +			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> > > > +				dbprintf(
> > > > +		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
> > > > +				exitcode = 1;
> > > > +				return 1;
> > > > +			}
> > > > +
> > > > +			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
> > > >  		} 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 b423981d..a776b375 100644
> > > > --- a/man/man8/xfs_admin.8
> > > > +++ b/man/man8/xfs_admin.8
> > > > @@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
> > > >  Until
> > > >  .BR xfs_repair (8)
> > > >  is run, the filesystem will not be mountable.
> > > > +.TP
> > > > +.B inobtcount
> > > > +Upgrade a V5 filesystem to support the inode btree counters feature.
> > > > +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.
> > > >  .RE
> > > >  .TP
> > > >  .BI \-U " uuid"
> > > > diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
> > > > index 7331cf19..1b826e5d 100644
> > > > --- a/man/man8/xfs_db.8
> > > > +++ b/man/man8/xfs_db.8
> > > > @@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
> > > >  if the
> > > >  .B needsrepair
> > > >  option is specified and the filesystem is formatted with the V5 format.
> > > > +Support for the inode btree counters feature can be enabled by using the
> > > > +.B inobtcount
> > > > +option if the filesystem is formatted with the V5 format.
> > > >  .IP
> > > >  If no argument is given, the current version and feature bits are printed.
> > > >  With one argument, this command will write the updated version number
> > > > 
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-14  1:08     ` Darrick J. Wong
@ 2021-01-14  9:40       ` Brian Foster
  2021-01-15 20:40         ` Darrick J. Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Foster @ 2021-01-14  9:40 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, darrick.wong, linux-xfs

On Wed, Jan 13, 2021 at 05:08:35PM -0800, Darrick J. Wong wrote:
> On Wed, Jan 13, 2021 at 01:35:05PM -0500, Brian Foster wrote:
> > On Fri, Jan 08, 2021 at 10:28:25PM -0800, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Enable users to upgrade their filesystems to support inode btree block
> > > counters.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > 
> > These two look Ok to me, but I noticed that both commands have weird
> > error semantics when run through xfs_admin and the associated features
> > are already set. E.g.:
> > 
> > # xfs_admin -O inobtcount /dev/test/tmp 
> > Upgrading V5 filesystem
> > Upgraded V5 filesystem.  Please run xfs_repair.
> > versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT,SPARSE_INODES,REFLINK,INOBTCNT
> > Running xfs_repair to ensure filesystem consistency.
> > # xfs_admin -O inobtcount /dev/test/tmp 
> > inode btree counter feature is already enabled
> > Running xfs_repair to ensure filesystem consistency.
> > Conversion failed, is the filesystem unmounted?
> > # mount /dev/test/tmp /mnt/
> > # umount /mnt/
> > 
> > So it looks like we run repair again the second time around even though
> > the bit was already set, which is probably unnecessary, but then also
> > for some reason report the result as failed.
> 
> Hm.  I guess I could define a second exitcode that means "no action
> taken", and have xfs_admin exit.
> 

It's not totally clear to me what the expected flow is supposed to be if
a particular feature upgrade fails or is otherwise interrupted partway
through. If the expectation is for the user to rerun the xfs_admin
command, it might be worth making sure that we somehow or another fall
back through to repair when appropriate (whether it be unconditionally,
by checking if NEEDSREPAIR is still set, etc.)..

Brian

> > (I also realized that repair is fixing up some agi metadata in this
> > case, so my previous thought around a special repair verify mode is
> > probably not relevant..).
> 
> <nod>
> 
> --D
> 
> > Brian
> > 
> > >  db/sb.c              |   22 ++++++++++++++++++++++
> > >  man/man8/xfs_admin.8 |    7 +++++++
> > >  man/man8/xfs_db.8    |    3 +++
> > >  3 files changed, 32 insertions(+)
> > > 
> > > 
> > > diff --git a/db/sb.c b/db/sb.c
> > > index 93e4c405..b89ccdbe 100644
> > > --- a/db/sb.c
> > > +++ b/db/sb.c
> > > @@ -597,6 +597,7 @@ version_help(void)
> > >  " 'version attr2'    - enable v2 inline extended attributes\n"
> > >  " 'version log2'     - enable v2 log format\n"
> > >  " 'version needsrepair' - flag filesystem as requiring repair\n"
> > > +" 'version inobtcount' - enable inode btree counters\n"
> > >  "\n"
> > >  "The version function prints currently enabled features for a filesystem\n"
> > >  "according to the version field of its primary superblock.\n"
> > > @@ -857,6 +858,27 @@ version_f(
> > >  			}
> > >  
> > >  			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> > > +		} else if (!strcasecmp(argv[1], "inobtcount")) {
> > > +			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
> > > +				dbprintf(
> > > +		_("inode btree counter feature is already enabled\n"));
> > > +				exitcode = 1;
> > > +				return 1;
> > > +			}
> > > +			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
> > > +				dbprintf(
> > > +		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
> > > +				exitcode = 1;
> > > +				return 1;
> > > +			}
> > > +			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> > > +				dbprintf(
> > > +		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
> > > +				exitcode = 1;
> > > +				return 1;
> > > +			}
> > > +
> > > +			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
> > >  		} 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 b423981d..a776b375 100644
> > > --- a/man/man8/xfs_admin.8
> > > +++ b/man/man8/xfs_admin.8
> > > @@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
> > >  Until
> > >  .BR xfs_repair (8)
> > >  is run, the filesystem will not be mountable.
> > > +.TP
> > > +.B inobtcount
> > > +Upgrade a V5 filesystem to support the inode btree counters feature.
> > > +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.
> > >  .RE
> > >  .TP
> > >  .BI \-U " uuid"
> > > diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
> > > index 7331cf19..1b826e5d 100644
> > > --- a/man/man8/xfs_db.8
> > > +++ b/man/man8/xfs_db.8
> > > @@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
> > >  if the
> > >  .B needsrepair
> > >  option is specified and the filesystem is formatted with the V5 format.
> > > +Support for the inode btree counters feature can be enabled by using the
> > > +.B inobtcount
> > > +option if the filesystem is formatted with the V5 format.
> > >  .IP
> > >  If no argument is given, the current version and feature bits are printed.
> > >  With one argument, this command will write the updated version number
> > > 
> > 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-13 18:35   ` Brian Foster
@ 2021-01-14  1:08     ` Darrick J. Wong
  2021-01-14  9:40       ` Brian Foster
  0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-14  1:08 UTC (permalink / raw)
  To: Brian Foster; +Cc: sandeen, darrick.wong, linux-xfs

On Wed, Jan 13, 2021 at 01:35:05PM -0500, Brian Foster wrote:
> On Fri, Jan 08, 2021 at 10:28:25PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Enable users to upgrade their filesystems to support inode btree block
> > counters.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> 
> These two look Ok to me, but I noticed that both commands have weird
> error semantics when run through xfs_admin and the associated features
> are already set. E.g.:
> 
> # xfs_admin -O inobtcount /dev/test/tmp 
> Upgrading V5 filesystem
> Upgraded V5 filesystem.  Please run xfs_repair.
> versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT,SPARSE_INODES,REFLINK,INOBTCNT
> Running xfs_repair to ensure filesystem consistency.
> # xfs_admin -O inobtcount /dev/test/tmp 
> inode btree counter feature is already enabled
> Running xfs_repair to ensure filesystem consistency.
> Conversion failed, is the filesystem unmounted?
> # mount /dev/test/tmp /mnt/
> # umount /mnt/
> 
> So it looks like we run repair again the second time around even though
> the bit was already set, which is probably unnecessary, but then also
> for some reason report the result as failed.

Hm.  I guess I could define a second exitcode that means "no action
taken", and have xfs_admin exit.

> (I also realized that repair is fixing up some agi metadata in this
> case, so my previous thought around a special repair verify mode is
> probably not relevant..).

<nod>

--D

> Brian
> 
> >  db/sb.c              |   22 ++++++++++++++++++++++
> >  man/man8/xfs_admin.8 |    7 +++++++
> >  man/man8/xfs_db.8    |    3 +++
> >  3 files changed, 32 insertions(+)
> > 
> > 
> > diff --git a/db/sb.c b/db/sb.c
> > index 93e4c405..b89ccdbe 100644
> > --- a/db/sb.c
> > +++ b/db/sb.c
> > @@ -597,6 +597,7 @@ version_help(void)
> >  " 'version attr2'    - enable v2 inline extended attributes\n"
> >  " 'version log2'     - enable v2 log format\n"
> >  " 'version needsrepair' - flag filesystem as requiring repair\n"
> > +" 'version inobtcount' - enable inode btree counters\n"
> >  "\n"
> >  "The version function prints currently enabled features for a filesystem\n"
> >  "according to the version field of its primary superblock.\n"
> > @@ -857,6 +858,27 @@ version_f(
> >  			}
> >  
> >  			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> > +		} else if (!strcasecmp(argv[1], "inobtcount")) {
> > +			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
> > +				dbprintf(
> > +		_("inode btree counter feature is already enabled\n"));
> > +				exitcode = 1;
> > +				return 1;
> > +			}
> > +			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
> > +				dbprintf(
> > +		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
> > +				exitcode = 1;
> > +				return 1;
> > +			}
> > +			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> > +				dbprintf(
> > +		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
> > +				exitcode = 1;
> > +				return 1;
> > +			}
> > +
> > +			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
> >  		} 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 b423981d..a776b375 100644
> > --- a/man/man8/xfs_admin.8
> > +++ b/man/man8/xfs_admin.8
> > @@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
> >  Until
> >  .BR xfs_repair (8)
> >  is run, the filesystem will not be mountable.
> > +.TP
> > +.B inobtcount
> > +Upgrade a V5 filesystem to support the inode btree counters feature.
> > +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.
> >  .RE
> >  .TP
> >  .BI \-U " uuid"
> > diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
> > index 7331cf19..1b826e5d 100644
> > --- a/man/man8/xfs_db.8
> > +++ b/man/man8/xfs_db.8
> > @@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
> >  if the
> >  .B needsrepair
> >  option is specified and the filesystem is formatted with the V5 format.
> > +Support for the inode btree counters feature can be enabled by using the
> > +.B inobtcount
> > +option if the filesystem is formatted with the V5 format.
> >  .IP
> >  If no argument is given, the current version and feature bits are printed.
> >  With one argument, this command will write the updated version number
> > 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-09  6:28 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
@ 2021-01-13 18:35   ` Brian Foster
  2021-01-14  1:08     ` Darrick J. Wong
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Foster @ 2021-01-13 18:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, darrick.wong, linux-xfs

On Fri, Jan 08, 2021 at 10:28:25PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Enable users to upgrade their filesystems to support inode btree block
> counters.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

These two look Ok to me, but I noticed that both commands have weird
error semantics when run through xfs_admin and the associated features
are already set. E.g.:

# xfs_admin -O inobtcount /dev/test/tmp 
Upgrading V5 filesystem
Upgraded V5 filesystem.  Please run xfs_repair.
versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT,SPARSE_INODES,REFLINK,INOBTCNT
Running xfs_repair to ensure filesystem consistency.
# xfs_admin -O inobtcount /dev/test/tmp 
inode btree counter feature is already enabled
Running xfs_repair to ensure filesystem consistency.
Conversion failed, is the filesystem unmounted?
# mount /dev/test/tmp /mnt/
# umount /mnt/

So it looks like we run repair again the second time around even though
the bit was already set, which is probably unnecessary, but then also
for some reason report the result as failed.

(I also realized that repair is fixing up some agi metadata in this
case, so my previous thought around a special repair verify mode is
probably not relevant..).

Brian

>  db/sb.c              |   22 ++++++++++++++++++++++
>  man/man8/xfs_admin.8 |    7 +++++++
>  man/man8/xfs_db.8    |    3 +++
>  3 files changed, 32 insertions(+)
> 
> 
> diff --git a/db/sb.c b/db/sb.c
> index 93e4c405..b89ccdbe 100644
> --- a/db/sb.c
> +++ b/db/sb.c
> @@ -597,6 +597,7 @@ version_help(void)
>  " 'version attr2'    - enable v2 inline extended attributes\n"
>  " 'version log2'     - enable v2 log format\n"
>  " 'version needsrepair' - flag filesystem as requiring repair\n"
> +" 'version inobtcount' - enable inode btree counters\n"
>  "\n"
>  "The version function prints currently enabled features for a filesystem\n"
>  "according to the version field of its primary superblock.\n"
> @@ -857,6 +858,27 @@ version_f(
>  			}
>  
>  			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> +		} else if (!strcasecmp(argv[1], "inobtcount")) {
> +			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
> +				dbprintf(
> +		_("inode btree counter feature is already enabled\n"));
> +				exitcode = 1;
> +				return 1;
> +			}
> +			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
> +				dbprintf(
> +		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
> +				exitcode = 1;
> +				return 1;
> +			}
> +			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
> +				dbprintf(
> +		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
> +				exitcode = 1;
> +				return 1;
> +			}
> +
> +			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
>  		} 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 b423981d..a776b375 100644
> --- a/man/man8/xfs_admin.8
> +++ b/man/man8/xfs_admin.8
> @@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
>  Until
>  .BR xfs_repair (8)
>  is run, the filesystem will not be mountable.
> +.TP
> +.B inobtcount
> +Upgrade a V5 filesystem to support the inode btree counters feature.
> +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.
>  .RE
>  .TP
>  .BI \-U " uuid"
> diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
> index 7331cf19..1b826e5d 100644
> --- a/man/man8/xfs_db.8
> +++ b/man/man8/xfs_db.8
> @@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
>  if the
>  .B needsrepair
>  option is specified and the filesystem is formatted with the V5 format.
> +Support for the inode btree counters feature can be enabled by using the
> +.B inobtcount
> +option if the filesystem is formatted with the V5 format.
>  .IP
>  If no argument is given, the current version and feature bits are printed.
>  With one argument, this command will write the updated version number
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] xfs_db: add inobtcnt upgrade path
  2021-01-09  6:28 [PATCHSET v2 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
@ 2021-01-09  6:28 ` Darrick J. Wong
  2021-01-13 18:35   ` Brian Foster
  0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2021-01-09  6:28 UTC (permalink / raw)
  To: sandeen, darrick.wong; +Cc: linux-xfs

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

Enable users to upgrade their filesystems to support inode btree block
counters.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 db/sb.c              |   22 ++++++++++++++++++++++
 man/man8/xfs_admin.8 |    7 +++++++
 man/man8/xfs_db.8    |    3 +++
 3 files changed, 32 insertions(+)


diff --git a/db/sb.c b/db/sb.c
index 93e4c405..b89ccdbe 100644
--- a/db/sb.c
+++ b/db/sb.c
@@ -597,6 +597,7 @@ version_help(void)
 " 'version attr2'    - enable v2 inline extended attributes\n"
 " 'version log2'     - enable v2 log format\n"
 " 'version needsrepair' - flag filesystem as requiring repair\n"
+" 'version inobtcount' - enable inode btree counters\n"
 "\n"
 "The version function prints currently enabled features for a filesystem\n"
 "according to the version field of its primary superblock.\n"
@@ -857,6 +858,27 @@ version_f(
 			}
 
 			v5features.incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+		} else if (!strcasecmp(argv[1], "inobtcount")) {
+			if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature is already enabled\n"));
+				exitcode = 1;
+				return 1;
+			}
+			if (!xfs_sb_version_hasfinobt(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on filesystems lacking free inode btrees\n"));
+				exitcode = 1;
+				return 1;
+			}
+			if (!xfs_sb_version_hascrc(&mp->m_sb)) {
+				dbprintf(
+		_("inode btree counter feature cannot be enabled on pre-V5 filesystems\n"));
+				exitcode = 1;
+				return 1;
+			}
+
+			v5features.ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
 		} 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 b423981d..a776b375 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -116,6 +116,13 @@ If this is a V5 filesystem, flag the filesystem as needing repairs.
 Until
 .BR xfs_repair (8)
 is run, the filesystem will not be mountable.
+.TP
+.B inobtcount
+Upgrade a V5 filesystem to support the inode btree counters feature.
+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.
 .RE
 .TP
 .BI \-U " uuid"
diff --git a/man/man8/xfs_db.8 b/man/man8/xfs_db.8
index 7331cf19..1b826e5d 100644
--- a/man/man8/xfs_db.8
+++ b/man/man8/xfs_db.8
@@ -976,6 +976,9 @@ The filesystem can be flagged as requiring a run through
 if the
 .B needsrepair
 option is specified and the filesystem is formatted with the V5 format.
+Support for the inode btree counters feature can be enabled by using the
+.B inobtcount
+option if the filesystem is formatted with the V5 format.
 .IP
 If no argument is given, the current version and feature bits are printed.
 With one argument, this command will write the updated version number


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-03 19:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-16  1:24 [PATCHSET v3 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-01-16  1:25 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
2021-01-16  1:25 ` [PATCH 2/2] xfs_db: add bigtime " Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2021-02-03 19:43 [PATCHSET v4 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-02-03 19:43 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
2021-01-09  6:28 [PATCHSET v2 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-01-09  6:28 ` [PATCH 1/2] xfs_db: add inobtcnt upgrade path Darrick J. Wong
2021-01-13 18:35   ` Brian Foster
2021-01-14  1:08     ` Darrick J. Wong
2021-01-14  9:40       ` Brian Foster
2021-01-15 20:40         ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).