From: "Darrick J. Wong" <djwong@kernel.org>
To: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org,
hsiangkao@linux.alibaba.com, allison.henderson@oracle.com
Subject: Re: [PATCH V3 1/2] common/xfs: Add a helper to export inode core size
Date: Tue, 6 Dec 2022 09:18:34 -0800 [thread overview]
Message-ID: <Y495anewPlIsLf11@magnolia> (raw)
In-Reply-To: <20221206100517.1369625-2-ZiyangZhang@linux.alibaba.com>
On Tue, Dec 06, 2022 at 06:05:16PM +0800, Ziyang Zhang wrote:
> Some xfs test cases need the number of bytes reserved for only the inode
> record, excluding the immediate fork areas. Now the value is hard-coded
> and it is not a good chioce. Add a helper in common/xfs to export the
> inode core size.
>
> Signed-off-by: Ziyang Zhang <ZiyangZhang@linux.alibaba.com>
Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> common/xfs | 7 +++++++
> tests/xfs/335 | 3 ++-
> tests/xfs/336 | 3 ++-
> tests/xfs/337 | 3 ++-
> tests/xfs/341 | 3 ++-
> tests/xfs/342 | 3 ++-
> 6 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/common/xfs b/common/xfs
> index 8ac1964e..5180b9d3 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -1486,3 +1486,10 @@ _require_xfsrestore_xflag()
> $XFSRESTORE_PROG -h 2>&1 | grep -q -e '-x' || \
> _notrun 'xfsrestore does not support -x flag.'
> }
> +
> +# Number of bytes reserved for only the inode record, excluding the
> +# immediate fork areas.
> +_xfs_inode_core_bytes()
> +{
> + echo 176
> +}
> diff --git a/tests/xfs/335 b/tests/xfs/335
> index ccc508e7..624a8fd1 100755
> --- a/tests/xfs/335
> +++ b/tests/xfs/335
> @@ -31,7 +31,8 @@ blksz="$(_get_block_size $SCRATCH_MNT)"
> echo "Create a three-level rtrmapbt"
> # inode core size is at least 176 bytes; btree header is 56 bytes;
> # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
> -i_ptrs=$(( (isize - 176) / 56 ))
> +i_core_size="$(_xfs_inode_core_bytes)"
> +i_ptrs=$(( (isize - i_core_size) / 56 ))
> bt_ptrs=$(( (blksz - 56) / 56 ))
> bt_recs=$(( (blksz - 56) / 32 ))
>
> diff --git a/tests/xfs/336 b/tests/xfs/336
> index b1de8e5f..e601632d 100755
> --- a/tests/xfs/336
> +++ b/tests/xfs/336
> @@ -42,7 +42,8 @@ rm -rf $metadump_file
> echo "Create a three-level rtrmapbt"
> # inode core size is at least 176 bytes; btree header is 56 bytes;
> # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
> -i_ptrs=$(( (isize - 176) / 56 ))
> +i_core_size="$(_xfs_inode_core_bytes)"
> +i_ptrs=$(( (isize - i_core_size) / 56 ))
> bt_ptrs=$(( (blksz - 56) / 56 ))
> bt_recs=$(( (blksz - 56) / 32 ))
>
> diff --git a/tests/xfs/337 b/tests/xfs/337
> index a2515e36..5d5ec8dc 100755
> --- a/tests/xfs/337
> +++ b/tests/xfs/337
> @@ -33,7 +33,8 @@ blksz="$(_get_block_size $SCRATCH_MNT)"
>
> # inode core size is at least 176 bytes; btree header is 56 bytes;
> # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
> -i_ptrs=$(( (isize - 176) / 56 ))
> +i_core_size="$(_xfs_inode_core_bytes)"
> +i_ptrs=$(( (isize - i_core_size) / 56 ))
> bt_ptrs=$(( (blksz - 56) / 56 ))
> bt_recs=$(( (blksz - 56) / 32 ))
>
> diff --git a/tests/xfs/341 b/tests/xfs/341
> index f026aa37..45afd407 100755
> --- a/tests/xfs/341
> +++ b/tests/xfs/341
> @@ -33,7 +33,8 @@ rtextsz_blks=$((rtextsz / blksz))
>
> # inode core size is at least 176 bytes; btree header is 56 bytes;
> # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
> -i_ptrs=$(( (isize - 176) / 56 ))
> +i_core_size="$(_xfs_inode_core_bytes)"
> +i_ptrs=$(( (isize - i_core_size) / 56 ))
> bt_recs=$(( (blksz - 56) / 32 ))
>
> blocks=$((i_ptrs * bt_recs + 1))
> diff --git a/tests/xfs/342 b/tests/xfs/342
> index 1ae414eb..d4f54168 100755
> --- a/tests/xfs/342
> +++ b/tests/xfs/342
> @@ -30,7 +30,8 @@ blksz="$(_get_block_size $SCRATCH_MNT)"
>
> # inode core size is at least 176 bytes; btree header is 56 bytes;
> # rtrmap record is 32 bytes; and rtrmap key/pointer are 56 bytes.
> -i_ptrs=$(( (isize - 176) / 56 ))
> +i_core_size="$(_xfs_inode_core_bytes)"
> +i_ptrs=$(( (isize - i_core_size) / 56 ))
> bt_recs=$(( (blksz - 56) / 32 ))
>
> blocks=$((i_ptrs * bt_recs + 1))
> --
> 2.18.4
>
next prev parent reply other threads:[~2022-12-06 17:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 10:05 [PATCH V3 0/2] cleanup and bugfix for xfs tests related to btree format Ziyang Zhang
2022-12-06 10:05 ` [PATCH V3 1/2] common/xfs: Add a helper to export inode core size Ziyang Zhang
2022-12-06 17:18 ` Darrick J. Wong [this message]
2022-12-06 23:37 ` Allison Henderson
2022-12-06 10:05 ` [PATCH V3 2/2] common/populate: Ensure that S_IFDIR.FMT_BTREE is in btree format Ziyang Zhang
2022-12-06 17:29 ` Darrick J. Wong
2022-12-07 18:02 ` Zorro Lang
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=Y495anewPlIsLf11@magnolia \
--to=djwong@kernel.org \
--cc=ZiyangZhang@linux.alibaba.com \
--cc=allison.henderson@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=hsiangkao@linux.alibaba.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