2 * Copyright (C) 1991, NeXT Computer, Inc. All Rights Reserverd.
5 * Author: Avadis Tevanian, Jr.
7 * File system exerciser.
9 * Rewritten 8/98 by Conrad Minshall.
11 * Small changes to work under Linux -- davej.
14 #include <sys/types.h>
16 #include <sys/param.h>
35 #include <xfs/libxfs.h>
42 #define NUMPRINTCOLUMNS 32 /* # columns of data to print on each line */
45 * A log entry is an operation and a bunch of arguments.
55 struct log_entry oplog[LOGSIZE]; /* the log */
56 int logptr = 0; /* current position in log */
57 int logcount = 0; /* total ops */
66 #define OP_CLOSEOPEN 4
72 #define PAGE_SIZE getpagesize()
74 #define PAGE_MASK (PAGE_SIZE - 1)
76 char *original_buf; /* a pointer to the original data */
77 char *good_buf; /* a pointer to the correct data */
78 char *temp_buf; /* a pointer to the current data */
79 char *fname; /* name of our test file */
80 int fd; /* fd for our test file */
85 unsigned long testcalls = 0; /* calls to function "test" */
87 unsigned long simulatedopcount = 0; /* -b flag */
88 int closeprob = 0; /* -c flag */
89 int debug = 0; /* -d flag */
90 unsigned long debugstart = 0; /* -D flag */
91 int do_fsync = 0; /* -f flag */
92 unsigned long maxfilelen = 256 * 1024; /* -l flag */
93 int sizechecks = 1; /* -n flag disables them */
94 int maxoplen = 64 * 1024; /* -o flag */
95 int quiet = 0; /* -q flag */
96 unsigned long progressinterval = 0; /* -p flag */
97 int readbdy = 1; /* -r flag */
98 int style = 0; /* -s flag */
99 int prealloc = 0; /* -x flag */
100 int truncbdy = 1; /* -t flag */
101 int writebdy = 1; /* -w flag */
102 long monitorstart = -1; /* -m flag */
103 long monitorend = -1; /* -m flag */
104 int lite = 0; /* -L flag */
105 long numops = -1; /* -N flag */
106 int randomoplen = 1; /* -O flag disables it */
107 int seed = 1; /* -S flag */
108 int mapped_writes = 1; /* -W flag disables */
109 int mapped_reads = 1; /* -R flag disables it */
111 int o_direct; /* -Z */
115 int aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset);
118 #define fsxread(a,b,c,d) aio_rw(READ, a,b,c,d)
119 #define fsxwrite(a,b,c,d) aio_rw(WRITE, a,b,c,d)
121 #define fsxread(a,b,c,d) read(a,b,c)
122 #define fsxwrite(a,b,c,d) write(a,b,c)
125 FILE * fsxlogf = NULL;
129 static void *round_up(void *ptr, unsigned long align, unsigned long offset)
131 unsigned long ret = (unsigned long)ptr;
133 ret = ((ret + align - 1) & ~(align - 1));
144 vfprintf(stdout, fmt, args);
146 vfprintf(fsxlogf, fmt, args);
153 prt("%s%s%s\n", prefix, prefix ? ": " : "", strerror(errno));
158 log4(int operation, int arg0, int arg1, int arg2)
160 struct log_entry *le;
163 le->operation = operation;
165 le->operation = ~ le->operation;
171 if (logptr >= LOGSIZE)
180 struct log_entry *lp;
182 prt("LOG DUMP (%d total operations):\n", logcount);
183 if (logcount < LOGSIZE) {
190 for ( ; count > 0; count--) {
193 opnum = i+1 + (logcount/LOGSIZE)*LOGSIZE;
194 prt("%d(%d mod 256): ", opnum, opnum%256);
196 if ((closeopen = lp->operation < 0))
197 lp->operation = ~ lp->operation;
199 switch (lp->operation) {
201 prt("MAPREAD\t0x%x thru 0x%x\t(0x%x bytes)",
202 lp->args[0], lp->args[0] + lp->args[1] - 1,
204 if (badoff >= lp->args[0] && badoff <
205 lp->args[0] + lp->args[1])
209 prt("MAPWRITE 0x%x thru 0x%x\t(0x%x bytes)",
210 lp->args[0], lp->args[0] + lp->args[1] - 1,
212 if (badoff >= lp->args[0] && badoff <
213 lp->args[0] + lp->args[1])
217 prt("READ\t0x%x thru 0x%x\t(0x%x bytes)",
218 lp->args[0], lp->args[0] + lp->args[1] - 1,
220 if (badoff >= lp->args[0] &&
221 badoff < lp->args[0] + lp->args[1])
225 prt("WRITE\t0x%x thru 0x%x\t(0x%x bytes)",
226 lp->args[0], lp->args[0] + lp->args[1] - 1,
228 if (lp->args[0] > lp->args[2])
230 else if (lp->args[0] + lp->args[1] > lp->args[2])
232 if ((badoff >= lp->args[0] || badoff >=lp->args[2]) &&
233 badoff < lp->args[0] + lp->args[1])
237 down = lp->args[0] < lp->args[1];
238 prt("TRUNCATE %s\tfrom 0x%x to 0x%x",
239 down ? "DOWN" : "UP", lp->args[1], lp->args[0]);
240 if (badoff >= lp->args[!down] &&
241 badoff < lp->args[!!down])
245 prt("SKIPPED (no operation)");
248 prt("BOGUS LOG ENTRY (operation code = %d)!",
252 prt("\n\t\tCLOSE/OPEN");
262 save_buffer(char *buffer, off_t bufferlength, int fd)
265 ssize_t byteswritten;
267 if (fd <= 0 || bufferlength == 0)
270 if (bufferlength > SSIZE_MAX) {
271 prt("fsx flaw: overflow in save_buffer\n");
275 off_t size_by_seek = lseek(fd, (off_t)0, L_XTND);
276 if (size_by_seek == (off_t)-1)
277 prterr("save_buffer: lseek eof");
278 else if (bufferlength > size_by_seek) {
279 warn("save_buffer: .fsxgood file too short... will save 0x%qx bytes instead of 0x%qx\n", (unsigned long long)size_by_seek,
280 (unsigned long long)bufferlength);
281 bufferlength = size_by_seek;
285 ret = lseek(fd, (off_t)0, SEEK_SET);
286 if (ret == (off_t)-1)
287 prterr("save_buffer: lseek 0");
289 byteswritten = write(fd, buffer, (size_t)bufferlength);
290 if (byteswritten != bufferlength) {
291 if (byteswritten == -1)
292 prterr("save_buffer write");
294 warn("save_buffer: short write, 0x%x bytes instead of 0x%qx\n",
295 (unsigned)byteswritten,
296 (unsigned long long)bufferlength);
302 report_failure(int status)
308 save_buffer(good_buf, file_size, fsxgoodfd);
309 prt("Correct content saved for comparison\n");
310 prt("(maybe hexdump \"%s\" vs \"%s.fsxgood\")\n",
319 #define short_at(cp) ((unsigned short)((*((unsigned char *)(cp)) << 8) | \
320 *(((unsigned char *)(cp)) + 1)))
323 check_buffers(unsigned offset, unsigned size)
331 if (bcmp(good_buf + offset, temp_buf, size) != 0) {
332 prt("READ BAD DATA: offset = 0x%x, size = 0x%x, fname = %s\n",
333 offset, size, fname);
334 prt("OFFSET\tGOOD\tBAD\tRANGE\n");
336 c = good_buf[offset];
340 bad = short_at(&temp_buf[i]);
341 prt("0x%5x\t0x%04x\t0x%04x", offset,
342 short_at(&good_buf[offset]), bad);
343 op = temp_buf[offset & 1 ? i+1 : i];
346 prt("operation# (mod 256) for "
347 "the bad data may be %u\n",
348 ((unsigned)op & 0xff));
350 prt("operation# (mod 256) for "
351 "the bad data unknown, check"
352 " HOLE and EXTEND ops\n");
372 if (fstat(fd, &statbuf)) {
373 prterr("check_size: fstat");
374 statbuf.st_size = -1;
376 size_by_seek = lseek(fd, (off_t)0, L_XTND);
377 if (file_size != statbuf.st_size || file_size != size_by_seek) {
378 prt("Size error: expected 0x%qx stat 0x%qx seek 0x%qx\n",
379 (unsigned long long)file_size,
380 (unsigned long long)statbuf.st_size,
381 (unsigned long long)size_by_seek);
388 check_trunc_hack(void)
392 ftruncate(fd, (off_t)0);
393 ftruncate(fd, (off_t)100000);
395 if (statbuf.st_size != (off_t)100000) {
396 prt("no extend on truncate! not posix!\n");
404 doread(unsigned offset, unsigned size)
409 offset -= offset % readbdy;
411 size -= size % readbdy;
413 if (!quiet && testcalls > simulatedopcount && !o_direct)
414 prt("skipping zero size read\n");
415 log4(OP_SKIPPED, OP_READ, offset, size);
418 if (size + offset > file_size) {
419 if (!quiet && testcalls > simulatedopcount)
420 prt("skipping seek/read past end of file\n");
421 log4(OP_SKIPPED, OP_READ, offset, size);
425 log4(OP_READ, offset, size, 0);
427 if (testcalls <= simulatedopcount)
431 ((progressinterval && testcalls % progressinterval == 0) ||
433 (monitorstart == -1 ||
434 (offset + size > monitorstart &&
435 (monitorend == -1 || offset <= monitorend))))))
436 prt("%lu read\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
437 offset, offset + size - 1, size);
438 ret = lseek(fd, (off_t)offset, SEEK_SET);
439 if (ret == (off_t)-1) {
440 prterr("doread: lseek");
443 iret = fsxread(fd, temp_buf, size, offset);
446 prterr("doread: read");
448 prt("short read: 0x%x bytes instead of 0x%x\n",
452 check_buffers(offset, size);
457 domapread(unsigned offset, unsigned size)
463 offset -= offset % readbdy;
465 if (!quiet && testcalls > simulatedopcount)
466 prt("skipping zero size read\n");
467 log4(OP_SKIPPED, OP_MAPREAD, offset, size);
470 if (size + offset > file_size) {
471 if (!quiet && testcalls > simulatedopcount)
472 prt("skipping seek/read past end of file\n");
473 log4(OP_SKIPPED, OP_MAPREAD, offset, size);
477 log4(OP_MAPREAD, offset, size, 0);
479 if (testcalls <= simulatedopcount)
483 ((progressinterval && testcalls % progressinterval == 0) ||
485 (monitorstart == -1 ||
486 (offset + size > monitorstart &&
487 (monitorend == -1 || offset <= monitorend))))))
488 prt("%lu mapread\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
489 offset, offset + size - 1, size);
491 pg_offset = offset & PAGE_MASK;
492 map_size = pg_offset + size;
494 if ((p = (char *)mmap(0, map_size, PROT_READ, MAP_SHARED, fd,
495 (off_t)(offset - pg_offset))) == (char *)-1) {
496 prterr("domapread: mmap");
499 memcpy(temp_buf, p + pg_offset, size);
500 if (munmap(p, map_size) != 0) {
501 prterr("domapread: munmap");
505 check_buffers(offset, size);
510 gendata(char *original_buf, char *good_buf, unsigned offset, unsigned size)
513 good_buf[offset] = testcalls % 256;
515 good_buf[offset] += original_buf[offset];
522 dowrite(unsigned offset, unsigned size)
527 offset -= offset % writebdy;
529 size -= size % writebdy;
531 if (!quiet && testcalls > simulatedopcount && !o_direct)
532 prt("skipping zero size write\n");
533 log4(OP_SKIPPED, OP_WRITE, offset, size);
537 log4(OP_WRITE, offset, size, file_size);
539 gendata(original_buf, good_buf, offset, size);
540 if (file_size < offset + size) {
541 if (file_size < offset)
542 bzero(good_buf + file_size, offset - file_size);
543 file_size = offset + size;
545 warn("Lite file size bug in fsx!");
550 if (testcalls <= simulatedopcount)
554 ((progressinterval && testcalls % progressinterval == 0) ||
556 (monitorstart == -1 ||
557 (offset + size > monitorstart &&
558 (monitorend == -1 || offset <= monitorend))))))
559 prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
560 offset, offset + size - 1, size);
561 ret = lseek(fd, (off_t)offset, SEEK_SET);
562 if (ret == (off_t)-1) {
563 prterr("dowrite: lseek");
566 iret = fsxwrite(fd, good_buf + offset, size, offset);
569 prterr("dowrite: write");
571 prt("short write: 0x%x bytes instead of 0x%x\n",
577 prt("fsync() failed: %s\n", strerror(errno));
585 domapwrite(unsigned offset, unsigned size)
592 offset -= offset % writebdy;
594 if (!quiet && testcalls > simulatedopcount)
595 prt("skipping zero size write\n");
596 log4(OP_SKIPPED, OP_MAPWRITE, offset, size);
599 cur_filesize = file_size;
601 log4(OP_MAPWRITE, offset, size, 0);
603 gendata(original_buf, good_buf, offset, size);
604 if (file_size < offset + size) {
605 if (file_size < offset)
606 bzero(good_buf + file_size, offset - file_size);
607 file_size = offset + size;
609 warn("Lite file size bug in fsx!");
614 if (testcalls <= simulatedopcount)
618 ((progressinterval && testcalls % progressinterval == 0) ||
620 (monitorstart == -1 ||
621 (offset + size > monitorstart &&
622 (monitorend == -1 || offset <= monitorend))))))
623 prt("%lu mapwrite\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls,
624 offset, offset + size - 1, size);
626 if (file_size > cur_filesize) {
627 if (ftruncate(fd, file_size) == -1) {
628 prterr("domapwrite: ftruncate");
632 pg_offset = offset & PAGE_MASK;
633 map_size = pg_offset + size;
635 if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE,
636 MAP_FILE | MAP_SHARED, fd,
637 (off_t)(offset - pg_offset))) == (char *)-1) {
638 prterr("domapwrite: mmap");
641 memcpy(p + pg_offset, good_buf + offset, size);
642 if (msync(p, map_size, 0) != 0) {
643 prterr("domapwrite: msync");
646 if (munmap(p, map_size) != 0) {
647 prterr("domapwrite: munmap");
654 dotruncate(unsigned size)
656 int oldsize = file_size;
658 size -= size % truncbdy;
659 if (size > biggest) {
661 if (!quiet && testcalls > simulatedopcount)
662 prt("truncating to largest ever: 0x%x\n", size);
665 log4(OP_TRUNCATE, size, (unsigned)file_size, 0);
667 if (size > file_size)
668 bzero(good_buf + file_size, size - file_size);
671 if (testcalls <= simulatedopcount)
674 if ((progressinterval && testcalls % progressinterval == 0) ||
675 (debug && (monitorstart == -1 || monitorend == -1 ||
676 size <= monitorend)))
677 prt("%lu trunc\tfrom 0x%x to 0x%x\n", testcalls, oldsize, size);
678 if (ftruncate(fd, (off_t)size) == -1) {
679 prt("ftruncate1: %x\n", size);
680 prterr("dotruncate: ftruncate");
691 if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
692 prterr("writefileimage: lseek");
695 iret = write(fd, good_buf, file_size);
696 if ((off_t)iret != file_size) {
698 prterr("writefileimage: write");
700 prt("short write: 0x%x bytes instead of 0x%qx\n",
701 iret, (unsigned long long)file_size);
704 if (lite ? 0 : ftruncate(fd, file_size) == -1) {
705 prt("ftruncate2: %qx\n", (unsigned long long)file_size);
706 prterr("writefileimage: ftruncate");
715 if (testcalls <= simulatedopcount)
719 prt("%lu close/open\n", testcalls);
721 prterr("docloseopen: close");
724 fd = open(fname, O_RDWR|o_direct, 0);
726 prterr("docloseopen: open");
735 unsigned long offset;
736 unsigned long size = maxoplen;
737 unsigned long rv = random();
738 unsigned long op = rv % (3 + !lite + mapped_writes);
740 /* turn off the map read if necessary */
742 if (op == 2 && !mapped_reads)
745 if (simulatedopcount > 0 && testcalls == simulatedopcount)
751 closeopen = (rv >> 3) < (1 << 28) / closeprob;
753 if (debugstart > 0 && testcalls >= debugstart)
756 if (!quiet && testcalls < simulatedopcount && testcalls % 100000 == 0)
757 prt("%lu...\n", testcalls);
764 * MAPWRITE: op = 3 or 4
766 if (lite ? 0 : op == 3 && (style & 1) == 0) /* vanilla truncate? */
767 dotruncate(random() % maxfilelen);
770 size = random() % (maxoplen+1);
771 if (lite ? 0 : op == 3)
775 if (op == 1 || op == (lite ? 3 : 4)) {
776 offset %= maxfilelen;
777 if (offset + size > maxfilelen)
778 size = maxfilelen - offset;
780 domapwrite(offset, size);
782 dowrite(offset, size);
788 if (offset + size > file_size)
789 size = file_size - offset;
791 domapread(offset, size);
793 doread(offset, size);
797 if (sizechecks && testcalls > simulatedopcount)
809 prt("signal %d\n", sig);
810 prt("testcalls = %lu\n", testcalls);
818 fprintf(stdout, "usage: %s",
819 "fsx [-dnqxALOWZ] [-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] fname\n\
820 -b opnum: beginning operation number (default 1)\n\
821 -c P: 1 in P chance of file close+open at each op (default infinity)\n\
822 -d: debug output for all operations\n\
823 -l flen: the upper bound on file size (default 262144)\n\
824 -m startop:endop: monitor (print debug output) specified byte range (default 0:infinity)\n\
825 -n: no verifications of file size\n\
826 -o oplen: the upper bound on operation size (default 65536)\n\
827 -p progressinterval: debug output at specified operation interval\n\
828 -q: quieter operation\n\
829 -r readbdy: 4096 would make reads page aligned (default 1)\n\
830 -s style: 1 gives smaller truncates (default 0)\n\
831 -t truncbdy: 4096 would make truncates page aligned (default 1)\n\
832 -w writebdy: 4096 would make writes page aligned (default 1)\n\
833 -x: preallocate file space before starting, XFS only (default 0)\n\
834 -A: Use the AIO system calls\n\
835 -D startingop: debug output starting at specified operation\n\
836 -L: fsxLite - no file creations & no file size changes\n\
837 -N numops: total # operations to do (default infinity)\n\
838 -O: use oplen (see -o flag) for every op (default random)\n\
839 -P: save .fsxlog and .fsxgood files in dirpath (default ./)\n\
840 -S seed: for random # generator (default 1) 0 gets timestamp\n\
841 -W: mapped write operations DISabled\n\
842 -R: read() system calls only (mapped reads disabled)\n\
843 -Z: O_DIRECT (use -R, -W, -r and -w too)\n\
844 fname: this filename is REQUIRED (no default)\n");
850 getnum(char *s, char **e)
855 ret = strtol(s, e, 0);
891 ret = io_queue_init(QSZ, &io_ctx);
893 fprintf(stderr, "aio_setup: io_queue_init failed: %s\n",
901 __aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset)
903 struct io_event event;
904 static struct timespec ts;
905 struct iocb *iocbs[] = { &iocb };
909 io_prep_pread(&iocb, fd, buf, len, offset);
911 io_prep_pwrite(&iocb, fd, buf, len, offset);
916 ret = io_submit(io_ctx, 1, iocbs);
918 fprintf(stderr, "errcode=%d\n", ret);
919 fprintf(stderr, "aio_rw: io_submit failed: %s\n",
924 ret = io_getevents(io_ctx, 1, 1, &event, &ts);
926 fprintf(stderr, "errcode=%d\n", ret);
927 fprintf(stderr, "aio_rw: io_getevents failed: %s\n",
931 if (len != event.res) {
932 fprintf(stderr, "bad read length: %lu instead of %u\n",
938 int aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset)
943 ret = __aio_rw(rw, fd, buf, len, offset);
946 ret = read(fd, buf, len);
948 ret = write(fd, buf, len);
956 main(int argc, char **argv)
966 setvbuf(stdout, (char *)0, _IOLBF, 0); /* line buffered stdout */
968 while ((ch = getopt(argc, argv, "b:c:dl:m:no:p:qr:s:t:w:xAD:LN:OP:RS:WZ"))
972 simulatedopcount = getnum(optarg, &endp);
974 fprintf(stdout, "Will begin at operation %ld\n",
976 if (simulatedopcount == 0)
978 simulatedopcount -= 1;
981 closeprob = getnum(optarg, &endp);
984 "Chance of close/open is 1 in %d\n",
996 maxfilelen = getnum(optarg, &endp);
1001 monitorstart = getnum(optarg, &endp);
1002 if (monitorstart < 0)
1004 if (!endp || *endp++ != ':')
1006 monitorend = getnum(endp, &endp);
1009 if (monitorend == 0)
1010 monitorend = -1; /* aka infinity */
1016 maxoplen = getnum(optarg, &endp);
1021 progressinterval = getnum(optarg, &endp);
1022 if (progressinterval < 0)
1029 readbdy = getnum(optarg, &endp);
1034 style = getnum(optarg, &endp);
1035 if (style < 0 || style > 1)
1039 truncbdy = getnum(optarg, &endp);
1044 writebdy = getnum(optarg, &endp);
1055 debugstart = getnum(optarg, &endp);
1063 numops = getnum(optarg, &endp);
1071 strncpy(goodfile, optarg, sizeof(goodfile));
1072 strcat(goodfile, "/");
1073 strncpy(logfile, optarg, sizeof(logfile));
1074 strcat(logfile, "/");
1080 seed = getnum(optarg, &endp);
1082 seed = time(0) % 10000;
1084 fprintf(stdout, "Seed set to %d\n", seed);
1091 fprintf(stdout, "mapped writes DISABLED\n");
1094 o_direct = O_DIRECT;
1106 signal(SIGHUP, cleanup);
1107 signal(SIGINT, cleanup);
1108 signal(SIGPIPE, cleanup);
1109 signal(SIGALRM, cleanup);
1110 signal(SIGTERM, cleanup);
1111 signal(SIGXCPU, cleanup);
1112 signal(SIGXFSZ, cleanup);
1113 signal(SIGVTALRM, cleanup);
1114 signal(SIGUSR1, cleanup);
1115 signal(SIGUSR2, cleanup);
1117 initstate(seed, state, 256);
1120 O_RDWR|(lite ? 0 : O_CREAT|O_TRUNC)|o_direct, 0666);
1127 xfs_flock64_t resv = { 0 };
1129 if (!platform_test_xfs_fd(fd)) {
1131 fprintf(stderr, "main: cannot prealloc, non XFS\n");
1135 resv.l_len = maxfilelen;
1136 if ((xfsctl(fname, fd, XFS_IOC_RESVSP, &resv)) < 0) {
1142 strncat(goodfile, fname, 256);
1143 strcat (goodfile, ".fsxgood");
1144 fsxgoodfd = open(goodfile, O_RDWR|O_CREAT|O_TRUNC, 0666);
1145 if (fsxgoodfd < 0) {
1149 strncat(logfile, fname, 256);
1150 strcat (logfile, ".fsxlog");
1151 fsxlogf = fopen(logfile, "w");
1152 if (fsxlogf == NULL) {
1164 file_size = maxfilelen = lseek(fd, (off_t)0, L_XTND);
1165 if (file_size == (off_t)-1) {
1167 warn("main: lseek eof");
1170 ret = lseek(fd, (off_t)0, SEEK_SET);
1171 if (ret == (off_t)-1) {
1173 warn("main: lseek 0");
1177 original_buf = (char *) malloc(maxfilelen);
1178 for (i = 0; i < maxfilelen; i++)
1179 original_buf[i] = random() % 256;
1180 good_buf = (char *) malloc(maxfilelen + writebdy);
1181 good_buf = round_up(good_buf, writebdy, 0);
1182 bzero(good_buf, maxfilelen);
1183 temp_buf = (char *) malloc(maxoplen + readbdy);
1184 temp_buf = round_up(temp_buf, readbdy, 0);
1185 bzero(temp_buf, maxoplen);
1186 if (lite) { /* zero entire existing file */
1189 written = write(fd, good_buf, (size_t)maxfilelen);
1190 if (written != maxfilelen) {
1191 if (written == -1) {
1193 warn("main: error on write");
1195 warn("main: short write, 0x%x bytes instead "
1204 while (numops == -1 || numops--)
1211 prt("All operations completed A-OK!\n");