From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> --- tests/generic/204 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/generic/204 b/tests/generic/204 index 4c203a2..71bee83 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 naïvely 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 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html