Print this page
zpool import speedup


 441                     (rw == RW_WRITER && scl->scl_writer == curthread))
 442                         locks_held |= 1 << i;
 443         }
 444 
 445         return (locks_held);
 446 }
 447 
 448 /*
 449  * ==========================================================================
 450  * SPA namespace functions
 451  * ==========================================================================
 452  */
 453 
 454 /*
 455  * Lookup the named spa_t in the AVL tree.  The spa_namespace_lock must be held.
 456  * Returns NULL if no matching spa_t is found.
 457  */
 458 spa_t *
 459 spa_lookup(const char *name)
 460 {
 461         static spa_t search;    /* spa_t is large; don't allocate on stack */
 462         spa_t *spa;
 463         avl_index_t where;
 464         char *cp;
 465 
 466         ASSERT(MUTEX_HELD(&spa_namespace_lock));
 467 
 468         (void) strlcpy(search.spa_name, name, sizeof (search.spa_name));
 469 
 470         /*
 471          * If it's a full dataset name, figure out the pool name and
 472          * just use that.
 473          */
 474         cp = strpbrk(search.spa_name, "/@#");
 475         if (cp != NULL)
 476                 *cp = '\0';
 477 
 478         spa = avl_find(&spa_namespace_avl, &search, &where);

 479 
 480         return (spa);
 481 }
 482 
 483 /*
 484  * Fires when spa_sync has not completed within zfs_deadman_synctime_ms.
 485  * If the zfs_deadman_enabled flag is set then it inspects all vdev queues
 486  * looking for potentially hung I/Os.
 487  */
 488 void
 489 spa_deadman(void *arg)
 490 {
 491         spa_t *spa = arg;
 492 
 493         /*
 494          * Disable the deadman timer if the pool is suspended.
 495          */
 496         if (spa_suspended(spa)) {
 497                 VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY));
 498                 return;




 441                     (rw == RW_WRITER && scl->scl_writer == curthread))
 442                         locks_held |= 1 << i;
 443         }
 444 
 445         return (locks_held);
 446 }
 447 
 448 /*
 449  * ==========================================================================
 450  * SPA namespace functions
 451  * ==========================================================================
 452  */
 453 
 454 /*
 455  * Lookup the named spa_t in the AVL tree.  The spa_namespace_lock must be held.
 456  * Returns NULL if no matching spa_t is found.
 457  */
 458 spa_t *
 459 spa_lookup(const char *name)
 460 {
 461         spa_t *search;
 462         spa_t *spa;
 463         avl_index_t where;
 464         char *cp;
 465 
 466         search = kmem_alloc(sizeof(*search), KM_SLEEP);
 467 
 468         (void) strlcpy(search->spa_name, name, sizeof (search->spa_name));
 469 
 470         /*
 471          * If it's a full dataset name, figure out the pool name and
 472          * just use that.
 473          */
 474         cp = strpbrk(search->spa_name, "/@#");
 475         if (cp != NULL)
 476                 *cp = '\0';
 477 
 478         spa = avl_find(&spa_namespace_avl, search, &where);
 479         kmem_free(search, sizeof(*search));
 480 
 481         return (spa);
 482 }
 483 
 484 /*
 485  * Fires when spa_sync has not completed within zfs_deadman_synctime_ms.
 486  * If the zfs_deadman_enabled flag is set then it inspects all vdev queues
 487  * looking for potentially hung I/Os.
 488  */
 489 void
 490 spa_deadman(void *arg)
 491 {
 492         spa_t *spa = arg;
 493 
 494         /*
 495          * Disable the deadman timer if the pool is suspended.
 496          */
 497         if (spa_suspended(spa)) {
 498                 VERIFY(cyclic_reprogram(spa->spa_deadman_cycid, CY_INFINITY));
 499                 return;