int debug = 0; /* -d flag */
unsigned long debugstart = 0; /* -D flag */
int flush = 0; /* -f flag */
+int holebdy = 1; /* -h flag */
int do_fsync = 0; /* -y flag */
unsigned long maxfilelen = 256 * 1024; /* -l flag */
int sizechecks = 1; /* -n flag disables them */
int max_len = 0;
int ret;
+ offset -= offset % holebdy;
+ length -= length % holebdy;
if (length == 0) {
if (!quiet && testcalls > simulatedopcount)
prt("skipping zero length punch hole\n");
usage(void)
{
fprintf(stdout, "usage: %s",
- "fsx [-dfnqxyACFHLORWZ] [-b opnum] [-c Prob] [-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] pname iname\n\
+ "fsx [-dfnqxyACFHLORWZ] [-b opnum] [-c Prob] [-h holebdy] [-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] pname iname\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\
-f: flush and invalidate cache after I/O\n\
+ -h holebdy: 4096 would make discards page aligned (default 1)\n\
-l flen: the upper bound on file size (default 262144)\n\
-m startop:endop: monitor (print debug output) specified byte range (default 0:infinity)\n\
-n: no verifications of file size\n\
setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
- while ((ch = getopt(argc, argv, "b:c:dfl:m:no:p:qr:s:t:w:xyACD:FHLN:OP:RS:WZ"))
+ while ((ch = getopt(argc, argv, "b:c:dfh:l:m:no:p:qr:s:t:w:xyACD:FHLN:OP:RS:WZ"))
!= EOF)
switch (ch) {
case 'b':
case 'f':
flush = 1;
break;
+ case 'h':
+ holebdy = getnum(optarg, &endp);
+ if (holebdy <= 0)
+ usage();
+ break;
case 'l':
maxfilelen = getnum(optarg, &endp);
if (maxfilelen <= 0)