ext4/307: Calculate donor size to avoid failures for 64k bs
Calculating size of donor file based on du output causes the following
issue:
e4compact.c:68: do_defrag_range: Assertion `donor->length >= len' failed.
./common/rc: line 4616:
1583182 Aborted (core dumped)
The issue is that e4compat asserts that the stat.st_size of all files
combined shouldn't be more than that of the donor file. In case of 64k
blocksize, fsstress often creates sparse files which have >3G size even
though their disk utilization is <100M. Since donor file is not big
enough, this trips e4compat causing the failure.
Fix this by using stat.st_size rather than du value to get the size.
Also, make some changes to avoid future ENOSPC like reducing the -n
passed to fsstress to keep the size around 2G and making sure we use the
whole SCRATCH disk instead of 500M.
While we are at it, add some new lines to make the code bit more
readable.
Reported-by: Disha Goel <disgoel@linux.ibm.com>
Tested-by: Disha Goel <disgoel@linux.ibm.com>
Signed-off-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>