diff options
author | Brian Behlendorf <[email protected]> | 2009-01-15 13:59:39 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2009-01-15 13:59:39 -0800 |
commit | fb5f0bc83330c8a0236c4d34a23723ac1974971a (patch) | |
tree | 51880dcfa8ec9e8e80b8c44e9ffc55a4b7160216 /module/zfs/include/sys | |
parent | 42bcb36c8987b0b11411ce6cf8339694b624a17c (diff) |
Rebase master to b105
Diffstat (limited to 'module/zfs/include/sys')
-rw-r--r-- | module/zfs/include/sys/spa.h | 10 | ||||
-rw-r--r-- | module/zfs/include/sys/spa_impl.h | 1 | ||||
-rw-r--r-- | module/zfs/include/sys/space_map.h | 24 | ||||
-rw-r--r-- | module/zfs/include/sys/uberblock_impl.h | 9 | ||||
-rw-r--r-- | module/zfs/include/sys/vdev.h | 16 | ||||
-rw-r--r-- | module/zfs/include/sys/vdev_impl.h | 5 | ||||
-rw-r--r-- | module/zfs/include/sys/zfs_vfsops.h | 4 | ||||
-rw-r--r-- | module/zfs/include/sys/zil.h | 6 | ||||
-rw-r--r-- | module/zfs/include/sys/zil_impl.h | 9 | ||||
-rw-r--r-- | module/zfs/include/sys/zio.h | 15 |
10 files changed, 68 insertions, 31 deletions
diff --git a/module/zfs/include/sys/spa.h b/module/zfs/include/sys/spa.h index 24b3ca447..519b1d0c0 100644 --- a/module/zfs/include/sys/spa.h +++ b/module/zfs/include/sys/spa.h @@ -332,7 +332,8 @@ extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props); extern int spa_import_faulted(const char *, nvlist_t *, nvlist_t *); extern nvlist_t *spa_tryimport(nvlist_t *tryconfig); extern int spa_destroy(char *pool); -extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force); +extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force, + boolean_t hardforce); extern int spa_reset(char *pool); extern void spa_async_request(spa_t *spa, int flag); extern void spa_async_unrequest(spa_t *spa, int flag); @@ -351,7 +352,8 @@ extern void spa_inject_delref(spa_t *spa); extern int spa_vdev_add(spa_t *spa, nvlist_t *nvroot); extern int spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing); -extern int spa_vdev_detach(spa_t *spa, uint64_t guid, int replace_done); +extern int spa_vdev_detach(spa_t *spa, uint64_t guid, uint64_t pguid, + int replace_done); extern int spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare); extern int spa_vdev_setpath(spa_t *spa, uint64_t guid, const char *newpath); @@ -475,6 +477,8 @@ extern boolean_t spa_has_spare(spa_t *, uint64_t guid); extern uint64_t bp_get_dasize(spa_t *spa, const blkptr_t *bp); extern boolean_t spa_has_slogs(spa_t *spa); extern boolean_t spa_is_root(spa_t *spa); +extern boolean_t spa_writeable(spa_t *spa); +extern int spa_mode(spa_t *spa); /* history logging */ typedef enum history_log_type { @@ -545,7 +549,7 @@ _NOTE(CONSTCOND) } while (0) #define dprintf_bp(bp, fmt, ...) #endif -extern int spa_mode; /* mode, e.g. FREAD | FWRITE */ +extern int spa_mode_global; /* mode, e.g. FREAD | FWRITE */ #ifdef __cplusplus } diff --git a/module/zfs/include/sys/spa_impl.h b/module/zfs/include/sys/spa_impl.h index 8aeb414fe..588b4f5a9 100644 --- a/module/zfs/include/sys/spa_impl.h +++ b/module/zfs/include/sys/spa_impl.h @@ -170,6 +170,7 @@ struct spa { boolean_t spa_import_faulted; /* allow faulted vdevs */ boolean_t spa_is_root; /* pool is root */ int spa_minref; /* num refs when first opened */ + int spa_mode; /* FREAD | FWRITE */ spa_log_state_t spa_log_state; /* log state */ /* * spa_refcnt & spa_config_lock must be the last elements diff --git a/module/zfs/include/sys/space_map.h b/module/zfs/include/sys/space_map.h index db9daef1f..8d7860660 100644 --- a/module/zfs/include/sys/space_map.h +++ b/module/zfs/include/sys/space_map.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_SPACE_MAP_H #define _SYS_SPACE_MAP_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/avl.h> #include <sys/dmu.h> @@ -58,6 +56,12 @@ typedef struct space_seg { uint64_t ss_end; /* ending offset (non-inclusive) */ } space_seg_t; +typedef struct space_ref { + avl_node_t sr_node; /* AVL node */ + uint64_t sr_offset; /* offset (start or end) */ + int64_t sr_refcnt; /* associated reference count */ +} space_ref_t; + typedef struct space_map_obj { uint64_t smo_object; /* on-disk space map object */ uint64_t smo_objsize; /* size of the object */ @@ -133,13 +137,12 @@ extern void space_map_create(space_map_t *sm, uint64_t start, uint64_t size, extern void space_map_destroy(space_map_t *sm); extern void space_map_add(space_map_t *sm, uint64_t start, uint64_t size); extern void space_map_remove(space_map_t *sm, uint64_t start, uint64_t size); -extern int space_map_contains(space_map_t *sm, uint64_t start, uint64_t size); +extern boolean_t space_map_contains(space_map_t *sm, + uint64_t start, uint64_t size); extern void space_map_vacate(space_map_t *sm, space_map_func_t *func, space_map_t *mdest); extern void space_map_walk(space_map_t *sm, space_map_func_t *func, space_map_t *mdest); -extern void space_map_excise(space_map_t *sm, uint64_t start, uint64_t size); -extern void space_map_union(space_map_t *smd, space_map_t *sms); extern void space_map_load_wait(space_map_t *sm); extern int space_map_load(space_map_t *sm, space_map_ops_t *ops, @@ -155,6 +158,15 @@ extern void space_map_sync(space_map_t *sm, uint8_t maptype, extern void space_map_truncate(space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx); +extern void space_map_ref_create(avl_tree_t *t); +extern void space_map_ref_destroy(avl_tree_t *t); +extern void space_map_ref_add_seg(avl_tree_t *t, + uint64_t start, uint64_t end, int64_t refcnt); +extern void space_map_ref_add_map(avl_tree_t *t, + space_map_t *sm, int64_t refcnt); +extern void space_map_ref_generate_map(avl_tree_t *t, + space_map_t *sm, int64_t minref); + #ifdef __cplusplus } #endif diff --git a/module/zfs/include/sys/uberblock_impl.h b/module/zfs/include/sys/uberblock_impl.h index 55a0dd5ae..b49df8ae0 100644 --- a/module/zfs/include/sys/uberblock_impl.h +++ b/module/zfs/include/sys/uberblock_impl.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_UBERBLOCK_IMPL_H #define _SYS_UBERBLOCK_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/uberblock.h> #ifdef __cplusplus @@ -35,6 +33,11 @@ extern "C" { #endif /* + * For zdb use and debugging purposes only + */ +extern uint64_t ub_max_txg; + +/* * The uberblock version is incremented whenever an incompatible on-disk * format change is made to the SPA, DMU, or ZAP. * diff --git a/module/zfs/include/sys/vdev.h b/module/zfs/include/sys/vdev.h index c070d6f3d..b8313a920 100644 --- a/module/zfs/include/sys/vdev.h +++ b/module/zfs/include/sys/vdev.h @@ -36,6 +36,14 @@ extern "C" { #endif +typedef enum vdev_dtl_type { + DTL_MISSING, /* 0% replication: no copies of the data */ + DTL_PARTIAL, /* less than 100% replication: some copies missing */ + DTL_SCRUB, /* unable to fully repair during scrub/resilver */ + DTL_OUTAGE, /* temporarily missing (used to attempt detach) */ + DTL_TYPES +} vdev_dtl_type_t; + extern boolean_t zfs_nocacheflush; extern int vdev_open(vdev_t *); @@ -50,10 +58,14 @@ extern zio_t *vdev_probe(vdev_t *vd, zio_t *pio); extern boolean_t vdev_is_bootable(vdev_t *vd); extern vdev_t *vdev_lookup_top(spa_t *spa, uint64_t vdev); extern vdev_t *vdev_lookup_by_guid(vdev_t *vd, uint64_t guid); -extern void vdev_dtl_dirty(space_map_t *sm, uint64_t txg, uint64_t size); -extern int vdev_dtl_contains(space_map_t *sm, uint64_t txg, uint64_t size); +extern void vdev_dtl_dirty(vdev_t *vd, vdev_dtl_type_t d, + uint64_t txg, uint64_t size); +extern boolean_t vdev_dtl_contains(vdev_t *vd, vdev_dtl_type_t d, + uint64_t txg, uint64_t size); +extern boolean_t vdev_dtl_empty(vdev_t *vd, vdev_dtl_type_t d); extern void vdev_dtl_reassess(vdev_t *vd, uint64_t txg, uint64_t scrub_txg, int scrub_done); +extern boolean_t vdev_dtl_required(vdev_t *vd); extern boolean_t vdev_resilver_needed(vdev_t *vd, uint64_t *minp, uint64_t *maxp); diff --git a/module/zfs/include/sys/vdev_impl.h b/module/zfs/include/sys/vdev_impl.h index 26904d089..652349341 100644 --- a/module/zfs/include/sys/vdev_impl.h +++ b/module/zfs/include/sys/vdev_impl.h @@ -123,8 +123,7 @@ struct vdev { vdev_t *vdev_parent; /* parent vdev */ vdev_t **vdev_child; /* array of children */ uint64_t vdev_children; /* number of children */ - space_map_t vdev_dtl_map; /* dirty time log in-core state */ - space_map_t vdev_dtl_scrub; /* DTL for scrub repair writes */ + space_map_t vdev_dtl[DTL_TYPES]; /* in-core dirty time logs */ vdev_stat_t vdev_stat; /* virtual device statistics */ /* @@ -149,7 +148,7 @@ struct vdev { * Leaf vdev state. */ uint64_t vdev_psize; /* physical device capacity */ - space_map_obj_t vdev_dtl; /* dirty time log on-disk state */ + space_map_obj_t vdev_dtl_smo; /* dirty time log space map obj */ txg_node_t vdev_dtl_node; /* per-txg dirty DTL linkage */ uint64_t vdev_wholedisk; /* true if this is a whole disk */ uint64_t vdev_offline; /* persistent offline state */ diff --git a/module/zfs/include/sys/zfs_vfsops.h b/module/zfs/include/sys/zfs_vfsops.h index 87b75e6e7..7e0440be4 100644 --- a/module/zfs/include/sys/zfs_vfsops.h +++ b/module/zfs/include/sys/zfs_vfsops.h @@ -26,8 +26,6 @@ #ifndef _SYS_FS_ZFS_VFSOPS_H #define _SYS_FS_ZFS_VFSOPS_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/isa_defs.h> #include <sys/types32.h> #include <sys/list.h> @@ -49,7 +47,6 @@ struct zfsvfs { uint64_t z_root; /* id of root znode */ uint64_t z_unlinkedobj; /* id of unlinked zapobj */ uint64_t z_max_blksz; /* maximum block size for files */ - uint64_t z_assign; /* TXG_NOWAIT or set by zil_replay() */ uint64_t z_fuid_obj; /* fuid table object number */ uint64_t z_fuid_size; /* fuid table size */ avl_tree_t z_fuid_idx; /* fuid tree keyed by index */ @@ -74,6 +71,7 @@ struct zfsvfs { boolean_t z_issnap; /* true if this is a snapshot */ boolean_t z_vscan; /* virus scan on/off */ boolean_t z_use_fuids; /* version allows fuids */ + boolean_t z_replay; /* set during ZIL replay */ kmutex_t z_online_recv_lock; /* recv in prog grabs as WRITER */ uint64_t z_version; /* ZPL version */ #define ZFS_OBJ_MTX_SZ 64 diff --git a/module/zfs/include/sys/zil.h b/module/zfs/include/sys/zil.h index 4d02d14f7..b69323cfa 100644 --- a/module/zfs/include/sys/zil.h +++ b/module/zfs/include/sys/zil.h @@ -335,7 +335,6 @@ typedef void zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg, typedef void zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg, uint64_t txg); typedef int zil_replay_func_t(); -typedef void zil_replay_cleaner_t(); typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio); extern uint64_t zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func, @@ -350,9 +349,8 @@ extern void zil_free(zilog_t *zilog); extern zilog_t *zil_open(objset_t *os, zil_get_data_t *get_data); extern void zil_close(zilog_t *zilog); -extern void zil_replay(objset_t *os, void *arg, uint64_t *txgp, - zil_replay_func_t *replay_func[TX_MAX_TYPE], - zil_replay_cleaner_t *replay_cleaner); +extern void zil_replay(objset_t *os, void *arg, + zil_replay_func_t *replay_func[TX_MAX_TYPE]); extern void zil_destroy(zilog_t *zilog, boolean_t keep_first); extern void zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx); diff --git a/module/zfs/include/sys/zil_impl.h b/module/zfs/include/sys/zil_impl.h index 0fc800b96..3f2582931 100644 --- a/module/zfs/include/sys/zil_impl.h +++ b/module/zfs/include/sys/zil_impl.h @@ -19,15 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _SYS_ZIL_IMPL_H #define _SYS_ZIL_IMPL_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/zil.h> #include <sys/dmu_objset.h> @@ -74,13 +72,14 @@ struct zilog { uint64_t zl_commit_seq; /* committed upto this number */ uint64_t zl_lr_seq; /* log record sequence number */ uint64_t zl_destroy_txg; /* txg of last zil_destroy() */ - uint64_t zl_replay_seq[TXG_SIZE]; /* seq of last replayed rec */ + uint64_t zl_replayed_seq[TXG_SIZE]; /* last replayed rec seq */ + uint64_t zl_replaying_seq; /* current replay seq number */ uint32_t zl_suspend; /* log suspend count */ kcondvar_t zl_cv_writer; /* log writer thread completion */ kcondvar_t zl_cv_suspend; /* log suspend completion */ uint8_t zl_suspending; /* log is currently suspending */ uint8_t zl_keep_first; /* keep first log block in destroy */ - uint8_t zl_stop_replay; /* don't replay any further */ + uint8_t zl_replay; /* replaying records while set */ uint8_t zl_stop_sync; /* for debugging */ uint8_t zl_writer; /* boolean: write setup in progress */ uint8_t zl_log_error; /* boolean: log write error */ diff --git a/module/zfs/include/sys/zio.h b/module/zfs/include/sys/zio.h index 4de78dfee..21b0fbc6b 100644 --- a/module/zfs/include/sys/zio.h +++ b/module/zfs/include/sys/zio.h @@ -132,12 +132,14 @@ enum zio_compress { #define ZIO_FLAG_IO_RETRY 0x00400 #define ZIO_FLAG_IO_REWRITE 0x00800 -#define ZIO_FLAG_PROBE 0x01000 +#define ZIO_FLAG_SELF_HEAL 0x01000 #define ZIO_FLAG_RESILVER 0x02000 #define ZIO_FLAG_SCRUB 0x04000 #define ZIO_FLAG_SCRUB_THREAD 0x08000 -#define ZIO_FLAG_GANG_CHILD 0x10000 +#define ZIO_FLAG_PROBE 0x10000 +#define ZIO_FLAG_GANG_CHILD 0x20000 +#define ZIO_FLAG_RAW 0x40000 #define ZIO_FLAG_GANG_INHERIT \ (ZIO_FLAG_CANFAIL | \ @@ -146,6 +148,7 @@ enum zio_compress { ZIO_FLAG_DONT_RETRY | \ ZIO_FLAG_DONT_CACHE | \ ZIO_FLAG_DONT_AGGREGATE | \ + ZIO_FLAG_SELF_HEAL | \ ZIO_FLAG_RESILVER | \ ZIO_FLAG_SCRUB | \ ZIO_FLAG_SCRUB_THREAD) @@ -156,6 +159,14 @@ enum zio_compress { ZIO_FLAG_IO_RETRY | \ ZIO_FLAG_PROBE) +#define ZIO_FLAG_AGG_INHERIT \ + (ZIO_FLAG_DONT_AGGREGATE | \ + ZIO_FLAG_IO_REPAIR | \ + ZIO_FLAG_SELF_HEAL | \ + ZIO_FLAG_RESILVER | \ + ZIO_FLAG_SCRUB | \ + ZIO_FLAG_SCRUB_THREAD) + #define ZIO_PIPELINE_CONTINUE 0x100 #define ZIO_PIPELINE_STOP 0x101 |