From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH v2 9/9] xfs: allow bulkstat_single of special inodes
Date: Wed, 3 Jul 2019 12:32:05 -0400 [thread overview]
Message-ID: <20190703163205.GN26057@bfoster> (raw)
In-Reply-To: <20190703153454.GX1404256@magnolia>
On Wed, Jul 03, 2019 at 08:34:54AM -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.
>
> The reason for adding the ability to query specifically the root
> directory inode is that certain programs (xfsdump and xfsrestore) want
> to confirm when they've been pointed to the root directory. The
> userspace code assumes the root directory is always the first result
> from calling bulkstat with lastino == 0, but this isn't true if the
> (initial btree roots + initial AGFL + inode alignment padding) is itself
> long enough to be allocated to new inodes if all of those blocks should
> happen to be free at the same time. Rather than make userspace guess
> at internal filesystem state, we provide a direct query.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Reviewed-by: Allison Collins <allison.henderson@oracle.com>
> ---
> v2: elaborate on why we are adding this new ireq flag
> ---
Reviewed-by: Brian Foster <bfoster@redhat.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..1489bce07d66 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)
> +
> +/* Operate on 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 ba9a99b7860f..11ccfc5611bf 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -952,6 +952,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:
> + 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-07-03 16:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-26 20:45 [PATCH v6 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-06-26 20:45 ` [PATCH 1/9] xfs: remove various bulk request typedef usage Darrick J. Wong
2019-07-03 13:22 ` Brian Foster
2019-06-26 20:45 ` [PATCH 2/9] xfs: rename bulkstat functions Darrick J. Wong
2019-07-03 13:22 ` Brian Foster
2019-06-26 20:45 ` [PATCH 3/9] xfs: introduce new v5 bulkstat structure Darrick J. Wong
2019-07-03 13:23 ` Brian Foster
2019-07-03 14:42 ` Darrick J. Wong
2019-07-03 15:32 ` [PATCH v2 " Darrick J. Wong
2019-07-03 16:31 ` Brian Foster
2019-06-26 20:45 ` [PATCH 4/9] xfs: introduce v5 inode group structure Darrick J. Wong
2019-07-03 13:23 ` Brian Foster
2019-06-26 20:46 ` [PATCH 5/9] xfs: wire up new v5 bulkstat ioctls Darrick J. Wong
2019-07-03 13:24 ` Brian Foster
2019-06-26 20:46 ` [PATCH 6/9] xfs: wire up the new v5 bulkstat_single ioctl Darrick J. Wong
2019-07-03 13:24 ` Brian Foster
2019-07-03 14:52 ` Darrick J. Wong
2019-07-03 16:11 ` Brian Foster
2019-07-03 20:01 ` Darrick J. Wong
2019-07-05 11:05 ` Brian Foster
2019-07-05 16:26 ` Darrick J. Wong
2019-06-26 20:46 ` [PATCH 7/9] xfs: wire up the v5 INUMBERS ioctl Darrick J. Wong
2019-07-03 13:24 ` Brian Foster
2019-06-26 20:46 ` [PATCH 8/9] xfs: specify AG in bulk req Darrick J. Wong
2019-07-03 13:25 ` Brian Foster
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
2019-07-03 15:34 ` [PATCH v2 " Darrick J. Wong
2019-07-03 16:32 ` Brian Foster [this message]
2019-07-04 6:51 ` [PATCH v3 " 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=20190703163205.GN26057@bfoster \
--to=bfoster@redhat.com \
--cc=allison.henderson@oracle.com \
--cc=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;
as well as URLs for NNTP newsgroup(s).