@@ -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)
@@ -2215,7 +2215,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\
@@ -2265,6 +2265,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\
1) Add FALLOC_FL_KEEP_SIZE flag for do_zero_range(). 2) Add '-K' option to the usage of fsx. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> --- ltp/fsx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)