1) Add FALLOC_FL_KEEP_SIZE flag for do_zero_range(). 2) Add missing '-K' option to the usage of fsx. Signed-off-by: Xiao Yang <yangx.jy@xxxxxxxxxxxxxx> --- ltp/fsx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ltp/fsx.c b/ltp/fsx.c index 00001117..997d3f37 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -1197,7 +1197,7 @@ void do_zero_range(unsigned offset, unsigned length, int keep_size) { unsigned end_offset; - int mode = FALLOC_FL_ZERO_RANGE; + int mode = keep_size ? FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE : FALLOC_FL_ZERO_RANGE; if (length == 0) { if (!quiet && testcalls > simulatedopcount) @@ -2223,7 +2223,7 @@ void usage(void) { fprintf(stdout, "usage: %s", - "fsx [-dknqxABEFJLOWZ] [-b opnum] [-c Prob] [-g filldata] [-i logdev] [-j logid] [-l flen] [-m start:end] [-o oplen] [-p progressinterval] [-r readbdy] [-s style] [-t truncbdy] [-w writebdy] [-D startingop] [-N numops] [-P dirpath] [-S seed] fname\n\ + "fsx [-dknqxABEFJKLOWZ] [-b opnum] [-c Prob] [-g filldata] [-i logdev] [-j logid] [-l flen] [-m start:end] [-o oplen] [-p progressinterval] [-r readbdy] [-s style] [-t truncbdy] [-w writebdy] [-D startingop] [-N numops] [-P dirpath] [-S seed] fname\n\ -b opnum: beginning operation number (default 1)\n\ -c P: 1 in P chance of file close+open at each op (default infinity)\n\ -d: debug output for all operations\n\ @@ -2273,6 +2273,9 @@ usage(void) #ifdef HAVE_COPY_FILE_RANGE " -E: Do not use copy range calls\n" #endif +#ifdef FALLOC_FL_KEEP_SIZE +" -K: Do not use keep size calls\n" +#endif " -L: fsxLite - no file creations & no file size changes\n\ -N numops: total # operations to do (default infinity)\n\ -O: use oplen (see -o flag) for every op (default random)\n\ -- 2.21.0