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