[PATCH 1/2] generic/219: use filesystem blocksize while calculating the file size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



generic/219 was failing for XFS with 32k and 64k blocksize. Even though
we do only 48k IO, XFS will allocate blocks rounded to the nearest
blocksize.

Signed-off-by: Pankaj Raghav <p.raghav@xxxxxxxxxxx>
---
 tests/generic/219 | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/generic/219 b/tests/generic/219
index 940b902e..d72aa745 100755
--- a/tests/generic/219
+++ b/tests/generic/219
@@ -49,12 +49,24 @@ check_usage()
 	fi
 }
 
+_round_up_to_fs_blksz()
+{
+	local n=$1
+	local bs=$(_get_file_block_size "$SCRATCH_MNT")
+	local bs_kb=$(( bs >> 10 ))
+
+	echo $(( (n + bs_kb - 1) & ~(bs_kb - 1) ))
+}
+
 test_accounting()
 {
-	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
-	echo "--- initiating parallel IO..." >>$seqres.full
 	# Small ios here because ext3 will account for indirect blocks too ...
 	# 48k will fit w/o indirect for 4k blocks (default blocksize)
+	io_sz=$(_round_up_to_fs_blksz 48)
+	sz=$(( io_sz * 3 ))
+
+	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
+	echo "--- initiating parallel IO..." >>$seqres.full
 	$XFS_IO_PROG -c 'pwrite 0 48k' -c 'fsync' \
 					$SCRATCH_MNT/buffer >>$seqres.full 2>&1 &
 	$XFS_IO_PROG -c 'pwrite 0 48k' -d \
@@ -73,7 +85,7 @@ test_accounting()
 	else
 		id=$qa_group
 	fi
-	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage 144 3
+	repquota -$type $SCRATCH_MNT | grep "^$id" | check_usage $sz 3
 }
 
 
-- 
2.44.1





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux