Print this page
zpool import speedup

*** 456,483 **** * Returns NULL if no matching spa_t is found. */ spa_t * spa_lookup(const char *name) { ! static spa_t search; /* spa_t is large; don't allocate on stack */ spa_t *spa; avl_index_t where; char *cp; ! ASSERT(MUTEX_HELD(&spa_namespace_lock)); ! (void) strlcpy(search.spa_name, name, sizeof (search.spa_name)); /* * If it's a full dataset name, figure out the pool name and * just use that. */ ! cp = strpbrk(search.spa_name, "/@#"); if (cp != NULL) *cp = '\0'; ! spa = avl_find(&spa_namespace_avl, &search, &where); return (spa); } /* --- 456,484 ---- * Returns NULL if no matching spa_t is found. */ spa_t * spa_lookup(const char *name) { ! spa_t *search; spa_t *spa; avl_index_t where; char *cp; ! search = kmem_alloc(sizeof(*search), KM_SLEEP); ! (void) strlcpy(search->spa_name, name, sizeof (search->spa_name)); /* * If it's a full dataset name, figure out the pool name and * just use that. */ ! cp = strpbrk(search->spa_name, "/@#"); if (cp != NULL) *cp = '\0'; ! spa = avl_find(&spa_namespace_avl, search, &where); ! kmem_free(search, sizeof(*search)); return (spa); } /*