Lines Matching refs:info

163 nvme_rwlock_rdlock(nvme_minor_lock_info_t *info, nvme_lock_t *lock)  in nvme_rwlock_rdlock()  argument
167 ASSERT3U(info->nli_state, ==, NVME_LOCK_STATE_UNLOCKED); in nvme_rwlock_rdlock()
168 ASSERT3U(list_link_active(&info->nli_node), ==, 0); in nvme_rwlock_rdlock()
169 ASSERT3P(info->nli_minor, !=, NULL); in nvme_rwlock_rdlock()
170 ASSERT3P(info->nli_nvme, !=, NULL); in nvme_rwlock_rdlock()
171 ASSERT3U(info->nli_curlevel, ==, NVME_LOCK_L_READ); in nvme_rwlock_rdlock()
173 info->nli_state = NVME_LOCK_STATE_ACQUIRED; in nvme_rwlock_rdlock()
174 info->nli_last_change = gethrtime(); in nvme_rwlock_rdlock()
175 info->nli_acq_kthread = (uintptr_t)curthread; in nvme_rwlock_rdlock()
176 info->nli_acq_pid = (uint32_t)curproc->p_pid; in nvme_rwlock_rdlock()
178 list_insert_tail(&lock->nl_readers, info); in nvme_rwlock_rdlock()
183 nvme_rwlock_wrlock(nvme_minor_lock_info_t *info, nvme_lock_t *lock) in nvme_rwlock_wrlock() argument
186 ASSERT3U(info->nli_state, ==, NVME_LOCK_STATE_UNLOCKED); in nvme_rwlock_wrlock()
187 ASSERT3U(list_link_active(&info->nli_node), ==, 0); in nvme_rwlock_wrlock()
188 ASSERT3P(info->nli_minor, !=, NULL); in nvme_rwlock_wrlock()
189 ASSERT3P(info->nli_nvme, !=, NULL); in nvme_rwlock_wrlock()
191 info->nli_state = NVME_LOCK_STATE_ACQUIRED; in nvme_rwlock_wrlock()
192 info->nli_curlevel = NVME_LOCK_L_WRITE; in nvme_rwlock_wrlock()
193 info->nli_last_change = gethrtime(); in nvme_rwlock_wrlock()
194 info->nli_acq_kthread = (uintptr_t)curthread; in nvme_rwlock_wrlock()
195 info->nli_acq_pid = (uint32_t)curproc->p_pid; in nvme_rwlock_wrlock()
197 lock->nl_writer = info; in nvme_rwlock_wrlock()
206 nvme_rwlock_is_reader(nvme_lock_t *lock, const nvme_minor_lock_info_t *info) in nvme_rwlock_is_reader() argument
210 if (i == info) { in nvme_rwlock_is_reader()
219 nvme_rwlock_signal_one(nvme_minor_lock_info_t *info, nvme_ioctl_errno_t err) in nvme_rwlock_signal_one() argument
221 ASSERT3P(info->nli_ioc, !=, NULL); in nvme_rwlock_signal_one()
222 ASSERT3P(info->nli_minor, !=, NULL); in nvme_rwlock_signal_one()
223 ASSERT3P(info->nli_state, !=, NVME_LOCK_STATE_BLOCKED); in nvme_rwlock_signal_one()
226 nvme_ioctl_success(info->nli_ioc); in nvme_rwlock_signal_one()
228 (void) nvme_ioctl_error(info->nli_ioc, err, 0, 0); in nvme_rwlock_signal_one()
231 cv_signal(&info->nli_minor->nm_cv); in nvme_rwlock_signal_one()
237 nvme_minor_lock_info_t *info; in nvme_rwlock_wakeup_readers() local
246 while ((info = list_remove_head(&lock->nl_pend_readers)) != NULL) { in nvme_rwlock_wakeup_readers()
247 info->nli_state = NVME_LOCK_STATE_UNLOCKED; in nvme_rwlock_wakeup_readers()
248 nvme_rwlock_rdlock(info, lock); in nvme_rwlock_wakeup_readers()
249 nvme_rwlock_signal_one(info, NVME_IOCTL_E_OK); in nvme_rwlock_wakeup_readers()
296 nvme_minor_lock_info_t *info; in nvme_rwlock_wakeup() local
305 info = list_remove_head(&ctrl_lock->nl_pend_writers); in nvme_rwlock_wakeup()
306 info->nli_state = NVME_LOCK_STATE_UNLOCKED; in nvme_rwlock_wakeup()
307 nvme_rwlock_wrlock(info, ctrl_lock); in nvme_rwlock_wakeup()
308 nvme_rwlock_signal_one(info, NVME_IOCTL_E_OK); in nvme_rwlock_wakeup()
318 nvme_minor_lock_info_t *info; in nvme_rwlock_wakeup() local
323 info = list_remove_head(&ns_lock->nl_pend_writers); in nvme_rwlock_wakeup()
324 info->nli_state = NVME_LOCK_STATE_UNLOCKED; in nvme_rwlock_wakeup()
325 nvme_rwlock_wrlock(info, ns_lock); in nvme_rwlock_wakeup()
326 nvme_rwlock_signal_one(info, NVME_IOCTL_E_OK); in nvme_rwlock_wakeup()
337 nvme_rwunlock_cleanup_minor(nvme_minor_lock_info_t *info) in nvme_rwunlock_cleanup_minor() argument
339 info->nli_lock = NULL; in nvme_rwunlock_cleanup_minor()
340 info->nli_state = NVME_LOCK_STATE_UNLOCKED; in nvme_rwunlock_cleanup_minor()
341 info->nli_curlevel = 0; in nvme_rwunlock_cleanup_minor()
342 info->nli_ns = NULL; in nvme_rwunlock_cleanup_minor()
353 nvme_rwunlock(nvme_minor_lock_info_t *info, nvme_lock_t *lock) in nvme_rwunlock() argument
355 nvme_t *const nvme = info->nli_nvme; in nvme_rwunlock()
359 VERIFY3P(info->nli_lock, ==, lock); in nvme_rwunlock()
360 VERIFY(info->nli_curlevel == NVME_LOCK_L_READ || in nvme_rwunlock()
361 info->nli_curlevel == NVME_LOCK_L_WRITE); in nvme_rwunlock()
362 is_read = info->nli_curlevel == NVME_LOCK_L_READ; in nvme_rwunlock()
368 info->nli_last_change = gethrtime(); in nvme_rwunlock()
370 VERIFY3U(list_link_active(&info->nli_node), !=, 0); in nvme_rwunlock()
371 ASSERT3U(nvme_rwlock_is_reader(lock, info), ==, B_TRUE); in nvme_rwunlock()
372 list_remove(&lock->nl_readers, info); in nvme_rwunlock()
374 VERIFY3U(list_link_active(&info->nli_node), ==, 0); in nvme_rwunlock()
375 VERIFY3P(lock->nl_writer, ==, info); in nvme_rwunlock()
379 nvme_rwunlock_cleanup_minor(info); in nvme_rwunlock()
392 nvme_rwlock_signal(nvme_minor_lock_info_t *info, nvme_lock_t *lock, in nvme_rwlock_signal() argument
395 ASSERT3P(info->nli_ioc, !=, NULL); in nvme_rwlock_signal()
401 info->nli_last_change = gethrtime(); in nvme_rwlock_signal()
409 if (info->nli_state == NVME_LOCK_STATE_UNLOCKED) { in nvme_rwlock_signal()
410 ASSERT3P(info->nli_lock, ==, NULL); in nvme_rwlock_signal()
411 (void) nvme_ioctl_error(info->nli_ioc, in nvme_rwlock_signal()
420 ASSERT3P(info->nli_lock, ==, lock); in nvme_rwlock_signal()
426 if (info->nli_state == NVME_LOCK_STATE_BLOCKED) { in nvme_rwlock_signal()
427 ASSERT3S(list_link_active(&info->nli_node), !=, 0); in nvme_rwlock_signal()
429 list_remove(&lock->nl_pend_readers, info); in nvme_rwlock_signal()
431 list_remove(&lock->nl_pend_writers, info); in nvme_rwlock_signal()
434 nvme_rwunlock_cleanup_minor(info); in nvme_rwlock_signal()
435 (void) nvme_ioctl_error(info->nli_ioc, in nvme_rwlock_signal()
446 nvme_rwunlock(info, lock); in nvme_rwlock_signal()
468 nvme_minor_lock_info_t *info; in nvme_rwlock() local
476 info = &minor->nm_ctrl_lock; in nvme_rwlock()
487 info = &minor->nm_ns_lock; in nvme_rwlock()
505 info->nli_curlevel = is_read ? NVME_LOCK_L_READ : NVME_LOCK_L_WRITE; in nvme_rwlock()
506 info->nli_lock = lock; in nvme_rwlock()
513 nvme_rwlock_rdlock(info, lock); in nvme_rwlock()
515 nvme_rwlock_wrlock(info, lock); in nvme_rwlock()
529 nvme_rwunlock_cleanup_minor(info); in nvme_rwlock()
536 ASSERT3P(info->nli_ioc, ==, NULL); in nvme_rwlock()
537 info->nli_ioc = &req->nil_common; in nvme_rwlock()
539 list_insert_tail(&lock->nl_pend_readers, info); in nvme_rwlock()
542 list_insert_tail(&lock->nl_pend_writers, info); in nvme_rwlock()
546 ASSERT3U(info->nli_state, ==, NVME_LOCK_STATE_UNLOCKED); in nvme_rwlock()
547 info->nli_state = NVME_LOCK_STATE_BLOCKED; in nvme_rwlock()
549 info->nli_last_change = sleep_time; in nvme_rwlock()
550 while (info->nli_state == NVME_LOCK_STATE_BLOCKED) { in nvme_rwlock()
558 nvme_rwlock_signal(info, lock, is_read); in nvme_rwlock()
566 info->nli_ioc = NULL; in nvme_rwlock()
568 ASSERT3S(info->nli_last_change, !=, sleep_time); in nvme_rwlock()
569 if (info->nli_state == NVME_LOCK_STATE_UNLOCKED) { in nvme_rwlock()
570 ASSERT3S(list_link_active(&info->nli_node), ==, 0); in nvme_rwlock()
571 ASSERT3P(info->nli_ns, ==, NULL); in nvme_rwlock()
574 ASSERT3U(info->nli_state, ==, NVME_LOCK_STATE_ACQUIRED); in nvme_rwlock()
577 ASSERT3S(list_link_active(&info->nli_node), !=, 0); in nvme_rwlock()
579 ASSERT3P(lock->nl_writer, ==, info); in nvme_rwlock()
582 ASSERT3P(info->nli_minor, ==, minor); in nvme_rwlock()
583 ASSERT3P(info->nli_nvme, ==, minor->nm_ctrl); in nvme_rwlock()
597 nvme_rwlock_ctrl_dead_cleanup_one(nvme_t *nvme, nvme_minor_lock_info_t *info) in nvme_rwlock_ctrl_dead_cleanup_one() argument
599 ASSERT3U(info->nli_state, ==, NVME_LOCK_STATE_BLOCKED); in nvme_rwlock_ctrl_dead_cleanup_one()
600 ASSERT3P(info->nli_ioc, !=, NULL); in nvme_rwlock_ctrl_dead_cleanup_one()
605 info->nli_last_change = gethrtime(); in nvme_rwlock_ctrl_dead_cleanup_one()
606 nvme_rwunlock_cleanup_minor(info); in nvme_rwlock_ctrl_dead_cleanup_one()
607 nvme_rwlock_signal_one(info, nvme->n_dead_status); in nvme_rwlock_ctrl_dead_cleanup_one()
626 nvme_minor_lock_info_t *info; in nvme_rwlock_ctrl_dead() local
633 while ((info = list_remove_head(&ns_lock->nl_pend_readers)) != in nvme_rwlock_ctrl_dead()
635 nvme_rwlock_ctrl_dead_cleanup_one(nvme, info); in nvme_rwlock_ctrl_dead()
638 while ((info = list_remove_head(&ns_lock->nl_pend_writers)) != in nvme_rwlock_ctrl_dead()
640 nvme_rwlock_ctrl_dead_cleanup_one(nvme, info); in nvme_rwlock_ctrl_dead()
644 while ((info = list_remove_head(&ctrl_lock->nl_pend_readers)) != NULL) { in nvme_rwlock_ctrl_dead()
645 nvme_rwlock_ctrl_dead_cleanup_one(nvme, info); in nvme_rwlock_ctrl_dead()
648 while ((info = list_remove_head(&ctrl_lock->nl_pend_writers)) != NULL) { in nvme_rwlock_ctrl_dead()
650 nvme_rwlock_ctrl_dead_cleanup_one(nvme, info); in nvme_rwlock_ctrl_dead()