diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-11-06 17:54:11 -0800 |
---|---|---|
committer | Eryu Guan <eguan@redhat.com> | 2017-11-10 12:33:58 +0800 |
commit | 1e24e5173efa09c9f2dea17ffd7d344f48f77fc9 (patch) | |
tree | db485aefc5750549c077c5552b57f6561c861799 | |
parent | a9df2f23dfc88e453932fd4af439a9e70c8cda56 (diff) | |
download | xfstests-1e24e5173efa09c9f2dea17ffd7d344f48f77fc9.tar.gz |
generic/204: use available blocks to determine the number of files to create
Use the available block count to compute the number of files we think
we can create, rather than hardcoding a particular size. This fixes
the ENOSPC failures for xfs filesystems with rmap/reflink support.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
-rwxr-xr-x | tests/generic/204 | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/generic/204 b/tests/generic/204 index ebc9c0fa00..1eed8becef 100755 --- a/tests/generic/204 +++ b/tests/generic/204 @@ -69,7 +69,7 @@ _scratch_mount # work out correctly. Space usages is based 22500 files and 1024 reserved blocks # on a 4k block size 256 byte inode size filesystem. resv_blks=1024 -space=97920000 +space=$(stat -f -c '%f * %S' $SCRATCH_MNT | $BC_PROG) # decrease files for inode size. # 22500 * (256 + 4k) = ~97MB @@ -78,10 +78,20 @@ space=97920000 files=$((space / (isize + dbsize))) +# Now do it again, but factor in the filename sizes too. +# We naively assume 8 bytes for inode number, 1 byte for ftype, +# and 1 more byte for namelen, then round up to the nearest 8 +# bytes. + +namelen="$(echo -n "$files" | wc -c)" +direntlen="$(echo "(10 + $namelen + 7) / 8 * 8" | $BC_PROG)" + +files=$((space / (direntlen + isize + dbsize))) + echo files $files, resvblks $resv_blks >> $seqres.full _scratch_resvblks $resv_blks >> $seqres.full 2>&1 -for i in `seq 1 $files`; do +for i in `seq -w 1 $files`; do echo -n > $SCRATCH_MNT/$i echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i done |