Lines Matching refs:handler

53  * Data describing each zinject handler registered on the system, and
54 * contains the list node linking the handler in the global zinject
55 * handler list.
73 * This protects insertion into, and traversal of, the inject handler
75 * handler is inserted or removed from the list, this lock should be
97 * Used to assign unique identifying numbers to each new zinject handler.
144 inject_handler_t *handler;
148 for (handler = list_head(&inject_handlers); handler != NULL;
149 handler = list_next(&inject_handlers, handler)) {
151 if (spa != handler->zi_spa)
154 if (handler->zi_record.zi_type == type &&
155 strcmp(tag, handler->zi_record.zi_func) == 0)
170 inject_handler_t *handler;
186 for (handler = list_head(&inject_handlers); handler != NULL;
187 handler = list_next(&inject_handlers, handler)) {
189 if (zio->io_spa != handler->zi_spa ||
190 handler->zi_record.zi_cmd != ZINJECT_DATA_FAULT)
193 /* If this handler matches, return EIO */
196 &handler->zi_record, error)) {
209 * handler associated with that portion of the label. Currently, we
216 inject_handler_t *handler;
228 for (handler = list_head(&inject_handlers); handler != NULL;
229 handler = list_next(&inject_handlers, handler)) {
230 uint64_t start = handler->zi_record.zi_start;
231 uint64_t end = handler->zi_record.zi_end;
233 if (handler->zi_record.zi_cmd != ZINJECT_LABEL_FAULT)
245 if (zio->io_vd->vdev_guid == handler->zi_record.zi_guid &&
259 inject_handler_t *handler;
276 for (handler = list_head(&inject_handlers); handler != NULL;
277 handler = list_next(&inject_handlers, handler)) {
279 if (handler->zi_record.zi_cmd != ZINJECT_DEVICE_FAULT)
282 if (vd->vdev_guid == handler->zi_record.zi_guid) {
283 if (handler->zi_record.zi_failfast &&
291 handler->zi_record.zi_iotype != ZIO_TYPES &&
292 handler->zi_record.zi_iotype != zio->io_type)
295 if (handler->zi_record.zi_error == error) {
309 if (!handler->zi_record.zi_failfast &&
316 if (handler->zi_record.zi_error == ENXIO) {
335 inject_handler_t *handler;
339 for (handler = list_head(&inject_handlers); handler != NULL;
340 handler = list_next(&inject_handlers, handler)) {
343 if (zio->io_spa != handler->zi_spa ||
344 handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES)
351 if (handler->zi_record.zi_timer == 0) {
352 if (handler->zi_record.zi_duration > 0)
353 handler->zi_record.zi_timer = ddi_get_lbolt64();
355 handler->zi_record.zi_timer = zio->io_txg;
370 inject_handler_t *handler;
377 for (handler = list_head(&inject_handlers); handler != NULL;
378 handler = list_next(&inject_handlers, handler)) {
380 if (spa != handler->zi_spa ||
381 handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES)
384 if (handler->zi_record.zi_duration > 0) {
385 VERIFY(handler->zi_record.zi_timer == 0 ||
386 handler->zi_record.zi_timer +
387 handler->zi_record.zi_duration * hz >
391 VERIFY(handler->zi_record.zi_timer == 0 ||
392 handler->zi_record.zi_timer -
393 handler->zi_record.zi_duration >=
432 * Each inject handler has a number of "lanes" associated with
434 * another, and at a latency defined by the inject handler
435 * record's zi_timer field. Thus if a handler in configured with
445 * handler. The mutex allows us to perform the following two
448 * 1. determine the minimum handler and minimum target
450 * 2. update that minimum handler's lane array
454 * (2). This could allow a single lane handler to process
459 for (inject_handler_t *handler = list_head(&inject_handlers);
460 handler != NULL; handler = list_next(&inject_handlers, handler)) {
461 if (handler->zi_record.zi_cmd != ZINJECT_DELAY_IO)
464 if (vd->vdev_guid != handler->zi_record.zi_guid)
469 * occurs prior to inserting this handler on the list.
471 ASSERT3P(handler->zi_lanes, !=, NULL);
477 ASSERT3U(handler->zi_record.zi_nlanes, !=, 0);
479 ASSERT3U(handler->zi_record.zi_nlanes, >,
480 handler->zi_next_lane);
485 * specific handler can complete the IO with all other
489 * Since each handler has a constant value for its
491 * handler; as it will always be the lane with the
492 * lowest value for that particular handler (i.e. the
494 * scan of each handler's lanes array.
508 hrtime_t idle = handler->zi_record.zi_timer + gethrtime();
509 hrtime_t busy = handler->zi_record.zi_timer +
510 handler->zi_lanes[handler->zi_next_lane];
514 min_handler = handler;
525 * handler during any remaining iterations. Once we're
527 * the lane and increment the handler's "next lane"
532 min_handler = handler;
539 * this vdev, otherwise it will point to the handler containing
547 * If we've used all possible lanes for this handler,
562 * Create a new handler for the given record. We add it to the list, adding
569 inject_handler_t *handler;
592 * an array used by the handler. Thus, to ensure the
609 handler = kmem_alloc(sizeof (inject_handler_t), KM_SLEEP);
611 handler->zi_spa = spa;
612 handler->zi_record = *record;
614 if (handler->zi_record.zi_cmd == ZINJECT_DELAY_IO) {
615 handler->zi_lanes = kmem_zalloc(
616 sizeof (*handler->zi_lanes) *
617 handler->zi_record.zi_nlanes, KM_SLEEP);
618 handler->zi_next_lane = 0;
620 handler->zi_lanes = NULL;
621 handler->zi_next_lane = 0;
630 * allocating the handler's zi_lanes array.
632 if (handler->zi_record.zi_cmd == ZINJECT_DELAY_IO) {
638 *id = handler->zi_id = inject_next_id++;
639 list_insert_tail(&inject_handlers, handler);
669 inject_handler_t *handler;
675 for (handler = list_head(&inject_handlers); handler != NULL;
676 handler = list_next(&inject_handlers, handler))
677 if (handler->zi_id > *id)
680 if (handler) {
681 *record = handler->zi_record;
682 *id = handler->zi_id;
683 (void) strncpy(name, spa_name(handler->zi_spa), buflen);
696 * Clear the fault handler with the given identifier, or return ENOENT if none
702 inject_handler_t *handler;
706 for (handler = list_head(&inject_handlers); handler != NULL;
707 handler = list_next(&inject_handlers, handler))
708 if (handler->zi_id == id)
711 if (handler == NULL) {
716 if (handler->zi_record.zi_cmd == ZINJECT_DELAY_IO) {
722 list_remove(&inject_handlers, handler);
725 if (handler->zi_record.zi_cmd == ZINJECT_DELAY_IO) {
726 ASSERT3P(handler->zi_lanes, !=, NULL);
727 kmem_free(handler->zi_lanes, sizeof (*handler->zi_lanes) *
728 handler->zi_record.zi_nlanes);
730 ASSERT3P(handler->zi_lanes, ==, NULL);
733 spa_inject_delref(handler->zi_spa);
734 kmem_free(handler, sizeof (inject_handler_t));