From: "Darrick J. Wong" <djwong@kernel.org>
To: Chandan Babu R <chandan.babu@oracle.com>
Cc: linux-xfs@vger.kernel.org, david@fromorbit.com
Subject: Re: [PATCH V4 15/20] xfsprogs: Enable bulkstat ioctl to support 64-bit extent counters
Date: Tue, 4 Jan 2022 17:13:37 -0800 [thread overview]
Message-ID: <20220105011337.GC656707@magnolia> (raw)
In-Reply-To: <20211214084811.764481-16-chandan.babu@oracle.com>
On Tue, Dec 14, 2021 at 02:18:06PM +0530, Chandan Babu R wrote:
> This commit adds support to libfrog to enable reporting 64-bit extent counters
> to its users. In order to do so, bulkstat ioctl is now invoked with the newly
> introduced XFS_BULK_IREQ_NREXT64 flag if the underlying filesystem's geometry
> supports 64-bit extent counters.
>
> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
For all the non libxfs/ changes,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fsr/xfs_fsr.c | 4 ++--
> io/bulkstat.c | 1 +
> libfrog/bulkstat.c | 29 +++++++++++++++++++++++++++--
> libxfs/xfs_fs.h | 12 ++++++++----
> 4 files changed, 38 insertions(+), 8 deletions(-)
>
> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
> index 6cf8bfb7..ba02506d 100644
> --- a/fsr/xfs_fsr.c
> +++ b/fsr/xfs_fsr.c
> @@ -590,7 +590,7 @@ cmp(const void *s1, const void *s2)
> (bs1->bs_version == XFS_BULKSTAT_VERSION_V5 &&
> bs2->bs_version == XFS_BULKSTAT_VERSION_V5));
>
> - return (bs2->bs_extents - bs1->bs_extents);
> + return (bs2->bs_extents64 - bs1->bs_extents64);
> }
>
> /*
> @@ -655,7 +655,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
> for (p = buf, endp = (buf + buflenout); p < endp ; p++) {
> /* Do some obvious checks now */
> if (((p->bs_mode & S_IFMT) != S_IFREG) ||
> - (p->bs_extents < 2))
> + (p->bs_extents64 < 2))
> continue;
>
> ret = -xfrog_bulkstat_v5_to_v1(&fsxfd, &bs1, p);
> diff --git a/io/bulkstat.c b/io/bulkstat.c
> index 201470b2..0c9a2b02 100644
> --- a/io/bulkstat.c
> +++ b/io/bulkstat.c
> @@ -57,6 +57,7 @@ dump_bulkstat(
> printf("\tbs_sick = 0x%"PRIx16"\n", bstat->bs_sick);
> printf("\tbs_checked = 0x%"PRIx16"\n", bstat->bs_checked);
> printf("\tbs_mode = 0%"PRIo16"\n", bstat->bs_mode);
> + printf("\tbs_extents64 = %"PRIu64"\n", bstat->bs_extents64);
> };
>
> static void
> diff --git a/libfrog/bulkstat.c b/libfrog/bulkstat.c
> index 195f6ea0..0a90947f 100644
> --- a/libfrog/bulkstat.c
> +++ b/libfrog/bulkstat.c
> @@ -56,6 +56,9 @@ xfrog_bulkstat_single5(
> if (flags & ~(XFS_BULK_IREQ_SPECIAL))
> return -EINVAL;
>
> + if (xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64)
> + flags |= XFS_BULK_IREQ_NREXT64;
> +
> ret = xfrog_bulkstat_alloc_req(1, ino, &req);
> if (ret)
> return ret;
> @@ -73,6 +76,12 @@ xfrog_bulkstat_single5(
> }
>
> memcpy(bulkstat, req->bulkstat, sizeof(struct xfs_bulkstat));
> +
> + if (!(xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64)) {
> + bulkstat->bs_extents64 = bulkstat->bs_extents;
> + bulkstat->bs_extents = 0;
> + }
> +
> free:
> free(req);
> return ret;
> @@ -129,6 +138,7 @@ xfrog_bulkstat_single(
> switch (error) {
> case -EOPNOTSUPP:
> case -ENOTTY:
> + assert(!(xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64));
> xfd->flags |= XFROG_FLAG_BULKSTAT_FORCE_V1;
> break;
> }
> @@ -259,10 +269,23 @@ xfrog_bulkstat5(
> struct xfs_bulkstat_req *req)
> {
> int ret;
> + int i;
> +
> + if (xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64)
> + req->hdr.flags |= XFS_BULK_IREQ_NREXT64;
>
> ret = ioctl(xfd->fd, XFS_IOC_BULKSTAT, req);
> if (ret)
> return -errno;
> +
> + if (!(xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64)) {
> + for (i = 0; i < req->hdr.ocount; i++) {
> + req->bulkstat[i].bs_extents64 =
> + req->bulkstat[i].bs_extents;
> + req->bulkstat[i].bs_extents = 0;
> + }
> + }
> +
> return 0;
> }
>
> @@ -316,6 +339,7 @@ xfrog_bulkstat(
> switch (error) {
> case -EOPNOTSUPP:
> case -ENOTTY:
> + assert(!(xfd->fsgeom.flags & XFS_FSOP_GEOM_FLAGS_NREXT64));
> xfd->flags |= XFROG_FLAG_BULKSTAT_FORCE_V1;
> break;
> }
> @@ -342,6 +366,7 @@ xfrog_bulkstat_v5_to_v1(
> const struct xfs_bulkstat *bs5)
> {
> if (bs5->bs_aextents > UINT16_MAX ||
> + bs5->bs_extents64 > INT32_MAX ||
> cvt_off_fsb_to_b(xfd, bs5->bs_extsize_blks) > UINT32_MAX ||
> cvt_off_fsb_to_b(xfd, bs5->bs_cowextsize_blks) > UINT32_MAX ||
> time_too_big(bs5->bs_atime) ||
> @@ -366,7 +391,7 @@ xfrog_bulkstat_v5_to_v1(
> bs1->bs_blocks = bs5->bs_blocks;
> bs1->bs_xflags = bs5->bs_xflags;
> bs1->bs_extsize = cvt_off_fsb_to_b(xfd, bs5->bs_extsize_blks);
> - bs1->bs_extents = bs5->bs_extents;
> + bs1->bs_extents = bs5->bs_extents64;
> bs1->bs_gen = bs5->bs_gen;
> bs1->bs_projid_lo = bs5->bs_projectid & 0xFFFF;
> bs1->bs_forkoff = bs5->bs_forkoff;
> @@ -407,7 +432,6 @@ xfrog_bulkstat_v1_to_v5(
> bs5->bs_blocks = bs1->bs_blocks;
> bs5->bs_xflags = bs1->bs_xflags;
> bs5->bs_extsize_blks = cvt_b_to_off_fsbt(xfd, bs1->bs_extsize);
> - bs5->bs_extents = bs1->bs_extents;
> bs5->bs_gen = bs1->bs_gen;
> bs5->bs_projectid = bstat_get_projid(bs1);
> bs5->bs_forkoff = bs1->bs_forkoff;
> @@ -415,6 +439,7 @@ xfrog_bulkstat_v1_to_v5(
> bs5->bs_checked = bs1->bs_checked;
> bs5->bs_cowextsize_blks = cvt_b_to_off_fsbt(xfd, bs1->bs_cowextsize);
> bs5->bs_aextents = bs1->bs_aextents;
> + bs5->bs_extents64 = bs1->bs_extents;
> }
>
> /* Allocate a bulkstat request. Returns zero or a negative error code. */
> diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
> index 7260b140..6a9e51ac 100644
> --- a/libxfs/xfs_fs.h
> +++ b/libxfs/xfs_fs.h
> @@ -391,7 +391,7 @@ struct xfs_bulkstat {
> uint32_t bs_extsize_blks; /* extent size hint, blocks */
>
> uint32_t bs_nlink; /* number of links */
> - uint32_t bs_extents; /* number of extents */
> + uint32_t bs_extents; /* 32-bit data fork extent counter */
> uint32_t bs_aextents; /* attribute number of extents */
> uint16_t bs_version; /* structure version */
> uint16_t bs_forkoff; /* inode fork offset in bytes */
> @@ -400,8 +400,9 @@ struct xfs_bulkstat {
> uint16_t bs_checked; /* checked inode metadata */
> uint16_t bs_mode; /* type and mode */
> uint16_t bs_pad2; /* zeroed */
> + uint64_t bs_extents64; /* 64-bit data fork extent counter */
>
> - uint64_t bs_pad[7]; /* zeroed */
> + uint64_t bs_pad[6]; /* zeroed */
> };
>
> #define XFS_BULKSTAT_VERSION_V1 (1)
> @@ -482,8 +483,11 @@ struct xfs_bulk_ireq {
> */
> #define XFS_BULK_IREQ_SPECIAL (1 << 1)
>
> -#define XFS_BULK_IREQ_FLAGS_ALL (XFS_BULK_IREQ_AGNO | \
> - XFS_BULK_IREQ_SPECIAL)
> +#define XFS_BULK_IREQ_NREXT64 (1 << 3)
> +
> +#define XFS_BULK_IREQ_FLAGS_ALL (XFS_BULK_IREQ_AGNO | \
> + XFS_BULK_IREQ_SPECIAL | \
> + XFS_BULK_IREQ_NREXT64)
>
> /* Operate on the root directory inode. */
> #define XFS_BULK_IREQ_SPECIAL_ROOT (1)
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-01-05 1:13 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 8:47 [PATCH V4 00/20] xfsprogs: Extend per-inode extent counters Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 01/20] xfsprogs: xfs_repair: allow administrators to add older v5 features Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 02/20] xfsprogs: Move extent count limits to xfs_format.h Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 03/20] xfsprogs: Introduce xfs_iext_max_nextents() helper Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 04/20] xfsprogs: Use xfs_extnum_t instead of basic data types Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 05/20] xfsprogs: Introduce xfs_dfork_nextents() helper Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 06/20] xfsprogs: Use basic types to define xfs_log_dinode's di_nextents and di_anextents Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 07/20] xfsprogs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively Chandan Babu R
2021-12-14 8:47 ` [PATCH V4 08/20] xfsprogs: Introduce XFS_SB_FEAT_INCOMPAT_NREXT64 and associated per-fs feature bit Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 09/20] xfsprogs: Introduce XFS_FSOP_GEOM_FLAGS_NREXT64 Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 10/20] xfsprogs: Introduce XFS_DIFLAG2_NREXT64 and associated helpers Chandan Babu R
2022-01-05 1:08 ` Darrick J. Wong
2022-01-05 14:15 ` Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 11/20] xfsprogs: Use xfs_rfsblock_t to count maximum blocks that can be used by BMBT Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 12/20] xfsprogs: Introduce macros to represent new maximum extent counts for data/attr forks Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 13/20] xfsprogs: Introduce per-inode 64-bit extent counters Chandan Babu R
2022-01-05 1:12 ` Darrick J. Wong
2022-01-07 16:10 ` Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 14/20] xfsprogs: Conditionally upgrade existing inodes to use " Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 15/20] xfsprogs: Enable bulkstat ioctl to support " Chandan Babu R
2022-01-05 1:13 ` Darrick J. Wong [this message]
2021-12-14 8:48 ` [PATCH V4 16/20] xfsprogs: Add XFS_SB_FEAT_INCOMPAT_NREXT64 to the list of supported flags Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 17/20] xfsprogs: xfs_info: Report NREXT64 feature status Chandan Babu R
2022-01-05 1:13 ` Darrick J. Wong
2021-12-14 8:48 ` [PATCH V4 18/20] xfsprogs: Add mkfs option to create filesystem with large extent counters Chandan Babu R
2022-01-05 1:15 ` Darrick J. Wong
2021-12-14 8:48 ` [PATCH V4 19/20] xfsprogs: Add support for upgrading to NREXT64 feature Chandan Babu R
2022-01-05 1:17 ` Darrick J. Wong
2022-01-07 16:17 ` Chandan Babu R
2022-01-07 19:03 ` Darrick J. Wong
2022-01-08 16:16 ` Chandan Babu R
2022-01-08 18:28 ` Darrick J. Wong
2022-01-10 15:42 ` Chandan Babu R
2021-12-14 8:48 ` [PATCH V4 20/20] xfsprogs: Define max extent length based on on-disk format definition Chandan Babu R
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=20220105011337.GC656707@magnolia \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=david@fromorbit.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).