Print this page
zpool import speedup

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa_misc.c
          +++ new/usr/src/uts/common/fs/zfs/spa_misc.c
↓ open down ↓ 450 lines elided ↑ open up ↑
 451  451   * ==========================================================================
 452  452   */
 453  453  
 454  454  /*
 455  455   * Lookup the named spa_t in the AVL tree.  The spa_namespace_lock must be held.
 456  456   * Returns NULL if no matching spa_t is found.
 457  457   */
 458  458  spa_t *
 459  459  spa_lookup(const char *name)
 460  460  {
 461      -        static spa_t search;    /* spa_t is large; don't allocate on stack */
      461 +        spa_t *search;
 462  462          spa_t *spa;
 463  463          avl_index_t where;
 464  464          char *cp;
 465  465  
 466      -        ASSERT(MUTEX_HELD(&spa_namespace_lock));
      466 +        search = kmem_alloc(sizeof(*search), KM_SLEEP);
 467  467  
 468      -        (void) strlcpy(search.spa_name, name, sizeof (search.spa_name));
      468 +        (void) strlcpy(search->spa_name, name, sizeof (search->spa_name));
 469  469  
 470  470          /*
 471  471           * If it's a full dataset name, figure out the pool name and
 472  472           * just use that.
 473  473           */
 474      -        cp = strpbrk(search.spa_name, "/@#");
      474 +        cp = strpbrk(search->spa_name, "/@#");
 475  475          if (cp != NULL)
 476  476                  *cp = '\0';
 477  477  
 478      -        spa = avl_find(&spa_namespace_avl, &search, &where);
      478 +        spa = avl_find(&spa_namespace_avl, search, &where);
      479 +        kmem_free(search, sizeof(*search));
 479  480  
 480  481          return (spa);
 481  482  }
 482  483  
 483  484  /*
 484  485   * Fires when spa_sync has not completed within zfs_deadman_synctime_ms.
 485  486   * If the zfs_deadman_enabled flag is set then it inspects all vdev queues
 486  487   * looking for potentially hung I/Os.
 487  488   */
 488  489  void
↓ open down ↓ 1429 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX