Lines Matching +full:generate +full:- +full:lockfile

21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
37 * To just verify file contents: growfiles -g 0 -c 1 filename
45 * return control to user (if wanted - default action)
47 * re-exec self (if wanted)
54 * fstat file - to determine if file if a fifo
163 int io_type = 0; /* I/O type -sync */
172 #define MAX_FC_READ 196608 /* 4096 * 48 - 48 blocks */
190 #define PATTERN_CNTING 6 /* counting pattern (i.e. 0 - 07, 0 - 07, ...) */
193 #define PATTERN_RANDOM 9 /* random integers - can not be checked */
207 int bytes_to_consume = 0; /* non-zero if -B was specified, total bytes */
212 /* The *_size variables are only used when random iosize option (-r) is used */
216 /* the *_lseek variables are only used when radon lseek option (-R) is used */
218 int max_lseek = -1; /* -1 means size of file */
224 int Seed = -1; /* random number seed, < 0 == uninitialized */
231 int lockfile = 0; /* if set, do file locking */ variable
256 * Define open flags that will be used when '-o random' option is used.
261 * --------------- -------------
265 * generate pattern
274 * file locks are not being used (-l option). Things could happen
296 * O_WELLFORMED makes -o random require well formed i/o
316 #define REXEC_INIT 0 /* don't do re-exec of childern */
317 #define REXEC_DOIT 1 /* Do re-exec of childern */
318 #define REXEC_DONE 2 /* We've already been re-exec'ed */
339 #define LSK_EOF -1 /* set fptr up to EOF */
340 #define LSK_EOFPLUSGROW -2 /* set fptr up to EOF + grow - leave whole */
341 #define LSK_EOFMINUSGROW -3 /* set fptr up to EOF-grow - no grow */
361 int unlink_inter_ran = -1; /* -1 -use unlink_inter, otherwise randomly choose */ in main()
380 long total_grow_value; /* used in pre-allocations */ in main()
384 int time_iterval = -1; in main()
399 if (argv[0][0] == '-') in main()
433 "%s%s: --B option arg invalid\n", in main()
442 "%s%s: --B option arg invalid\n", in main()
462 "%s%s: --c option arg invalid\n", in main()
472 "%s%s: --c option arg invalid\n", in main()
484 if (stat(auto_dir, &statbuf) == -1) { in main()
485 if (mkdir(auto_dir, 0777) == -1) { in main()
507 "%s%s: --D option arg invalid\n", in main()
517 "%s%s: --e option arg invalid\n", in main()
533 "%s%s: --g option arg invalid\n", in main()
543 "%s%s: --g option arg invalid\n", in main()
556 "%s%s: --H option arg invalid\n", in main()
568 "%s%s: --i option arg invalid\n", in main()
577 if ((io_type = lio_parse_io_arg1(optarg)) == -1) { in main()
579 "%s%s: --I arg is invalid, must be s, p, f, a, l, L or r.\n", in main()
586 if ((io_type = parse_io_arg(optarg)) == -1) { in main()
588 "%s%s: --I arg is invalid, must be s, p, f, a, l, L or r.\n", in main()
592 if (io_type == 99) /* hold-over until tlibio.h */ in main()
598 lockfile++; in main()
599 if (lockfile > 2) in main()
600 lockfile = 2; /* lockfile can only be 1 or 2 */ in main()
607 "%s%s: --L option arg invalid\n", in main()
619 "%s%s: --n option arg invalid\n", in main()
632 "%s%s: --N option arg invalid\n", in main()
644 "%s%s: --O option arg invalid\n", in main()
657 == -1) { in main()
659 "%s%s: --o arg contains invalid flag\n", in main()
667 printf("%s%s: --p is illegal option on linux system\n", in main()
678 fprintf(stderr, "%s%s: --P arg must be PANIC\n", in main()
686 ("%s%s: --P is illegal option on non-cray system\n", in main()
724 "%s%s: --C option arg invalid, A, a, p, o, c, C, r, z, or 0\n", in main()
731 case 'R': /* random lseek before write arg: [min-]max */ in main()
732 if (sscanf(optarg, "%i-%i", &min_lseek, &max_lseek) != in main()
738 "%s%s: --R option arg invalid: [min-]max\n", in main()
745 "%s%s: --R option, max_lseek is invalid\n", in main()
753 case 'r': /* random io size arg: [min-]max[:mult] */ in main()
755 /* min-max:mult format */ in main()
756 if (sscanf(optarg, "%i-%i:%i%c", &min_size, &max_size, in main()
762 /* min-max format */ in main()
763 if (sscanf(optarg, "%i-%i%c", &min_size, in main()
770 "%s%s: --r option arg invalid: [min-]max[:mult]\n", in main()
781 "%s%s: --r option, max_size is invalid\n", in main()
799 "%s%s: --S option arg invalid\n", in main()
828 "%s%s: --s option arg %s invalid\n", in main()
841 "%s%s: --s option arg %s invalid\n", in main()
858 "%s%s: --t option arg invalid\n", in main()
868 "%s%s: --t option arg invalid\n", in main()
881 "%s%s: --T option arg invalid\n", in main()
895 * A-B - randomly pick interval between A and B in main()
896 * X - unlink file every X iteration in main()
898 if (sscanf(optarg, "%i-%i", &unlink_inter, in main()
903 "%s%s: --U option arg invalid\n", in main()
920 "%s%s: --U option arg invalid\n", in main()
963 ("%s%s: %d Using random pattern - no data checking will be performed!\n", in main()
997 lio_set_debug(Debug - 3); in main()
999 set_iowrite_debug(Debug - 3); in main()
1016 ("%s: %d DEBUG3 %d<byteoffset>%d per word pattern multi-writers.\n", in main()
1020 ("%s: %d DEBUG3 <pid><byteoffset><pid> per word pattern - 1 writer\n", in main()
1024 ("%s: %d DEBUG3 ascii pattern (vi'able)- allows multiple writers\n", in main()
1028 ("%s: %d DEBUG3 alt bit pattern - allows multiple writers\n", in main()
1032 ("%s: %d DEBUG3 checkerboard pattern - allows multiple writers\n", in main()
1036 ("%s: %d DEBUG3 counting pattern - allows multiple writers\n", in main()
1040 ("%s: %d DEBUG3 random integer pattern - no write/file checking\n", in main()
1044 ("%s: %d DEBUG3 all ones pattern - allows multiple writers\n", in main()
1048 ("%s: %d DEBUG3 all zeros pattern - allows multiple writers\n", in main()
1059 Progname, Pid, Maxerrs, pre_alloc_space, lockfile); in main()
1095 ("%s: %d DEBUG3 random lseek: min=%d, max=<endoffile-iosize>\n", in main()
1115 if (unlink_inter_ran == -1) { in main()
1136 Opid, num_procs - 1); in main()
1177 * Generate a random seed based on time and pid. in main()
1205 ("%s: %d DEBUG3 Unlink interval is %d (random %d - %d)\n", in main()
1211 * re-exec all childern if reexec is set to REXEC_DOIT. in main()
1218 /* Get space for cmd (2 extra, 1 for - and 1 fro NULL */ in main()
1220 sprintf(argv[0], "-%s", exec_path); in main()
1243 num_files += argc - optind; in main()
1327 "%s%s: %d %s/%d: can NOT pre-alloc and grow forever\n", in main()
1333 "%s%s: %d %s/%d: can NOT pre-alloc and do random io size\n", in main()
1366 if (statfs(auto_dir, &fsbuf) == -1) { in main()
1425 sizeof(int) - 1, 1, NULL)]; in main()
1449 if ((fd = open(filename, ret, 0777)) == -1) { in main()
1451 "%s%s: %d %s/%d: open(%s, %#o, 0777) returned -1, errno:%d %s\n", in main()
1461 lkfile(fd, LOCK_EX, LKLVL1); /* lock if lockfile is LKLVL1 */ in main()
1682 "%s%s: %d %s/%d: received SIGUSR2 (%d) - stopping.\n", in sig_handler()
1811 "Usage: %s%s [-bhEluy][[-g grow_incr][-i num][-t trunc_incr][-T trunc_inter]\n", in usage()
1814 "[-d auto_dir][-e maxerrs][-f auto_file][-N num_files][-w][-c chk_inter][-D debug]\n"); in usage()
1816 "[-s seed][-S seq_auto_files][-p][-P PANIC][-I io_type][-o open_flags][-B maxbytes]\n"); in usage()
1818 "[-r iosizes][-R lseeks][-U unlk_inter][-W tagname] [files]\n"); in usage()
1832 -h Specfied to print this help and exit.\n\ in help()
1833 -b Specfied to execute in sync mode.(def async mode)\n\ in help()
1834 -B maxbytes Max bytes to consume by all files. growfiles exits when more\n\ in help()
1837 -C write_chk Specifies how often to check the last write (default 1)\n\ in help()
1838 -c file_chk Specifies how often to check whole file (default 0)\n\ in help()
1839 -d auto_dir Specifies the directory to auto created files. (default .)\n\ in help()
1840 -D debug_lvl Specifies the debug level (default 1)\n\ in help()
1841 -E Print examples and exit\n\ in help()
1842 -e errs The number errors that will terminate this program (def 100)\n\ in help()
1843 -f auto_file Specifies the base filename files created. (default \"gf\")\n\ in help()
1844 -g grow_incr Specfied to grow by incr for each num. (default 4096)\n\ in help()
1846 If -r option is used, this option is ignored and size is random\n\ in help()
1847 -H delay Amount of time to delay between each file (default 0.0)\n\ in help()
1848 -I io_type Specifies io type: s - sync, p - polled async, a - async (def s)\n\ in help()
1849 l - listio sync, L - listio async, r - random\n\ in help()
1850 -i iteration Specfied to grow each file num times. 0 means forever (default 1)\n\ in help()
1851 -l Specfied to do file locking around write/read/trunc\n\ in help()
1853 -L time Specfied to exit after time secs, must be used with -i.\n\ in help()
1854 -N num_files Specifies the number of files to be created.\n\ in help()
1857 -n num_procs Specifies the number of copies of this cmd.\n\ in help()
1858 -o op_type Specifies open flages: (def O_RDWR,O_CREAT) op_type can be 'random'\n\ in help()
1859 -O offset adjust i/o buffer alignment by offset bytes\n\ in help()
1860 -P PANIC Specifies to call upanic on error.\n\ in help()
1861 -p Specifies to pre-allocate space\n\ in help()
1862 -q pattern pattern can be a - ascii, p - pid with boff, o boff (def)\n\ in help()
1863 A - Alternating bits, r - random, O - all ones, z - all zeros,\n\ in help()
1864 c - checkboard, C - counting\n\ in help()
1865 -R [min-]max random lseek before write and trunc, max of -1 means filesz,\n\ in help()
1866 -2 means filesz+grow, -3 filesz-grow. (min def is 0)\n\ in help()
1867 -r [min-]max random io write size (min def is 1)\n\ in help()
1868 -S seq_auto_files Specifies the number of seqental auto files (default 0)\n\ in help()
1869 -s seed[,seed...] Specifies the random number seed (default time(0)+pid)\n\ in help()
1870 -t trunc_incr Specfied the amount to shrink file. (default 4096)\n\ in help()
1872 If -R option is used, this option is ignored and trunc is random\n\ in help()
1873 -T trunc_inter Specfied the how many grows happen before shrink. (default 0)\n\ in help()
1874 -u unlink files before exit\n\ in help()
1875 -U ui[-ui2] Unlink files each ui iteration (def 0)\n\ in help()
1876 -w Specfied to grow via lseek instead of writes.\n\ in help()
1877 -W tag-name Who-am-i. My Monster tag name. (used by Monster).\n\ in help()
1878 -x Re-exec children before continuing - useful on MPP systems\n\ in help()
1879 -y Attempt to sync copies - if one fails it will send sigusr2 to others\n\ in help()
1897 %s -i 0 -g 4090 -T 100 -t 408990 -l -C 10 -c 1000 -d dir1 -S 200\n\n", in prt_examples()
1903 %s -i 0 -g 5000 -T 100 -t 499990 -l -C 10 -c 1000 -d dir2 -S 200\n\n", in prt_examples()
1908 "# runs forever: beats on opens and closes of file ocfile - no io\n\ in prt_examples()
1909 %s -i 0 -g 0 -c 0 -C 0 ocfile\n\n", in prt_examples()
1913 %s -i 0 -g 4096 -B 50b file1 file2\n\n", Progname); in prt_examples()
1917 %s -g 1 -C 0 -d gdir -u -S 750\n\n", Progname); in prt_examples()
1920 %s -r 1-5000 -R 0--1 -i 0 -L 30 -C 1 g_rand1 g_rand2\n\n", Progname); in prt_examples()
1924 %s -g 5000 -wlu -i 0 -L 30 -C 1 -T 10 g_sleek1 g_lseek2\n\n", in prt_examples()
1930 %s -i0 -r 1-50000 -R 0--2 -I r -C1 -l -n5 -u -U 100-200 gf_rana gf_ranb\n\n", in prt_examples()
1936 %s -i0 -r 1-50000 -R 0--2 -o random -I r -C0 -l -T 20 -uU100-200 -n 5 gf_rand1 gf_rand2\n", in prt_examples()
1967 if (fstat(fd, &stbuf) != -1) { in growfile()
1973 ("%s: %d DEBUG4 %s/%d: file is a fifo - no lseek or truncs,\n", in growfile()
1984 return -1; in growfile()
2002 "%s%s: %d %s/%d: random_range() failed - %s\n", in growfile()
2005 return -1; in growfile()
2012 if ((cur_offset = lseek(fd, 0, SEEK_CUR)) == -1) { in growfile()
2016 return -1; in growfile()
2028 Progname, Pid, __FILE__, __LINE__, grow_incr - 1); in growfile()
2031 if ((noffset = lseek(fd, grow_incr - 1, SEEK_END)) == -1) { in growfile()
2035 grow_incr - 1, strerror(errno)); in growfile()
2036 return -1; in growfile()
2052 if (ret == -ENOSPC) { in growfile()
2085 if (fstat(fd, &stbuf) != -1) { in growfile()
2094 return -1; in growfile()
2127 fsize - grow_incr, 1, in growfile()
2134 if ((Woffset = lseek(fd, noffset, SEEK_SET)) == -1) { in growfile()
2140 return -1; in growfile()
2153 if ((Woffset = lseek(fd, 0, SEEK_END)) == -1) { in growfile()
2158 return -1; in growfile()
2204 return -1; in growfile()
2226 return -1; in growfile()
2233 * unspecified--which means we cannot trust what in growfile()
2264 if (ret == -ENOSPC) { in growfile()
2268 return -1; in growfile()
2279 * - file truncated after the lseek and before the write. in growfile()
2280 * - the file was written to after fstat and before the write in growfile()
2285 if (Debug > 0 && lockfile) { in growfile()
2296 Iter_cnt, (long)(off_tmp - grow_incr)); in growfile()
2305 Woffset = off_tmp - grow_incr; in growfile()
2313 * Woffset - holds start of grow (start of write expect in grow by lseek) in growfile()
2314 * Grow_incr - holds size of grow (write). in growfile()
2315 * fsize - holds size of file before write in growfile()
2317 size_grew = (Woffset + Grow_incr) - fsize; in growfile()
2369 ("%s: %d DEBUG4 %s/%d: Not shrinking file - not time, iter=%d, cnt=%d\n", in shrinkfile()
2385 if ((cur_offset = lseek(fd, 0, SEEK_CUR)) == -1) { in shrinkfile()
2390 return -1; in shrinkfile()
2394 if (max_lseek <= -1) { in shrinkfile()
2395 if ((new_offset = file_size(fd)) == -1) { in shrinkfile()
2397 return -1; in shrinkfile()
2412 if ((offset = lseek(fd, new_offset, SEEK_SET)) == -1) { in shrinkfile()
2418 return -1; in shrinkfile()
2429 new_offset = cur_offset - trunc_incr; in shrinkfile()
2435 if (lseek(fd, new_offset, SEEK_SET) == -1) { in shrinkfile()
2441 return -1; in shrinkfile()
2463 if (ret == -1) { in shrinkfile()
2473 return -1; in shrinkfile()
2479 Progname, Pid, __FILE__, __LINE__, cur_offset - new_offset, in shrinkfile()
2483 bytes_consumed -= (cur_offset - new_offset); in shrinkfile()
2526 if ((fsize = file_size(fd)) == -1) { in check_write()
2528 return -1; in check_write()
2538 "where last wrote (%ld)- no write validation\n", in check_write()
2552 Grow_incr = fsize - Woffset; in check_write()
2559 fsize, tmp - Grow_incr, (long)Woffset, tmp, in check_write()
2573 if (lseek(fd, Woffset, 0) == -1) { in check_write()
2619 for (ptr = Buffer; ptr < (Buffer + Grow_incr - 1); ptr++) { in check_write()
2626 (Grow_incr - (Buffer - ptr))), 0, in check_write()
2637 (int)(Woffset + (Grow_incr - (Buffer - ptr))), in check_write()
2674 lockfile, (long)Woffset, Grow_incr, in check_write()
2710 ("%s: %d DEBUG5 %s/%d: No file check - not time, iter=%d, cnt=%d\n", in check_file()
2734 if ((fsize = file_size(fd)) == -1) { in check_file()
2736 return -1; in check_file()
2763 return -1; in check_file()
2772 rd_size = MIN(MAX_FC_READ, fsize - rd_cnt); in check_file()
2788 return -1; in check_file()
2858 return -1; in check_file()
2935 return -1; in file_size()
2949 if (lockfile == lklevel) { in lkfile()
2986 return -1; in lkfile()
3032 if (ialloc(fd, size, IA_CONT, &avl) == -1) { in pre_alloc()
3034 "%s%s %s/%d: Unable to pre-alloc space: ialloc failed: %d %s\n", in pre_alloc()
3037 return -1; in pre_alloc()
3048 /* non-zeroing reservation */ in pre_alloc()
3049 if (fcntl(fd, F_RESVSP, &f) == -1) { in pre_alloc()
3051 "%s%s %s/%d: Unable to pre-alloc space: fcntl(F_RESVSP) failed: %d %s\n", in pre_alloc()
3054 return -1; in pre_alloc()