Exemplo n.º 1
0
/*
 * A modification operation to the MDFS has begun.  This means the
 * cursor thread must be woken to start a transaction group.
 */
void
slm_zfs_cursor_start(void)
{
	spinlock(&slm_cursor_lock);
	if (!slm_cursor_update_needed++ && !slm_cursor_update_inprog)
		psc_waitq_wakeall(&slm_cursor_waitq);
	freelock(&slm_cursor_lock);
}
Exemplo n.º 2
0
/*
 * A modification operation to the MDFS has ended.  If other operations
 * are ongoing, we need to re-wake the cursor thread to ensure a
 * transaction group is active as it is not guaranteed to be awake.
 */
void
slm_zfs_cursor_end(void)
{
	spinlock(&slm_cursor_lock);
	psc_assert(slm_cursor_update_needed > 0);
	if (--slm_cursor_update_needed && !slm_cursor_update_inprog)
		psc_waitq_wakeall(&slm_cursor_waitq);
	freelock(&slm_cursor_lock);
}
Exemplo n.º 3
0
int
main(int argc, char *argv[])
{
    int c, i, rc = 0;

    progname = argv[0];
    pfl_init();
    while ((c = getopt(argc, argv, "n:i:")) != -1)
        switch (c) {
        case 'n':
            nthreads = atoi(optarg);
            break;
        case 'i':
            iterations = atoi(optarg);
            break;
        default:
            usage();
        }
    argc -= optind;
    if (argc)
        usage();

    psclog_debug("nthreads = %d", nthreads);

    psc_waitq_init(&waitq);

    for (i = 0; i < nthreads; i++)
        pscthr_init(0, child_main, NULL, 0, "thr%d", i);

    sleep(1);
    psc_waitq_wakeall(&waitq);
    sleep(2);

    i = nthreads * iterations;
    while (i--) {
        psc_waitq_wakeone(&waitq);
        usleep(30);
    }
    return rc;
}