X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fspa.c;h=c4a8418ef53f05522e7e62b7663b9aaf30e68087;hb=5cb63a57f8d2d1a94e65b4710bfbb221b1a71700;hp=afdfa123221e5c053a2f73b87f9eb0f6ae2aec2c;hpb=00b46022c676e402e3f33ce93ee2983bbad2c46f;p=zfs.git diff --git a/module/zfs/spa.c b/module/zfs/spa.c index afdfa12..c4a8418 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -22,6 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + */ /* * This file contains all the routines used when modifying on-disk SPA state. @@ -40,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -94,7 +98,7 @@ typedef struct zio_taskq_info { } zio_taskq_info_t; static const char *const zio_taskq_types[ZIO_TASKQ_TYPES] = { - "issue", "issue_high", "intr", "intr_high" + "iss", "iss_h", "int", "int_h" }; /* @@ -105,8 +109,8 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = { /* ISSUE ISSUE_HIGH INTR INTR_HIGH */ { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, { ZTI_FIX(8), ZTI_NULL, ZTI_BATCH, ZTI_NULL }, - { ZTI_BATCH, ZTI_FIX(5), ZTI_FIX(8), ZTI_FIX(5) }, - { ZTI_FIX(100), ZTI_NULL, ZTI_ONE, ZTI_NULL }, + { ZTI_BATCH, ZTI_FIX(5), ZTI_FIX(16), ZTI_FIX(5) }, + { ZTI_PCT(100), ZTI_NULL, ZTI_ONE, ZTI_NULL }, { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, }; @@ -229,7 +233,9 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) zap_attribute_t za; int err; - VERIFY(nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP) == 0); + err = nvlist_alloc(nvp, NV_UNIQUE_NAME, KM_SLEEP); + if (err) + return err; mutex_enter(&spa->spa_props_lock); @@ -241,7 +247,7 @@ spa_prop_get(spa_t *spa, nvlist_t **nvp) /* If no pool property object, no more prop to get. */ if (mos == NULL || spa->spa_pool_props_object == 0) { mutex_exit(&spa->spa_props_lock); - return (0); + goto out; } /* @@ -611,9 +617,8 @@ spa_get_errlists(spa_t *spa, avl_tree_t *last, avl_tree_t *scrub) static taskq_t * spa_taskq_create(spa_t *spa, const char *name, enum zti_modes mode, - uint_t value) + uint_t value, uint_t flags) { - uint_t flags = TASKQ_PREPOPULATE; boolean_t batch = B_FALSE; switch (mode) { @@ -663,18 +668,22 @@ spa_create_zio_taskqs(spa_t *spa) const zio_taskq_info_t *ztip = &zio_taskqs[t][q]; enum zti_modes mode = ztip->zti_mode; uint_t value = ztip->zti_value; + uint_t flags = 0; char name[32]; + if (t == ZIO_TYPE_WRITE) + flags |= TASKQ_NORECLAIM; + (void) snprintf(name, sizeof (name), "%s_%s", zio_type_name[t], zio_taskq_types[q]); spa->spa_zio_taskq[t][q] = - spa_taskq_create(spa, name, mode, value); + spa_taskq_create(spa, name, mode, value, flags); } } } -#ifdef _KERNEL +#if defined(_KERNEL) && defined(HAVE_SPA_THREAD) static void spa_thread(void *arg) { @@ -764,6 +773,7 @@ spa_activate(spa_t *spa, int mode) ASSERT(spa->spa_proc == &p0); spa->spa_did = 0; +#ifdef HAVE_SPA_THREAD /* Only create a process if we're going to be around a while. */ if (spa_create_process && strcmp(spa->spa_name, TRYIMPORT_NAME) != 0) { if (newproc(spa_thread, (caddr_t)spa, syscid, maxclsyspri, @@ -784,6 +794,7 @@ spa_activate(spa_t *spa, int mode) #endif } } +#endif /* HAVE_SPA_THREAD */ mutex_exit(&spa->spa_proc_lock); /* If we didn't create a process, we need to create our taskqs. */ @@ -1968,7 +1979,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, cmn_err(CE_WARN, "pool '%s' could not be " "loaded as it was last accessed by " "another system (host: %s hostid: 0x%lx). " - "See: http://www.sun.com/msg/ZFS-8000-EY", + "See: http://zfsonlinux.org/msg/ZFS-8000-EY", spa_name(spa), hostname, (unsigned long)hostid); return (EBADF); @@ -5858,3 +5869,62 @@ spa_event_notify(spa_t *spa, vdev_t *vd, const char *name) zfs_ereport_post(name, spa, vd, NULL, 0, 0); #endif } + +#if defined(_KERNEL) && defined(HAVE_SPL) +/* state manipulation functions */ +EXPORT_SYMBOL(spa_open); +EXPORT_SYMBOL(spa_open_rewind); +EXPORT_SYMBOL(spa_get_stats); +EXPORT_SYMBOL(spa_create); +EXPORT_SYMBOL(spa_import_rootpool); +EXPORT_SYMBOL(spa_import); +EXPORT_SYMBOL(spa_tryimport); +EXPORT_SYMBOL(spa_destroy); +EXPORT_SYMBOL(spa_export); +EXPORT_SYMBOL(spa_reset); +EXPORT_SYMBOL(spa_async_request); +EXPORT_SYMBOL(spa_async_suspend); +EXPORT_SYMBOL(spa_async_resume); +EXPORT_SYMBOL(spa_inject_addref); +EXPORT_SYMBOL(spa_inject_delref); +EXPORT_SYMBOL(spa_scan_stat_init); +EXPORT_SYMBOL(spa_scan_get_stats); + +/* device maniion */ +EXPORT_SYMBOL(spa_vdev_add); +EXPORT_SYMBOL(spa_vdev_attach); +EXPORT_SYMBOL(spa_vdev_detach); +EXPORT_SYMBOL(spa_vdev_remove); +EXPORT_SYMBOL(spa_vdev_setpath); +EXPORT_SYMBOL(spa_vdev_setfru); +EXPORT_SYMBOL(spa_vdev_split_mirror); + +/* spare statech is global across all pools) */ +EXPORT_SYMBOL(spa_spare_add); +EXPORT_SYMBOL(spa_spare_remove); +EXPORT_SYMBOL(spa_spare_exists); +EXPORT_SYMBOL(spa_spare_activate); + +/* L2ARC statech is global across all pools) */ +EXPORT_SYMBOL(spa_l2cache_add); +EXPORT_SYMBOL(spa_l2cache_remove); +EXPORT_SYMBOL(spa_l2cache_exists); +EXPORT_SYMBOL(spa_l2cache_activate); +EXPORT_SYMBOL(spa_l2cache_drop); + +/* scanning */ +EXPORT_SYMBOL(spa_scan); +EXPORT_SYMBOL(spa_scan_stop); + +/* spa syncing */ +EXPORT_SYMBOL(spa_sync); /* only for DMU use */ +EXPORT_SYMBOL(spa_sync_allpools); + +/* properties */ +EXPORT_SYMBOL(spa_prop_set); +EXPORT_SYMBOL(spa_prop_get); +EXPORT_SYMBOL(spa_prop_clear_bootfs); + +/* asynchronous event notification */ +EXPORT_SYMBOL(spa_event_notify); +#endif