All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: sandeen@sandeen.net, darrick.wong@oracle.com, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs_db: add inobtcnt upgrade path
Date: Wed, 13 Jan 2021 13:35:05 -0500	[thread overview]
Message-ID: <20210113183505.GD1284163@bfoster> (raw)
In-Reply-To: <161017370529.1142690.11100691491331155224.stgit@magnolia>

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
> 


  reply	other threads:[~2021-01-13 18:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-01-14  1:08     ` Darrick J. Wong
2021-01-14  9:40       ` Brian Foster
2021-01-15 20:40         ` Darrick J. Wong
2021-01-09  6:28 ` [PATCH 2/2] xfs_db: add bigtime " Darrick J. Wong
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-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

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=20210113183505.GD1284163@bfoster \
    --to=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=djwong@kernel.org \
    --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.