FreeBSD ZFS
The Zettabyte File System
|
Storage Pool Allocator. More...
#include <sys/zfs_context.h>
#include <sys/fm/fs/zfs.h>
#include <sys/spa_impl.h>
#include <sys/zio.h>
#include <sys/zio_checksum.h>
#include <sys/dmu.h>
#include <sys/dmu_tx.h>
#include <sys/zap.h>
#include <sys/zil.h>
#include <sys/ddt.h>
#include <sys/vdev_impl.h>
#include <sys/metaslab.h>
#include <sys/metaslab_impl.h>
#include <sys/uberblock_impl.h>
#include <sys/txg.h>
#include <sys/avl.h>
#include <sys/dmu_traverse.h>
#include <sys/dmu_objset.h>
#include <sys/unique.h>
#include <sys/dsl_pool.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_synctask.h>
#include <sys/fs/zfs.h>
#include <sys/arc.h>
#include <sys/callb.h>
#include <sys/spa_boot.h>
#include <sys/zfs_ioctl.h>
#include <sys/dsl_scan.h>
#include <sys/zfeature.h>
#include <sys/zvol.h>
#include <sys/trim_map.h>
#include <sys/cpupart.h>
#include <sys/zone.h>
#include "zfs_prop.h"
#include "zfs_comutil.h"
Go to the source code of this file.
Data Structures | |
struct | zio_taskq_info |
struct | spa_load_error |
Defines | |
#define | ZTI_FIX(n) { zti_mode_fixed, (n) } |
#define | ZTI_PCT(n) { zti_mode_online_percent, (n) } |
#define | ZTI_BATCH { zti_mode_batch, 0 } |
#define | ZTI_NULL { zti_mode_null, 0 } |
#define | ZTI_ONE ZTI_FIX(1) |
#define | TRYIMPORT_NAME "$import" |
This (illegal) pool name is used when temporarily importing a spa_t in order to get the vdev stats associated with the imported devices. | |
Typedefs | |
typedef enum zti_modes | zti_modes_t |
typedef struct zio_taskq_info | zio_taskq_info_t |
typedef struct spa_load_error | spa_load_error_t |
Enumerations | |
enum | zti_modes { zti_mode_fixed, zti_mode_online_percent, zti_mode_batch, zti_mode_null, zti_nmodes } |
Functions | |
SYSCTL_DECL (_vfs_zfs) | |
TUNABLE_INT ("vfs.zfs.check_hostid",&check_hostid) | |
SYSCTL_INT (_vfs_zfs, OID_AUTO, check_hostid, CTLFLAG_RW,&check_hostid, 0,"Check hostid on import?") | |
TUNABLE_INT ("vfs.zfs.ccw_retry_interval",&zfs_ccw_retry_interval) | |
SYSCTL_INT (_vfs_zfs, OID_AUTO, ccw_retry_interval, CTLFLAG_RW,&zfs_ccw_retry_interval, 0,"Configuration cache file write, retry after failure, interval (seconds)") | |
static boolean_t | spa_has_active_shared_spare (spa_t *spa) |
Check if a pool has an active shared spare device. | |
static int | spa_load_impl (spa_t *spa, uint64_t pool_guid, nvlist_t *config, spa_load_state_t state, spa_import_type_t type, boolean_t mosconfig, char **ereport) |
Load an existing storage pool, using the pool's builtin spa_config as a source of configuration information. | |
static void | spa_vdev_resilver_done (spa_t *spa) |
static void | spa_prop_add_list (nvlist_t *nvl, zpool_prop_t prop, char *strval, uint64_t intval, zprop_source_t src) |
Add a (source=src, propname=propval) list to an nvlist. | |
static void | spa_prop_get_config (spa_t *spa, nvlist_t **nvp) |
Get property values from the spa configuration. | |
int | spa_prop_get (spa_t *spa, nvlist_t **nvp) |
Get zpool property values. | |
static int | spa_prop_validate (spa_t *spa, nvlist_t *props) |
Validate the given pool properties nvlist and modify the list for the property values to be set. | |
void | spa_configfile_set (spa_t *spa, nvlist_t *nvp, boolean_t need_sync) |
int | spa_prop_set (spa_t *spa, nvlist_t *nvp) |
void | spa_prop_clear_bootfs (spa_t *spa, uint64_t dsobj, dmu_tx_t *tx) |
If the bootfs property value is dsobj, clear it. | |
static int | spa_change_guid_check (void *arg1, void *arg2, dmu_tx_t *tx) |
static void | spa_change_guid_sync (void *arg1, void *arg2, dmu_tx_t *tx) |
int | spa_change_guid (spa_t *spa) |
Change the GUID for the pool. | |
static int | spa_error_entry_compare (const void *a, const void *b) |
void | spa_get_errlists (spa_t *spa, avl_tree_t *last, avl_tree_t *scrub) |
Utility function which retrieves copies of the current logs and re-initializes them in the process. | |
static taskq_t * | spa_taskq_create (spa_t *spa, const char *name, enum zti_modes mode, uint_t value) |
static void | spa_create_zio_taskqs (spa_t *spa) |
static void | spa_activate (spa_t *spa, int mode) |
Activate an uninitialized pool. | |
static void | spa_deactivate (spa_t *spa) |
Opposite of spa_activate(). | |
static int | spa_config_parse (spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id, int atype) |
Verify a pool configuration, and construct the vdev tree appropriately. | |
static void | spa_unload (spa_t *spa) |
Opposite of spa_load(). | |
static void | spa_load_spares (spa_t *spa) |
Load (or re-load) the current list of vdevs describing the active spares for this pool. | |
static void | spa_load_l2cache (spa_t *spa) |
Load (or re-load) the current list of vdevs describing the active l2cache for this pool. | |
static int | load_nvlist (spa_t *spa, uint64_t obj, nvlist_t **value) |
static void | spa_check_removed (vdev_t *vd) |
Checks to see if the given vdev could not be opened, in which case we post a sysevent to notify the autoreplace code that the device has been removed. | |
static boolean_t | spa_config_valid (spa_t *spa, nvlist_t *config) |
Validate the current config against the MOS config. | |
static int | spa_check_logs (spa_t *spa) |
Check for missing log devices. | |
static boolean_t | spa_passivate_log (spa_t *spa) |
static void | spa_activate_log (spa_t *spa) |
int | spa_offline_log (spa_t *spa) |
static void | spa_aux_check_removed (spa_aux_vdev_t *sav) |
void | spa_claim_notify (zio_t *zio) |
Log claim callback. | |
static void | spa_load_verify_done (zio_t *zio) |
static int | spa_load_verify_cb (spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) |
static int | spa_load_verify (spa_t *spa) |
static void | spa_prop_find (spa_t *spa, zpool_prop_t prop, uint64_t *val) |
Find a value in the pool props object. | |
static int | spa_dir_prop (spa_t *spa, const char *name, uint64_t *val) |
Find a value in the pool directory object. | |
static int | spa_vdev_err (vdev_t *vdev, vdev_aux_t aux, int err) |
static void | spa_try_repair (spa_t *spa, nvlist_t *config) |
Fix up config after a partly-completed split. | |
static int | spa_load (spa_t *spa, spa_load_state_t state, spa_import_type_t type, boolean_t mosconfig) |
static int | spa_load_retry (spa_t *spa, spa_load_state_t state, int mosconfig) |
static int | spa_load_best (spa_t *spa, spa_load_state_t state, int mosconfig, uint64_t max_request, int rewind_flags) |
If spa_load() fails this function will try loading prior txg's. | |
static int | spa_open_common (const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy, nvlist_t **config) |
Pool Open/Import. | |
int | spa_open_rewind (const char *name, spa_t **spapp, void *tag, nvlist_t *policy, nvlist_t **config) |
int | spa_open (const char *name, spa_t **spapp, void *tag) |
spa_t * | spa_inject_addref (char *name) |
Increment a SPA's inject count. | |
void | spa_inject_delref (spa_t *spa) |
static void | spa_add_spares (spa_t *spa, nvlist_t *config) |
Add spares device information to the nvlist. | |
static void | spa_add_l2cache (spa_t *spa, nvlist_t *config) |
Add l2cache device information to the nvlist, including vdev stats. | |
static void | spa_add_feature_stats (spa_t *spa, nvlist_t *config) |
int | spa_get_stats (const char *name, nvlist_t **config, char *altroot, size_t buflen) |
static int | spa_validate_aux_devs (spa_t *spa, nvlist_t *nvroot, uint64_t crtxg, int mode, spa_aux_vdev_t *sav, const char *config, uint64_t version, vdev_labeltype_t label) |
Validate that the auxiliary device array is well formed. | |
static int | spa_validate_aux (spa_t *spa, nvlist_t *nvroot, uint64_t crtxg, int mode) |
static void | spa_set_aux_vdevs (spa_aux_vdev_t *sav, nvlist_t **devs, int ndevs, const char *config) |
void | spa_l2cache_drop (spa_t *spa) |
Stop and drop level 2 ARC devices. | |
int | spa_create (const char *pool, nvlist_t *nvroot, nvlist_t *props, const char *history_str, nvlist_t *zplprops) |
Pool Creation. | |
int | vdev_geom_read_pool_label (const char *name, nvlist_t **config) |
static nvlist_t * | spa_generate_rootconf (const char *name) |
int | spa_import_rootpool (const char *name) |
int | spa_import (const char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags) |
Import a non-root pool into the system. | |
nvlist_t * | spa_tryimport (nvlist_t *tryconfig) |
static int | spa_export_common (char *pool, int new_state, nvlist_t **oldconfig, boolean_t force, boolean_t hardforce) |
Pool export/destroy. | |
int | spa_destroy (char *pool) |
Destroy a storage pool. | |
int | spa_export (char *pool, nvlist_t **oldconfig, boolean_t force, boolean_t hardforce) |
Export a storage pool. | |
int | spa_reset (char *pool) |
Reset a storage pool. | |
int | spa_vdev_add (spa_t *spa, nvlist_t *nvroot) |
Add a device to a storage pool. | |
int | spa_vdev_attach (spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing) |
Attach a device to a mirror. | |
int | spa_vdev_detach (spa_t *spa, uint64_t guid, uint64_t pguid, int replace_done) |
Detach a device from a mirror or replacing vdev. | |
int | spa_vdev_split_mirror (spa_t *spa, char *newname, nvlist_t *config, nvlist_t *props, boolean_t exp) |
Split a set of devices from their mirrors, and create a new pool from them. | |
static nvlist_t * | spa_nvlist_lookup_by_guid (nvlist_t **nvpp, int count, uint64_t target_guid) |
static void | spa_vdev_remove_aux (nvlist_t *config, char *name, nvlist_t **dev, int count, nvlist_t *dev_to_remove) |
static int | spa_vdev_remove_evacuate (spa_t *spa, vdev_t *vd) |
Evacuate the device. | |
static void | spa_vdev_remove_from_namespace (spa_t *spa, vdev_t *vd) |
Complete the removal by cleaning up the namespace. | |
int | spa_vdev_remove (spa_t *spa, uint64_t guid, boolean_t unspare) |
Remove a device from the pool. | |
static vdev_t * | spa_vdev_resilver_done_hunt (vdev_t *vd) |
Find any device that's done replacing, or a vdev marked 'unspare' that's current spared, so we can detach it. | |
int | spa_vdev_set_common (spa_t *spa, uint64_t guid, const char *value, boolean_t ispath) |
Update the stored path or FRU for this vdev. | |
int | spa_vdev_setpath (spa_t *spa, uint64_t guid, const char *newpath) |
int | spa_vdev_setfru (spa_t *spa, uint64_t guid, const char *newfru) |
int | spa_scan_stop (spa_t *spa) |
int | spa_scan (spa_t *spa, pool_scan_func_t func) |
static void | spa_async_remove (spa_t *spa, vdev_t *vd) |
static void | spa_async_probe (spa_t *spa, vdev_t *vd) |
static void | spa_async_autoexpand (spa_t *spa, vdev_t *vd) |
static void | spa_async_thread (void *arg) |
void | spa_async_suspend (spa_t *spa) |
void | spa_async_resume (spa_t *spa) |
static int | spa_async_tasks_pending (spa_t *spa) |
static void | spa_async_dispatch (spa_t *spa) |
void | spa_async_request (spa_t *spa, int task) |
static int | bpobj_enqueue_cb (void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
static int | spa_free_sync_cb (void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
static void | spa_sync_nvlist (spa_t *spa, uint64_t obj, nvlist_t *nv, dmu_tx_t *tx) |
static void | spa_sync_aux_dev (spa_t *spa, spa_aux_vdev_t *sav, dmu_tx_t *tx, const char *config, const char *entry) |
static void | spa_sync_config_object (spa_t *spa, dmu_tx_t *tx) |
static void | spa_sync_version (void *arg1, void *arg2, dmu_tx_t *tx) |
static void | spa_sync_props (void *arg1, void *arg2, dmu_tx_t *tx) |
Set zpool properties. | |
static void | spa_sync_upgrades (spa_t *spa, dmu_tx_t *tx) |
Perform one-time upgrade on-disk changes. | |
void | spa_sync (spa_t *spa, uint64_t txg) |
Sync the specified transaction group. | |
void | spa_sync_allpools (void) |
Sync all pools. | |
void | spa_evict_all (void) |
Remove all pools in the system. | |
vdev_t * | spa_lookup_by_guid (spa_t *spa, uint64_t guid, boolean_t aux) |
void | spa_upgrade (spa_t *spa, uint64_t version) |
boolean_t | spa_has_spare (spa_t *spa, uint64_t guid) |
void | spa_event_notify (spa_t *spa, vdev_t *vd, const char *name) |
Post a sysevent corresponding to the given event. | |
Variables | |
int | check_hostid = 1 |
Check hostid on import? | |
int | zfs_ccw_retry_interval = 300 |
The interval at which failed configuration cache file writes should be retried. | |
static const char *const | zio_taskq_types [ZIO_TASKQ_TYPES] |
const zio_taskq_info_t | zio_taskqs [ZIO_TYPES][ZIO_TASKQ_TYPES] |
Define the taskq threads for the following I/O types: NULL, READ, WRITE, FREE, CLAIM, and IOCTL. | |
static dsl_syncfunc_t | spa_sync_version |
static dsl_syncfunc_t | spa_sync_props |
static dsl_checkfunc_t | spa_change_guid_check |
static dsl_syncfunc_t | spa_change_guid_sync |
uint_t | zio_taskq_batch_pct = 100 |
1 thread per cpu in pset | |
uint_t | zio_taskq_basedc = 80 |
base duty cycle | |
boolean_t | spa_create_process = B_TRUE |
no process ==> no sysdc |
Storage Pool Allocator.
This file contains all the routines used when modifying on-disk SPA state. This includes opening, importing, destroying, exporting a pool, and syncing a pool.
Definition in file spa.c.
#define TRYIMPORT_NAME "$import" |
typedef struct spa_load_error spa_load_error_t |
typedef struct zio_taskq_info zio_taskq_info_t |
typedef enum zti_modes zti_modes_t |
enum zti_modes |
static int load_nvlist | ( | spa_t * | spa, |
uint64_t | obj, | ||
nvlist_t ** | value | ||
) | [static] |
static void spa_activate | ( | spa_t * | spa, |
int | mode | ||
) | [static] |
static void spa_add_feature_stats | ( | spa_t * | spa, |
nvlist_t * | config | ||
) | [static] |
static void spa_add_l2cache | ( | spa_t * | spa, |
nvlist_t * | config | ||
) | [static] |
static void spa_add_spares | ( | spa_t * | spa, |
nvlist_t * | config | ||
) | [static] |
static void spa_aux_check_removed | ( | spa_aux_vdev_t * | sav | ) | [static] |
int spa_change_guid | ( | spa_t * | spa | ) |
Change the GUID for the pool.
This is done so that we can later re-import a pool built from a clone of our own vdevs. We will modify the root vdev's guid, our own pool guid, and then mark all of our vdevs dirty. Note that we must make sure that all our vdevs are online when we do this, or else any vdevs that weren't present would be orphaned from our pool. We are also going to issue a sysevent to update any watchers.
static int spa_change_guid_check | ( | void * | arg1, |
void * | arg2, | ||
dmu_tx_t * | tx | ||
) | [static] |
static void spa_change_guid_sync | ( | void * | arg1, |
void * | arg2, | ||
dmu_tx_t * | tx | ||
) | [static] |
static int spa_check_logs | ( | spa_t * | spa | ) | [static] |
static void spa_check_removed | ( | vdev_t * | vd | ) | [static] |
static int spa_config_parse | ( | spa_t * | spa, |
vdev_t ** | vdp, | ||
nvlist_t * | nv, | ||
vdev_t * | parent, | ||
uint_t | id, | ||
int | atype | ||
) | [static] |
Verify a pool configuration, and construct the vdev tree appropriately.
This will create all the necessary vdevs in the appropriate layout, with each vdev in the CLOSED state. This will prep the pool before open/creation/import. All vdev validation is done by the vdev_alloc() routine.
static boolean_t spa_config_valid | ( | spa_t * | spa, |
nvlist_t * | config | ||
) | [static] |
void spa_configfile_set | ( | spa_t * | spa, |
nvlist_t * | nvp, | ||
boolean_t | need_sync | ||
) |
int spa_create | ( | const char * | pool, |
nvlist_t * | nvroot, | ||
nvlist_t * | props, | ||
const char * | history_str, | ||
nvlist_t * | zplprops | ||
) |
static void spa_deactivate | ( | spa_t * | spa | ) | [static] |
Opposite of spa_activate().
static int spa_dir_prop | ( | spa_t * | spa, |
const char * | name, | ||
uint64_t * | val | ||
) | [static] |
static int spa_error_entry_compare | ( | const void * | a, |
const void * | b | ||
) | [static] |
Post a sysevent corresponding to the given event.
[in] | spa | Provides information for the event payload |
[in] | vd | Optional. If not null, provides informationfor the event payload |
[in] | name | must be one of the event definitions in sys/sysevent/eventdefs.h |
This doesn't do anything in the userland libzpool, as we don't want consumers to misinterpret ztest or zdb as real changes.
int spa_export | ( | char * | pool, |
nvlist_t ** | oldconfig, | ||
boolean_t | force, | ||
boolean_t | hardforce | ||
) |
static int spa_export_common | ( | char * | pool, |
int | new_state, | ||
nvlist_t ** | oldconfig, | ||
boolean_t | force, | ||
boolean_t | hardforce | ||
) | [static] |
Pool export/destroy.
The act of destroying or exporting a pool is very simple. We make sure there is no more pending I/O and any references to the pool are gone. Then, we update the pool state and sync all the labels to disk, removing the configuration from the cache afterwards. If the 'hardforce' flag is set, then we don't sync the labels or remove the configuration cache.
static nvlist_t* spa_generate_rootconf | ( | const char * | name | ) | [static] |
void spa_get_errlists | ( | spa_t * | spa, |
avl_tree_t * | last, | ||
avl_tree_t * | scrub | ||
) |
int spa_get_stats | ( | const char * | name, |
nvlist_t ** | config, | ||
char * | altroot, | ||
size_t | buflen | ||
) |
static boolean_t spa_has_active_shared_spare | ( | spa_t * | spa | ) | [static] |
int spa_import | ( | const char * | pool, |
nvlist_t * | config, | ||
nvlist_t * | props, | ||
uint64_t | flags | ||
) |
spa_t* spa_inject_addref | ( | char * | name | ) |
void spa_l2cache_drop | ( | spa_t * | spa | ) |
static int spa_load | ( | spa_t * | spa, |
spa_load_state_t | state, | ||
spa_import_type_t | type, | ||
boolean_t | mosconfig | ||
) | [static] |
static int spa_load_best | ( | spa_t * | spa, |
spa_load_state_t | state, | ||
int | mosconfig, | ||
uint64_t | max_request, | ||
int | rewind_flags | ||
) | [static] |
If spa_load() fails this function will try loading prior txg's.
If 'state' is SPA_LOAD_RECOVER and one of these loads succeeds the pool will be rewound to that txg. If 'state' is not SPA_LOAD_RECOVER this function will not rewind the pool and will return the same error as spa_load().
static int spa_load_impl | ( | spa_t * | spa, |
uint64_t | pool_guid, | ||
nvlist_t * | config, | ||
spa_load_state_t | state, | ||
spa_import_type_t | type, | ||
boolean_t | mosconfig, | ||
char ** | ereport | ||
) | [static] |
static void spa_load_l2cache | ( | spa_t * | spa | ) | [static] |
Load (or re-load) the current list of vdevs describing the active l2cache for this pool.
When this is called, we have some form of basic information in 'spa_l2cache.sav_config'. We parse this into vdevs, try to open them, and then re-generate a more complete list including status information. Devices which are already active have their details maintained, and are not re-opened.
static int spa_load_retry | ( | spa_t * | spa, |
spa_load_state_t | state, | ||
int | mosconfig | ||
) | [static] |
static void spa_load_spares | ( | spa_t * | spa | ) | [static] |
Load (or re-load) the current list of vdevs describing the active spares for this pool.
When this is called, we have some form of basic information in 'spa_spares.sav_config'. We parse this into vdevs, try to open them, and then re-generate a more complete list including status information.
static int spa_load_verify_cb | ( | spa_t * | spa, |
zilog_t * | zilog, | ||
const blkptr_t * | bp, | ||
arc_buf_t * | pbuf, | ||
const zbookmark_t * | zb, | ||
const dnode_phys_t * | dnp, | ||
void * | arg | ||
) | [static] |
static nvlist_t* spa_nvlist_lookup_by_guid | ( | nvlist_t ** | nvpp, |
int | count, | ||
uint64_t | target_guid | ||
) | [static] |
int spa_open | ( | const char * | name, |
spa_t ** | spapp, | ||
void * | tag | ||
) |
static int spa_open_common | ( | const char * | pool, |
spa_t ** | spapp, | ||
void * | tag, | ||
nvlist_t * | nvpolicy, | ||
nvlist_t ** | config | ||
) | [static] |
Pool Open/Import.
The import case is identical to an open except that the configuration is sent down from userland, instead of grabbed from the configuration cache. For the case of an open, the pool configuration will exist in the POOL_STATE_UNINITIALIZED state.
The stats information (gen/count/ustats) is used to gather vdev statistics at the same time open the pool, without having to keep around the spa_t in some ambiguous state.
int spa_open_rewind | ( | const char * | name, |
spa_t ** | spapp, | ||
void * | tag, | ||
nvlist_t * | policy, | ||
nvlist_t ** | config | ||
) |
static void spa_prop_add_list | ( | nvlist_t * | nvl, |
zpool_prop_t | prop, | ||
char * | strval, | ||
uint64_t | intval, | ||
zprop_source_t | src | ||
) | [static] |
static void spa_prop_find | ( | spa_t * | spa, |
zpool_prop_t | prop, | ||
uint64_t * | val | ||
) | [static] |
int spa_prop_get | ( | spa_t * | spa, |
nvlist_t ** | nvp | ||
) |
static void spa_prop_get_config | ( | spa_t * | spa, |
nvlist_t ** | nvp | ||
) | [static] |
static int spa_prop_validate | ( | spa_t * | spa, |
nvlist_t * | props | ||
) | [static] |
int spa_reset | ( | char * | pool | ) |
Reset a storage pool.
Similar to spa_export(), this unloads the spa_t without actually removing it from the namespace in any way.
static void spa_set_aux_vdevs | ( | spa_aux_vdev_t * | sav, |
nvlist_t ** | devs, | ||
int | ndevs, | ||
const char * | config | ||
) | [static] |
void spa_sync | ( | spa_t * | spa, |
uint64_t | txg | ||
) |
void spa_sync_allpools | ( | void | ) |
static void spa_sync_aux_dev | ( | spa_t * | spa, |
spa_aux_vdev_t * | sav, | ||
dmu_tx_t * | tx, | ||
const char * | config, | ||
const char * | entry | ||
) | [static] |
static void spa_sync_props | ( | void * | arg1, |
void * | arg2, | ||
dmu_tx_t * | tx | ||
) | [static] |
Perform one-time upgrade on-disk changes.
spa_version() does not reflect the new version this txg, so there must be no changes this txg to anything that the upgrade code depends on after it executes. Therefore this must be called after dsl_pool_sync() does the sync tasks.
static void spa_sync_version | ( | void * | arg1, |
void * | arg2, | ||
dmu_tx_t * | tx | ||
) | [static] |
static void spa_try_repair | ( | spa_t * | spa, |
nvlist_t * | config | ||
) | [static] |
Fix up config after a partly-completed split.
This is done with the ZPOOL_CONFIG_SPLIT nvlist. Both the splitting pool and the split-off pool have that entry in their config, but only the splitting one contains a list of all the guids of the vdevs that are being split off.
This function determines what to do with that list: either rejoin all the disks to the pool, or complete the splitting process. To attempt the rejoin, each disk that is offlined is marked online again, and we do a reopen() call. If the vdev label for every disk that was marked online indicates it was successfully split off (VDEV_AUX_SPLIT_POOL) then we call vdev_split() on each disk, and complete the split.
Otherwise we leave the config alone, with all the vdevs in place in the original pool.
static void spa_unload | ( | spa_t * | spa | ) | [static] |
Opposite of spa_load().
static int spa_validate_aux | ( | spa_t * | spa, |
nvlist_t * | nvroot, | ||
uint64_t | crtxg, | ||
int | mode | ||
) | [static] |
static int spa_validate_aux_devs | ( | spa_t * | spa, |
nvlist_t * | nvroot, | ||
uint64_t | crtxg, | ||
int | mode, | ||
spa_aux_vdev_t * | sav, | ||
const char * | config, | ||
uint64_t | version, | ||
vdev_labeltype_t | label | ||
) | [static] |
int spa_vdev_add | ( | spa_t * | spa, |
nvlist_t * | nvroot | ||
) |
int spa_vdev_attach | ( | spa_t * | spa, |
uint64_t | guid, | ||
nvlist_t * | nvroot, | ||
int | replacing | ||
) |
Attach a device to a mirror.
The arguments are the path to any device in the mirror, and the nvroot for the new device. If the path specifies a device that is not mirrored, we automatically insert the mirror vdev.
If 'replacing' is specified, the new device is intended to replace the existing device; in this case the two devices are made into their own mirror using the 'replacing' vdev, which is functionally identical to the mirror vdev (it actually reuses all the same ops) but has a few extra rules: you can't attach to it after it's been created, and upon completion of resilvering, the first disk (the one being replaced) is automatically detached.
int spa_vdev_detach | ( | spa_t * | spa, |
uint64_t | guid, | ||
uint64_t | pguid, | ||
int | replace_done | ||
) |
static int spa_vdev_err | ( | vdev_t * | vdev, |
vdev_aux_t | aux, | ||
int | err | ||
) | [static] |
int spa_vdev_remove | ( | spa_t * | spa, |
uint64_t | guid, | ||
boolean_t | unspare | ||
) |
Remove a device from the pool.
Removing a device from the vdev namespace requires several steps and can take a significant amount of time. As a result we use the spa_vdev_config_[enter/exit] functions which allow us to grab and release the spa_config_lock while still holding the namespace lock. During each step the configuration is synced out.
Currently, this supports removing only hot spares, slogs, and level 2 ARC devices.
static void spa_vdev_remove_aux | ( | nvlist_t * | config, |
char * | name, | ||
nvlist_t ** | dev, | ||
int | count, | ||
nvlist_t * | dev_to_remove | ||
) | [static] |
int spa_vdev_set_common | ( | spa_t * | spa, |
uint64_t | guid, | ||
const char * | value, | ||
boolean_t | ispath | ||
) |
int spa_vdev_setfru | ( | spa_t * | spa, |
uint64_t | guid, | ||
const char * | newfru | ||
) |
int spa_vdev_setpath | ( | spa_t * | spa, |
uint64_t | guid, | ||
const char * | newpath | ||
) |
int spa_vdev_split_mirror | ( | spa_t * | spa, |
char * | newname, | ||
nvlist_t * | config, | ||
nvlist_t * | props, | ||
boolean_t | exp | ||
) |
SYSCTL_DECL | ( | _vfs_zfs | ) |
SYSCTL_INT | ( | _vfs_zfs | , |
OID_AUTO | , | ||
check_hostid | , | ||
CTLFLAG_RW | , | ||
& | check_hostid, | ||
0 | , | ||
"Check hostid on import?" | |||
) |
SYSCTL_INT | ( | _vfs_zfs | , |
OID_AUTO | , | ||
ccw_retry_interval | , | ||
CTLFLAG_RW | , | ||
& | zfs_ccw_retry_interval, | ||
0 | , | ||
"Configuration cache file | write, | ||
retry after | failure, | ||
interval(seconds)" | |||
) |
TUNABLE_INT | ( | "vfs.zfs.ccw_retry_interval" | , |
& | zfs_ccw_retry_interval | ||
) |
TUNABLE_INT | ( | "vfs.zfs.check_hostid" | , |
& | check_hostid | ||
) |
int vdev_geom_read_pool_label | ( | const char * | name, |
nvlist_t ** | config | ||
) |
Definition at line 448 of file vdev_geom.c.
dsl_checkfunc_t spa_change_guid_check [static] |
dsl_syncfunc_t spa_change_guid_sync [static] |
boolean_t spa_create_process = B_TRUE |
dsl_syncfunc_t spa_sync_props [static] |
dsl_syncfunc_t spa_sync_version [static] |
uint_t zio_taskq_basedc = 80 |
uint_t zio_taskq_batch_pct = 100 |
const char* const zio_taskq_types[ZIO_TASKQ_TYPES] [static] |
const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] |
{ { 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_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, { ZTI_ONE, ZTI_NULL, ZTI_ONE, ZTI_NULL }, }
Define the taskq threads for the following I/O types: NULL, READ, WRITE, FREE, CLAIM, and IOCTL.