diff mbox series

[4/9] various: replace _get_block_size with _get_file_block_size when needed

Message ID 160382531634.1202316.310897007206501013.stgit@magnolia
State Accepted
Headers show
Series xfstests: random fixes | expand

Commit Message

Darrick J. Wong Oct. 27, 2020, 7:01 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The _get_file_block_size helper was added so that tests could find out
the size of a fundamental unit of allocation for a given file, which is
necessary for certain fallocate and clonerange tests.

On certain filesystem configurations (ocfs2 with clusters, xfs with a
large rt extent size), this is /not/ the same as the filesystem block
size, and these tests will fail.  Fix them to use the correct helper.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/328 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Oct. 28, 2020, 7:42 a.m. UTC | #1
On Tue, Oct 27, 2020 at 12:01:56PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The _get_file_block_size helper was added so that tests could find out
> the size of a fundamental unit of allocation for a given file, which is
> necessary for certain fallocate and clonerange tests.
> 
> On certain filesystem configurations (ocfs2 with clusters, xfs with a
> large rt extent size), this is /not/ the same as the filesystem block
> size, and these tests will fail.  Fix them to use the correct helper.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/tests/xfs/328 b/tests/xfs/328
index 9b17b6a4..26325b40 100755
--- a/tests/xfs/328
+++ b/tests/xfs/328
@@ -48,7 +48,7 @@  mkdir "$testdir"
 # 2^10 blocks... that should be plenty for anyone.
 fnr=$((12 + LOAD_FACTOR))
 free_blocks=$(stat -f -c '%a' "$testdir")
-blksz=$(_get_block_size $testdir)
+blksz=$(_get_file_block_size $testdir)
 space_avail=$((free_blocks * blksz))
 calc_space()
 {