Lines Matching defs:args
99 void add_action(test_env_t * env, const child_args_t * args,
103 if (env->action_list_entry == args->t_kids) { /* we should never get here */
141 void decrement_io_count(const child_args_t * args, test_env_t * env,
144 if (args->flags & CLD_FLG_LBA_SYNC) {
179 void update_test_state(child_args_t * args, test_env_t * env,
185 if (args->flags & CLD_FLG_ALLDIE) {
187 PDBG4(DBUG, args,
191 args->test_state = SET_STS_FAIL(args->test_state);
196 PDBG4(DBUG, args,
200 args->test_state = SET_STS_FAIL(args->test_state);
204 if ((args->flags & CLD_FLG_W) && (args->flags & CLD_FLG_ERR_MARK)) {
224 action_t get_next_action(child_args_t * args, test_env_t * env,
240 if ((args->flags & CLD_FLG_LINEAR) && !(args->flags & CLD_FLG_NTRLVD)) {
241 target.oper = TST_OPER(args->test_state);
242 } else if ((args->flags & CLD_FLG_RANDOM)
243 && !(args->flags & CLD_FLG_NTRLVD)) {
245 (((env->rcount) + 1) + (env->wcount))) >= (args->wperc)) {
251 PDBG4(DBUG, args, "W:%.2f%% R:%.2f%%\n",
257 } else if ((args->flags & CLD_FLG_NTRLVD)
258 && !TST_wFST_TIME(args->test_state)) {
259 if ((args->flags & CLD_FLG_R) && (args->flags & CLD_FLG_W)) {
265 target.oper = (args->flags & CLD_FLG_W) ? WRITER : READER;
269 if (!(args->flags & CLD_FLG_RTRSIZ)) {
270 target.trsiz = args->ltrsiz;
272 if ((args->flags & CLD_FLG_NTRLVD) &&
273 (args->flags & CLD_FLG_W) &&
274 (args->flags & CLD_FLG_R) &&
279 target.trsiz = (rand() & 0xFFF) + args->ltrsiz;
280 if ((args->flags & CLD_FLG_SKS)
282 args->seeks))
284 } while (target.trsiz > args->htrsiz);
289 if (args->start_blk == args->stop_blk) { /* diskcache test */
290 target.lba = args->start_lba + args->offset;
291 } else if (args->flags & CLD_FLG_LINEAR) {
295 direct = (TST_DIRCTN(args->test_state)) ? 1 : -1;
296 if ((target.oper == WRITER) && TST_wFST_TIME(args->test_state)) {
297 *(tmpLBA) = args->start_lba + args->offset;
299 && TST_rFST_TIME(args->test_state)) {
300 *(tmpLBA) = args->start_lba + args->offset;
301 } else if ((TST_DIRCTN(args->test_state))
303 args->stop_lba)) {
304 } else if (!(TST_DIRCTN(args->test_state))
305 && (*(tmpLBA) >= (args->start_lba + args->offset))) {
307 if (args->flags & CLD_FLG_LUNU) {
308 *(tmpLBA) = args->start_lba + args->offset;
309 if ((args->flags & CLD_FLG_CYC)
313 } else if (args->flags & CLD_FLG_LUND) {
314 args->test_state = DIRCT_CNG(args->test_state);
316 (TST_DIRCTN(args->test_state)) ? 1 : -1;
319 if ((args->flags & CLD_FLG_CYC) && (direct > 0)) {
325 } else if (args->flags & CLD_FLG_RANDOM) {
326 if ((args->flags & CLD_FLG_NTRLVD)
327 && (args->flags & CLD_FLG_W)
328 && (args->flags & CLD_FLG_R)
334 (Rand64() & mask) + args->start_lba;
335 } while (target.lba > args->stop_lba);
338 ALIGN(target.lba, target.trsiz) + args->offset;
339 if (guessLBA > args->stop_lba) {
340 target.lba = guessLBA = args->stop_lba;
347 args->stop_lba) {
353 if ((target.lba + (target.trsiz - 1)) > args->stop_lba) {
358 if ((args->flags & CLD_FLG_LBA_SYNC) && (action_in_use(env, target))) {
362 if (!(args->flags & CLD_FLG_NTRLVD)
363 && !(args->flags & CLD_FLG_RANDOM)
364 && (args->flags & CLD_FLG_W)
365 && (args->flags & CLD_FLG_R)) {
367 (args->seeks / 2)) {
373 if ((args->flags & CLD_FLG_SKS)
374 && (((env->wcount) + (env->rcount)) >= args->seeks)) {
386 if (args->flags & (CLD_FLG_CMPR | CLD_FLG_WRITE_ONCE)) {
390 (((target.lba - args->offset - args->start_lba) +
392 args->offset -
393 args->start_lba) +
404 else if (!(args->flags & CLD_FLG_W)) ;
406 else if ((target.oper == WRITER) && (args->flags & CLD_FLG_WRITE_ONCE)
410 && !(args->flags & CLD_FLG_WRITE_ONCE)) ;
413 else if ((args->flags & CLD_FLG_LINEAR)
414 || ((args->flags & CLD_FLG_NTRLVD)
415 && (args->flags & CLD_FLG_RANDOM))) {
424 if ((args->flags & CLD_FLG_LINEAR) &&
425 !(args->flags & CLD_FLG_NTRLVD) &&
426 (args->flags & CLD_FLG_RTRSIZ) &&
429 *(tmpLBA) = args->start_lba + args->offset;
439 } else if ((target.oper == READER) && (args->flags & CLD_FLG_CMPR)
443 args->test_state = SET_OPER_W(args->test_state);
445 if ((args->flags & CLD_FLG_LBA_SYNC)
452 args->test_state = SET_OPER_R(args->test_state);
458 PDBG5(DBUG, args, "%I64d, %I64d, %I64d, %I64d\n", env->wcount,
459 env->rcount, args->seeks, args->stop_lba);
461 PDBG5(DBUG, args, "%lld, %lld, %lld, %lld\n", env->wcount, env->rcount,
462 args->seeks, args->stop_lba);
468 if ((args->flags & CLD_FLG_LUND))
471 if (TST_wFST_TIME(args->test_state))
472 args->test_state = CLR_wFST_TIME(args->test_state);
474 if (args->flags & CLD_FLG_LBA_SYNC) {
475 add_action(env, args, target);
481 if (TST_rFST_TIME(args->test_state))
482 args->test_state = CLR_rFST_TIME(args->test_state);
484 if (args->flags & CLD_FLG_LBA_SYNC) {
485 add_action(env, args, target);
492 void miscompare_dump(const child_args_t * args, const char *data,
500 sprintf(obuff, "dump_%d.dat", args->pid);
508 args->argstr);
510 fprintf(fpDumpFile, "Target: %s\n", args->device);
517 pMsg(ERR, args, "EXPECTED:\n");
519 fprintf(fpDumpFile, DMFILESTR, "EXPECTED", args->device,
522 pMsg(ERR, args, "ACTUAL:\n");
524 fprintf(fpDumpFile, DMFILESTR, "ACTUAL", args->device,
527 pMsg(ERR, args, "REREAD ACTUAL:\n");
530 args->device, tPosition, offset);
544 void complete_io(test_env_t * env, const child_args_t * args,
555 (((target.lba - args->offset - args->start_lba) +
557 0x80 >> (((target.lba - args->offset - args->start_lba) + i) %
564 if (args->flags & CLD_FLG_LBA_SYNC) {
584 child_args_t *args = test->args;
615 pMsg(ERR, args,
618 args->test_state = SET_STS_FAIL(args->test_state);
629 if ((args->flags & CLD_FLG_ALLDIE) || (glb_flags & GLB_FLG_KILL)) {
633 target.oper = TST_OPER(args->test_state);
635 strncpy(filespec, args->device, DEV_NAME_LEN);
637 fd = Open(filespec, args->flags);
639 pMsg(ERR, args, "Thread %d: could not open %s, errno = %u.\n",
640 this_thread_id, args->device, GETLASTERROR());
641 args->test_state = SET_STS_FAIL(args->test_state);
647 (char *)ALLOC(((args->htrsiz * BLK_SIZE) + ALIGNSIZE))) == NULL) {
648 pMsg(ERR, args,
651 args->test_state = SET_STS_FAIL(args->test_state);
655 memset(buffer1, SET_CHAR, ((args->htrsiz * BLK_SIZE) + ALIGNSIZE));
659 (char *)ALLOC(((args->htrsiz * BLK_SIZE) + ALIGNSIZE))) == NULL) {
660 pMsg(ERR, args,
664 args->test_state = SET_STS_FAIL(args->test_state);
668 memset(buffer2, SET_CHAR, ((args->htrsiz * BLK_SIZE) + ALIGNSIZE));
672 while (mask <= (args->stop_lba - args->start_lba)) {
678 while (delayMask <= (args->delayTimeMax - args->delayTimeMin)) {
685 retries = args->retries;
687 PDBG5(DBUG, args,
700 target = get_next_action(args, env, mask);
709 PDBG5(DBUG, args,
720 if (args->delayTimeMin == args->delayTimeMax) { /* static delay time */
722 if (args->delayTimeMin > 0) {
723 Sleep(args->delayTimeMin);
729 + args->delayTimeMin;
730 } while (delayTime > args->delayTimeMax);
732 PDBG3(DBUG, args,
741 PDBG3(DBUG, args,
764 pMsg(msg_level, args, SFSTR, this_thread_id,
770 pMsg(INFO, args,
774 Sleep(args->retry_delay);
779 update_test_state(args, env, this_thread_id, fd,
781 decrement_io_count(args, env, target);
788 if (args->flags & CLD_FLG_LPTYPE) {
795 if (args->flags & CLD_FLG_MBLK) {
797 &(target.lba), args, env);
802 if (args->flags & CLD_FLG_IO_SERIAL) {
812 PDBG5(DBUG, args, "Thread %d: I/O Time: %ld usecs\n",
815 if (args->flags & CLD_FLG_WFSYNC) {
821 args->sync_interval)) {
823 PDBG3(DBUG, args,
831 pMsg(msg_level, args,
835 update_test_state(args, env,
838 decrement_io_count(args, env,
855 if (args->flags & CLD_FLG_IO_SERIAL) {
864 PDBG5(DBUG, args, "Thread %d: I/O Time: %ld usecs\n",
871 pMsg(msg_level, args, AFSTR, this_thread_id,
877 pMsg(INFO, args,
881 Sleep(args->retry_delay);
886 update_test_state(args, env, this_thread_id, fd,
888 decrement_io_count(args, env, target);
895 if ((target.oper == READER) && (args->flags & CLD_FLG_CMPR)) {
897 if ((args->cmp_lng == 0)
898 || (args->cmp_lng > target.trsiz * BLK_SIZE)) {
899 args->cmp_lng = target.trsiz * BLK_SIZE;
901 if (args->flags & CLD_FLG_LPTYPE) {
908 if (args->flags & CLD_FLG_MBLK) {
910 &(target.lba), args, env);
912 if (memcmp(buf2, buf1, args->cmp_lng) != 0) {
915 pMsg(ERR, args, DMSTR, this_thread_id,
918 for (i = 0; i < args->htrsiz * BLK_SIZE; i++) {
920 pMsg(ERR, args, DMOFFSTR,
925 miscompare_dump(args, buf2,
926 args->htrsiz * BLK_SIZE,
929 miscompare_dump(args, buf1,
930 args->htrsiz * BLK_SIZE,
934 if (args->flags & CLD_FLG_ERR_REREAD) {
948 PDBG5(DBUG, args,
956 pMsg(ERR, args,
959 pMsg(ERR, args, AFSTR,
971 miscompare_dump(args, buf1,
972 args->htrsiz *
978 pMsg(ERR, args,
981 pMsg(ERR, args, SFSTR,
996 update_test_state(args, env, this_thread_id, fd,
998 decrement_io_count(args, env, target);
1006 complete_io(env, args, target);
1023 if ((args->flags & CLD_FLG_W) && !(args->flags & CLD_FLG_RAW)) {
1025 PDBG5(DBUG, args, "Thread %d: starting sync\n", this_thread_id);
1029 pMsg(ERR, args, "Thread %d: fsync error = %d\n",
1031 args->test_state = SET_STS_FAIL(args->test_state);
1034 PDBG5(DBUG, args, "Thread %d: finished sync\n", this_thread_id);
1040 pMsg(ERR, args, "Thread %d: close error = %d\n", this_thread_id,
1042 args->test_state = SET_STS_FAIL(args->test_state);