summaryrefslogtreecommitdiff
path: root/ltp
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2020-03-06 12:35:17 +0000
committerEryu Guan <guaneryu@gmail.com>2020-03-08 23:47:19 +0800
commit075c5fde2bca82e72083242ca99439d241b09d59 (patch)
tree25e4bcc43e84329204bff5fd9571d43568608bfd /ltp
parentf10e08998747a80e5c85c154b9b464275981b5ff (diff)
fsx: fix bug where zero range operations never use the keep size flag
We are never using the FALLOC_FL_KEEP_SIZE flag for zero range operations even when we intend to use it. So fix it by setting that flag for the call to fallocate(2) if the 'keep_size' parameter is true. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'ltp')
-rw-r--r--ltp/fsx.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 02403720..9d598a4f 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1200,6 +1200,9 @@ do_zero_range(unsigned offset, unsigned length, int keep_size)
unsigned end_offset;
int mode = FALLOC_FL_ZERO_RANGE;
+ if (keep_size)
+ mode |= FALLOC_FL_KEEP_SIZE;
+
if (length == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero length zero range\n");