fsx: fix bug where zero range operations never use the keep size flag
[xfstests-dev.git] / ltp / fsx.c
index 02403720ffd3119790700fd383a9693f7de4ff8a..9d598a4f27a0ea949dec901f9dc3f596e257608b 100644 (file)
--- 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");