From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 9/9] xfs: allow bulkstat_single of special inodes
Date: Thu, 6 Jun 2019 14:15:06 -0700 [thread overview]
Message-ID: <20190606211506.GC1871505@magnolia> (raw)
In-Reply-To: <155916890871.758159.15869425204728307163.stgit@magnolia>
On Wed, May 29, 2019 at 03:28:28PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Create a new ireq flag (for single bulkstats) that enables userspace to
> ask us for a special inode number instead of interpreting @ino as a
> literal inode number. This enables us to query the root inode easily.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_fs.h | 11 ++++++++++-
> fs/xfs/xfs_ioctl.c | 10 ++++++++++
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h
> index 77c06850ac52..1826aa11b585 100644
> --- a/fs/xfs/libxfs/xfs_fs.h
> +++ b/fs/xfs/libxfs/xfs_fs.h
> @@ -482,7 +482,16 @@ struct xfs_ireq {
> uint64_t reserved[2]; /* must be zero */
> };
>
> -#define XFS_IREQ_FLAGS_ALL (0)
> +/*
> + * The @ino value is a special value, not a literal inode number. See the
> + * XFS_IREQ_SPECIAL_* values below.
> + */
> +#define XFS_IREQ_SPECIAL (1 << 0)
> +
> +#define XFS_IREQ_FLAGS_ALL (XFS_IREQ_SPECIAL)
> +
> +/* Return the root directory inode. */
> +#define XFS_IREQ_SPECIAL_ROOT (1)
>
> /*
> * ioctl structures for v5 bulkstat and inumbers requests
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index cf48a2bad325..605bfff3011f 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -959,6 +959,16 @@ xfs_ireq_setup(
> memchr_inv(hdr->reserved, 0, sizeof(hdr->reserved)))
> return -EINVAL;
>
> + if (hdr->flags & XFS_IREQ_SPECIAL) {
> + switch (hdr->ino) {
> + case XFS_IREQ_SPECIAL_ROOT:
Hmmm sooo... this doesn't solve Eric's immediate problem where xfsdump
needs to be fed the root inode. We assumed for years that the first
inode returned by bulkstat would always be the root dir, but it turned
out that mkfs puts the root dir at the start of the first possible inode
chunk past the end of the (AG headers + AG btree roots + AGFL blocks).
If all those blocks get freed then inodes can sneak into AG 0 before the
"first" inode chunk, invalidating the assumption.
IOWS, do we need to retrofit SPECIAL_ROOT into the old FSBULKSTAT_SINGLE
somehow? Maybe if you pass in bulkreq.lastip == NULL then you get root?
--D
> + hdr->ino = mp->m_sb.sb_rootino;
> + break;
> + default:
> + return -EINVAL;
> + }
> + }
> +
> if (XFS_INO_TO_AGNO(mp, hdr->ino) >= mp->m_sb.sb_agcount)
> return -EINVAL;
>
>
next prev parent reply other threads:[~2019-06-06 21:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 22:27 [PATCH 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-05-29 22:27 ` [PATCH 1/9] xfs: remove various bulk request typedef usage Darrick J. Wong
2019-06-05 22:29 ` Allison Collins
2019-05-29 22:27 ` [PATCH 2/9] xfs: rename bulkstat functions Darrick J. Wong
2019-06-05 22:29 ` Allison Collins
2019-05-29 22:27 ` [PATCH 3/9] xfs: introduce new v5 bulkstat structure Darrick J. Wong
2019-06-05 22:29 ` Allison Collins
2019-06-06 20:17 ` Darrick J. Wong
2019-06-06 22:41 ` Allison Collins
2019-05-29 22:27 ` [PATCH 4/9] xfs: introduce v5 inode group structure Darrick J. Wong
2019-06-05 22:30 ` Allison Collins
2019-05-29 22:28 ` [PATCH 5/9] xfs: wire up new v5 bulkstat ioctls Darrick J. Wong
2019-06-05 22:30 ` Allison Collins
2019-06-06 21:10 ` Darrick J. Wong
2019-06-06 22:37 ` Allison Collins
2019-06-07 16:10 ` Darrick J. Wong
2019-05-29 22:28 ` [PATCH 6/9] xfs: wire up the new v5 bulkstat_single ioctl Darrick J. Wong
2019-06-05 22:30 ` Allison Collins
2019-05-29 22:28 ` [PATCH 7/9] xfs: wire up the v5 INUMBERS ioctl Darrick J. Wong
2019-06-05 22:30 ` Allison Collins
2019-05-29 22:28 ` [PATCH 8/9] xfs: specify AG in bulk req Darrick J. Wong
2019-06-05 22:30 ` Allison Collins
2019-05-29 22:28 ` [PATCH 9/9] xfs: allow bulkstat_single of special inodes Darrick J. Wong
2019-06-05 22:31 ` Allison Collins
2019-06-06 21:15 ` Darrick J. Wong [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-06-12 6:49 [PATCH v5 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-06-12 6:50 ` [PATCH 9/9] xfs: allow bulkstat_single of special inodes Darrick J. Wong
2019-06-26 20:45 [PATCH v6 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-06-26 20:46 ` [PATCH 9/9] xfs: allow bulkstat_single of special inodes Darrick J. Wong
2019-07-03 13:25 ` Brian Foster
2019-07-03 15:09 ` 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=20190606211506.GC1871505@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox