Lines Matching refs:scl

362 		spa_config_lock_t *scl = &spa->spa_config_lock[i];
363 mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL);
364 cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL);
365 refcount_create_untracked(&scl->scl_count);
366 scl->scl_writer = NULL;
367 scl->scl_write_wanted = 0;
375 spa_config_lock_t *scl = &spa->spa_config_lock[i];
376 mutex_destroy(&scl->scl_lock);
377 cv_destroy(&scl->scl_cv);
378 refcount_destroy(&scl->scl_count);
379 ASSERT(scl->scl_writer == NULL);
380 ASSERT(scl->scl_write_wanted == 0);
388 spa_config_lock_t *scl = &spa->spa_config_lock[i];
391 mutex_enter(&scl->scl_lock);
393 if (scl->scl_writer || scl->scl_write_wanted) {
394 mutex_exit(&scl->scl_lock);
400 ASSERT(scl->scl_writer != curthread);
401 if (!refcount_is_zero(&scl->scl_count)) {
402 mutex_exit(&scl->scl_lock);
407 scl->scl_writer = curthread;
409 (void) refcount_add(&scl->scl_count, tag);
410 mutex_exit(&scl->scl_lock);
423 spa_config_lock_t *scl = &spa->spa_config_lock[i];
424 if (scl->scl_writer == curthread)
428 mutex_enter(&scl->scl_lock);
430 while (scl->scl_writer || scl->scl_write_wanted) {
431 cv_wait(&scl->scl_cv, &scl->scl_lock);
434 ASSERT(scl->scl_writer != curthread);
435 while (!refcount_is_zero(&scl->scl_count)) {
436 scl->scl_write_wanted++;
437 cv_wait(&scl->scl_cv, &scl->scl_lock);
438 scl->scl_write_wanted--;
440 scl->scl_writer = curthread;
442 (void) refcount_add(&scl->scl_count, tag);
443 mutex_exit(&scl->scl_lock);
452 spa_config_lock_t *scl = &spa->spa_config_lock[i];
455 mutex_enter(&scl->scl_lock);
456 ASSERT(!refcount_is_zero(&scl->scl_count));
457 if (refcount_remove(&scl->scl_count, tag) == 0) {
458 ASSERT(scl->scl_writer == NULL ||
459 scl->scl_writer == curthread);
460 scl->scl_writer = NULL; /* OK in either case */
461 cv_broadcast(&scl->scl_cv);
463 mutex_exit(&scl->scl_lock);
473 spa_config_lock_t *scl = &spa->spa_config_lock[i];
476 if ((rw == RW_READER && !refcount_is_zero(&scl->scl_count)) ||
477 (rw == RW_WRITER && scl->scl_writer == curthread))