generic/587: fix rounding error in quota/stat block comparison
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 18 Mar 2020 20:11:36 +0000 (13:11 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 22 Mar 2020 15:18:38 +0000 (23:18 +0800)
commitb2faf2047019c6290a4373ae214738f4fbfbf2f1
tree7556504c1d6299d8c98c2ba4b0cd68db07f85634
parenta75b83544454810f6d30f057cdea5f0d961b1b31
generic/587: fix rounding error in quota/stat block comparison

It turns out that repquota (which reports in units of 1k blocks) reports
rounded up numbers when the fs blocksize is 512 bytes.  However, xfs_io
stat always reports block counts in units of 512 bytes.  If the number
of (512b) file blocks is not an even number, the "$3 / 2" expression
will round down, causing the test to fail.  Round up to the nearest 1k
to match repquota's behavior.

Reported-by: zlang@redhat.com
Fixes: 6b04ed05456fc6c ("generic: test unwritten extent conversion extent mapping quota accounting")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/587