mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Update to onnv_147
This is the last official OpenSolaris tag before the public development tree was closed.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <sys/arc.h>
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/refcount.h>
|
||||
#include <sys/zrlock.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -82,9 +83,6 @@ struct dmu_tx;
|
||||
* etc.
|
||||
*/
|
||||
|
||||
#define LIST_LINK_INACTIVE(link) \
|
||||
((link)->list_next == NULL && (link)->list_prev == NULL)
|
||||
|
||||
struct dmu_buf_impl;
|
||||
|
||||
typedef enum override_states {
|
||||
@@ -149,15 +147,17 @@ typedef struct dmu_buf_impl {
|
||||
struct objset *db_objset;
|
||||
|
||||
/*
|
||||
* the dnode we belong to (NULL when evicted)
|
||||
* handle to safely access the dnode we belong to (NULL when evicted)
|
||||
*/
|
||||
struct dnode *db_dnode;
|
||||
struct dnode_handle *db_dnode_handle;
|
||||
|
||||
/*
|
||||
* our parent buffer; if the dnode points to us directly,
|
||||
* db_parent == db_dnode->dn_dbuf
|
||||
* db_parent == db_dnode_handle->dnh_dnode->dn_dbuf
|
||||
* only accessed by sync thread ???
|
||||
* (NULL when evicted)
|
||||
* May change from NULL to non-NULL under the protection of db_mtx
|
||||
* (see dbuf_check_blkptr())
|
||||
*/
|
||||
struct dmu_buf_impl *db_parent;
|
||||
|
||||
@@ -284,24 +284,46 @@ void dbuf_free_range(struct dnode *dn, uint64_t start, uint64_t end,
|
||||
|
||||
void dbuf_new_size(dmu_buf_impl_t *db, int size, dmu_tx_t *tx);
|
||||
|
||||
#define DB_DNODE(_db) ((_db)->db_dnode_handle->dnh_dnode)
|
||||
#define DB_DNODE_LOCK(_db) ((_db)->db_dnode_handle->dnh_zrlock)
|
||||
#define DB_DNODE_ENTER(_db) (zrl_add(&DB_DNODE_LOCK(_db)))
|
||||
#define DB_DNODE_EXIT(_db) (zrl_remove(&DB_DNODE_LOCK(_db)))
|
||||
#define DB_DNODE_HELD(_db) (!zrl_is_zero(&DB_DNODE_LOCK(_db)))
|
||||
#define DB_GET_SPA(_spa_p, _db) { \
|
||||
dnode_t *__dn; \
|
||||
DB_DNODE_ENTER(_db); \
|
||||
__dn = DB_DNODE(_db); \
|
||||
*(_spa_p) = __dn->dn_objset->os_spa; \
|
||||
DB_DNODE_EXIT(_db); \
|
||||
}
|
||||
#define DB_GET_OBJSET(_os_p, _db) { \
|
||||
dnode_t *__dn; \
|
||||
DB_DNODE_ENTER(_db); \
|
||||
__dn = DB_DNODE(_db); \
|
||||
*(_os_p) = __dn->dn_objset; \
|
||||
DB_DNODE_EXIT(_db); \
|
||||
}
|
||||
|
||||
void dbuf_init(void);
|
||||
void dbuf_fini(void);
|
||||
|
||||
#define DBUF_IS_METADATA(db) \
|
||||
((db)->db_level > 0 || dmu_ot[(db)->db_dnode->dn_type].ot_metadata)
|
||||
boolean_t dbuf_is_metadata(dmu_buf_impl_t *db);
|
||||
|
||||
#define DBUF_GET_BUFC_TYPE(db) \
|
||||
(DBUF_IS_METADATA(db) ? ARC_BUFC_METADATA : ARC_BUFC_DATA)
|
||||
#define DBUF_IS_METADATA(_db) \
|
||||
(dbuf_is_metadata(_db))
|
||||
|
||||
#define DBUF_IS_CACHEABLE(db) \
|
||||
((db)->db_objset->os_primary_cache == ZFS_CACHE_ALL || \
|
||||
(DBUF_IS_METADATA(db) && \
|
||||
((db)->db_objset->os_primary_cache == ZFS_CACHE_METADATA)))
|
||||
#define DBUF_GET_BUFC_TYPE(_db) \
|
||||
(DBUF_IS_METADATA(_db) ? ARC_BUFC_METADATA : ARC_BUFC_DATA)
|
||||
|
||||
#define DBUF_IS_L2CACHEABLE(db) \
|
||||
((db)->db_objset->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
(DBUF_IS_METADATA(db) && \
|
||||
((db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
|
||||
#define DBUF_IS_CACHEABLE(_db) \
|
||||
((_db)->db_objset->os_primary_cache == ZFS_CACHE_ALL || \
|
||||
(DBUF_IS_METADATA(_db) && \
|
||||
((_db)->db_objset->os_primary_cache == ZFS_CACHE_METADATA)))
|
||||
|
||||
#define DBUF_IS_L2CACHEABLE(_db) \
|
||||
((_db)->db_objset->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
(DBUF_IS_METADATA(_db) && \
|
||||
((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA)))
|
||||
|
||||
#ifdef ZFS_DEBUG
|
||||
|
||||
@@ -332,7 +354,7 @@ _NOTE(CONSTCOND) } while (0)
|
||||
sprintf_blkptr(__blkbuf, bp); \
|
||||
dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf); \
|
||||
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
|
||||
} \
|
||||
} \
|
||||
_NOTE(CONSTCOND) } while (0)
|
||||
|
||||
#define DBUF_VERIFY(db) dbuf_verify(db)
|
||||
|
||||
@@ -192,8 +192,8 @@ int dmu_objset_clone(const char *name, struct dsl_dataset *clone_origin,
|
||||
uint64_t flags);
|
||||
int dmu_objset_destroy(const char *name, boolean_t defer);
|
||||
int dmu_snapshots_destroy(char *fsname, char *snapname, boolean_t defer);
|
||||
int dmu_objset_snapshot(char *fsname, char *snapname, struct nvlist *props,
|
||||
boolean_t recursive);
|
||||
int dmu_objset_snapshot(char *fsname, char *snapname, char *tag,
|
||||
struct nvlist *props, boolean_t recursive, boolean_t temporary, int fd);
|
||||
int dmu_objset_rename(const char *name, const char *newname,
|
||||
boolean_t recursive);
|
||||
int dmu_objset_find(char *name, int func(const char *, void *), void *arg,
|
||||
@@ -335,6 +335,7 @@ int dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **);
|
||||
int dmu_bonus_max(void);
|
||||
int dmu_set_bonus(dmu_buf_t *, int, dmu_tx_t *);
|
||||
int dmu_set_bonustype(dmu_buf_t *, dmu_object_type_t, dmu_tx_t *);
|
||||
dmu_object_type_t dmu_get_bonustype(dmu_buf_t *);
|
||||
int dmu_rm_spill(objset_t *, uint64_t, dmu_tx_t *);
|
||||
|
||||
/*
|
||||
@@ -721,9 +722,13 @@ typedef struct dmu_recv_cookie {
|
||||
|
||||
int dmu_recv_begin(char *tofs, char *tosnap, char *topds, struct drr_begin *,
|
||||
boolean_t force, objset_t *origin, dmu_recv_cookie_t *);
|
||||
int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp);
|
||||
int dmu_recv_stream(dmu_recv_cookie_t *drc, struct vnode *vp, offset_t *voffp,
|
||||
int cleanup_fd, uint64_t *action_handlep);
|
||||
int dmu_recv_end(dmu_recv_cookie_t *drc);
|
||||
|
||||
int dmu_diff(objset_t *tosnap, objset_t *fromsnap, struct vnode *vp,
|
||||
offset_t *off);
|
||||
|
||||
/* CRC64 table */
|
||||
#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */
|
||||
extern uint64_t zfs_crc64_table[256];
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern krwlock_t os_lock;
|
||||
|
||||
struct dsl_dataset;
|
||||
struct dmu_tx;
|
||||
|
||||
@@ -68,9 +70,15 @@ struct objset {
|
||||
spa_t *os_spa;
|
||||
arc_buf_t *os_phys_buf;
|
||||
objset_phys_t *os_phys;
|
||||
dnode_t *os_meta_dnode;
|
||||
dnode_t *os_userused_dnode;
|
||||
dnode_t *os_groupused_dnode;
|
||||
/*
|
||||
* The following "special" dnodes have no parent and are exempt from
|
||||
* dnode_move(), but they root their descendents in this objset using
|
||||
* handles anyway, so that all access to dnodes from dbufs consistently
|
||||
* uses handles.
|
||||
*/
|
||||
dnode_handle_t os_meta_dnode;
|
||||
dnode_handle_t os_userused_dnode;
|
||||
dnode_handle_t os_groupused_dnode;
|
||||
zilog_t *os_zil;
|
||||
|
||||
/* can change, under dsl_dir's locks: */
|
||||
@@ -113,6 +121,9 @@ struct objset {
|
||||
#define DMU_META_OBJSET 0
|
||||
#define DMU_META_DNODE_OBJECT 0
|
||||
#define DMU_OBJECT_IS_SPECIAL(obj) ((int64_t)(obj) <= 0)
|
||||
#define DMU_META_DNODE(os) ((os)->os_meta_dnode.dnh_dnode)
|
||||
#define DMU_USERUSED_DNODE(os) ((os)->os_userused_dnode.dnh_dnode)
|
||||
#define DMU_GROUPUSED_DNODE(os) ((os)->os_groupused_dnode.dnh_dnode)
|
||||
|
||||
#define DMU_OS_IS_L2CACHEABLE(os) \
|
||||
((os)->os_secondary_cache == ZFS_CACHE_ALL || \
|
||||
@@ -131,8 +142,8 @@ int dmu_objset_create(const char *name, dmu_objset_type_t type, uint64_t flags,
|
||||
int dmu_objset_clone(const char *name, struct dsl_dataset *clone_origin,
|
||||
uint64_t flags);
|
||||
int dmu_objset_destroy(const char *name, boolean_t defer);
|
||||
int dmu_objset_snapshot(char *fsname, char *snapname, nvlist_t *props,
|
||||
boolean_t recursive);
|
||||
int dmu_objset_snapshot(char *fsname, char *snapname, char *tag,
|
||||
struct nvlist *props, boolean_t recursive, boolean_t temporary, int fd);
|
||||
void dmu_objset_stats(objset_t *os, nvlist_t *nv);
|
||||
void dmu_objset_fast_stat(objset_t *os, dmu_objset_stats_t *stat);
|
||||
void dmu_objset_space(objset_t *os, uint64_t *refdbytesp, uint64_t *availbytesp,
|
||||
@@ -150,6 +161,7 @@ timestruc_t dmu_objset_snap_cmtime(objset_t *os);
|
||||
/* called from dsl */
|
||||
void dmu_objset_sync(objset_t *os, zio_t *zio, dmu_tx_t *tx);
|
||||
boolean_t dmu_objset_is_dirty(objset_t *os, uint64_t txg);
|
||||
boolean_t dmu_objset_is_dirty_anywhere(objset_t *os);
|
||||
objset_t *dmu_objset_create_impl(spa_t *spa, struct dsl_dataset *ds,
|
||||
blkptr_t *bp, dmu_objset_type_t type, dmu_tx_t *tx);
|
||||
int dmu_objset_open_impl(spa_t *spa, struct dsl_dataset *ds, blkptr_t *bp,
|
||||
@@ -161,6 +173,9 @@ boolean_t dmu_objset_userused_enabled(objset_t *os);
|
||||
int dmu_objset_userspace_upgrade(objset_t *os);
|
||||
boolean_t dmu_objset_userspace_present(objset_t *os);
|
||||
|
||||
void dmu_objset_init(void);
|
||||
void dmu_objset_fini(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -49,6 +49,9 @@ typedef int (blkptr_cb_t)(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
#define TRAVERSE_PREFETCH (TRAVERSE_PREFETCH_METADATA | TRAVERSE_PREFETCH_DATA)
|
||||
#define TRAVERSE_HARD (1<<4)
|
||||
|
||||
/* Special traverse error return value to indicate skipping of children */
|
||||
#define TRAVERSE_VISIT_NO_CHILDREN -1
|
||||
|
||||
int traverse_dataset(struct dsl_dataset *ds,
|
||||
uint64_t txg_start, int flags, blkptr_cb_t func, void *arg);
|
||||
int traverse_pool(spa_t *spa,
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <sys/zio.h>
|
||||
#include <sys/refcount.h>
|
||||
#include <sys/dmu_zfetch.h>
|
||||
#include <sys/zrlock.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -156,6 +157,7 @@ typedef struct dnode {
|
||||
struct objset *dn_objset;
|
||||
uint64_t dn_object;
|
||||
struct dmu_buf_impl *dn_dbuf;
|
||||
struct dnode_handle *dn_handle;
|
||||
dnode_phys_t *dn_phys; /* pointer into dn->dn_dbuf->db.db_data */
|
||||
|
||||
/*
|
||||
@@ -172,6 +174,7 @@ typedef struct dnode {
|
||||
uint8_t dn_nlevels;
|
||||
uint8_t dn_indblkshift;
|
||||
uint8_t dn_datablkshift; /* zero if blksz not power of 2! */
|
||||
uint8_t dn_moved; /* Has this dnode been moved? */
|
||||
uint16_t dn_datablkszsec; /* in 512b sectors */
|
||||
uint32_t dn_datablksz; /* in bytes */
|
||||
uint64_t dn_maxblkid;
|
||||
@@ -183,6 +186,9 @@ typedef struct dnode {
|
||||
uint16_t dn_next_bonuslen[TXG_SIZE];
|
||||
uint32_t dn_next_blksz[TXG_SIZE]; /* next block size in bytes */
|
||||
|
||||
/* protected by dn_dbufs_mtx; declared here to fill 32-bit hole */
|
||||
uint32_t dn_dbufs_count; /* count of dn_dbufs */
|
||||
|
||||
/* protected by os_lock: */
|
||||
list_node_t dn_dirty_link[TXG_SIZE]; /* next on dataset's dirty */
|
||||
|
||||
@@ -202,8 +208,11 @@ typedef struct dnode {
|
||||
refcount_t dn_holds;
|
||||
|
||||
kmutex_t dn_dbufs_mtx;
|
||||
list_t dn_dbufs; /* linked list of descendent dbuf_t's */
|
||||
list_t dn_dbufs; /* descendent dbufs */
|
||||
|
||||
/* protected by dn_struct_rwlock */
|
||||
struct dmu_buf_impl *dn_bonus; /* bonus buffer dbuf */
|
||||
|
||||
boolean_t dn_have_spill; /* have spill or are spilling */
|
||||
|
||||
/* parent IO for current sync write */
|
||||
@@ -220,6 +229,22 @@ typedef struct dnode {
|
||||
struct zfetch dn_zfetch;
|
||||
} dnode_t;
|
||||
|
||||
/*
|
||||
* Adds a level of indirection between the dbuf and the dnode to avoid
|
||||
* iterating descendent dbufs in dnode_move(). Handles are not allocated
|
||||
* individually, but as an array of child dnodes in dnode_hold_impl().
|
||||
*/
|
||||
typedef struct dnode_handle {
|
||||
/* Protects dnh_dnode from modification by dnode_move(). */
|
||||
zrlock_t dnh_zrlock;
|
||||
dnode_t *dnh_dnode;
|
||||
} dnode_handle_t;
|
||||
|
||||
typedef struct dnode_children {
|
||||
size_t dnc_count; /* number of children */
|
||||
dnode_handle_t dnc_children[1]; /* sized dynamically */
|
||||
} dnode_children_t;
|
||||
|
||||
typedef struct free_range {
|
||||
avl_node_t fr_node;
|
||||
uint64_t fr_blkid;
|
||||
@@ -227,8 +252,8 @@ typedef struct free_range {
|
||||
} free_range_t;
|
||||
|
||||
dnode_t *dnode_special_open(struct objset *dd, dnode_phys_t *dnp,
|
||||
uint64_t object);
|
||||
void dnode_special_close(dnode_t *dn);
|
||||
uint64_t object, dnode_handle_t *dnh);
|
||||
void dnode_special_close(dnode_handle_t *dnh);
|
||||
|
||||
void dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx);
|
||||
void dnode_setbonus_type(dnode_t *dn, dmu_object_type_t, dmu_tx_t *tx);
|
||||
|
||||
@@ -162,6 +162,22 @@ struct dsl_ds_destroyarg {
|
||||
boolean_t need_prep; /* do we need to retry due to EBUSY? */
|
||||
};
|
||||
|
||||
/*
|
||||
* The max length of a temporary tag prefix is the number of hex digits
|
||||
* required to express UINT64_MAX plus one for the hyphen.
|
||||
*/
|
||||
#define MAX_TAG_PREFIX_LEN 17
|
||||
|
||||
struct dsl_ds_holdarg {
|
||||
dsl_sync_task_group_t *dstg;
|
||||
char *htag;
|
||||
char *snapname;
|
||||
boolean_t recursive;
|
||||
boolean_t gotone;
|
||||
boolean_t temphold;
|
||||
char failed[MAXPATHLEN];
|
||||
};
|
||||
|
||||
#define dsl_dataset_is_snapshot(ds) \
|
||||
((ds)->ds_phys->ds_num_children != 0)
|
||||
|
||||
@@ -182,6 +198,8 @@ void dsl_dataset_drop_ref(dsl_dataset_t *ds, void *tag);
|
||||
boolean_t dsl_dataset_tryown(dsl_dataset_t *ds, boolean_t inconsistentok,
|
||||
void *tag);
|
||||
void dsl_dataset_make_exclusive(dsl_dataset_t *ds, void *tag);
|
||||
void dsl_register_onexit_hold_cleanup(dsl_dataset_t *ds, const char *htag,
|
||||
minor_t minor);
|
||||
uint64_t dsl_dataset_create_sync(dsl_dir_t *pds, const char *lastname,
|
||||
dsl_dataset_t *origin, uint64_t flags, cred_t *, dmu_tx_t *);
|
||||
uint64_t dsl_dataset_create_sync_dd(dsl_dir_t *dd, dsl_dataset_t *origin,
|
||||
@@ -192,16 +210,19 @@ dsl_checkfunc_t dsl_dataset_destroy_check;
|
||||
dsl_syncfunc_t dsl_dataset_destroy_sync;
|
||||
dsl_checkfunc_t dsl_dataset_snapshot_check;
|
||||
dsl_syncfunc_t dsl_dataset_snapshot_sync;
|
||||
dsl_syncfunc_t dsl_dataset_user_hold_sync;
|
||||
int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive);
|
||||
int dsl_dataset_promote(const char *name, char *conflsnap);
|
||||
int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head,
|
||||
boolean_t force);
|
||||
int dsl_dataset_user_hold(char *dsname, char *snapname, char *htag,
|
||||
boolean_t recursive, boolean_t temphold);
|
||||
boolean_t recursive, boolean_t temphold, int cleanup_fd);
|
||||
int dsl_dataset_user_hold_for_send(dsl_dataset_t *ds, char *htag,
|
||||
boolean_t temphold);
|
||||
int dsl_dataset_user_release(char *dsname, char *snapname, char *htag,
|
||||
boolean_t recursive);
|
||||
int dsl_dataset_user_release_tmp(struct dsl_pool *dp, uint64_t dsobj,
|
||||
char *htag);
|
||||
char *htag, boolean_t retry);
|
||||
int dsl_dataset_get_holds(const char *dsname, nvlist_t **nvp);
|
||||
|
||||
blkptr_t *dsl_dataset_get_blkptr(dsl_dataset_t *ds);
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_DSL_DELEG_H
|
||||
@@ -55,6 +54,7 @@ extern "C" {
|
||||
#define ZFS_DELEG_PERM_GROUPUSED "groupused"
|
||||
#define ZFS_DELEG_PERM_HOLD "hold"
|
||||
#define ZFS_DELEG_PERM_RELEASE "release"
|
||||
#define ZFS_DELEG_PERM_DIFF "diff"
|
||||
|
||||
/*
|
||||
* Note: the names of properties that are marked delegatable are also
|
||||
@@ -64,6 +64,7 @@ extern "C" {
|
||||
int dsl_deleg_get(const char *ddname, nvlist_t **nvp);
|
||||
int dsl_deleg_set(const char *ddname, nvlist_t *nvp, boolean_t unset);
|
||||
int dsl_deleg_access(const char *ddname, const char *perm, cred_t *cr);
|
||||
int dsl_deleg_access_impl(struct dsl_dataset *ds, const char *perm, cred_t *cr);
|
||||
void dsl_deleg_set_create_perms(dsl_dir_t *dd, dmu_tx_t *tx, cred_t *cr);
|
||||
int dsl_deleg_can_allow(char *ddname, nvlist_t *nvp, cred_t *cr);
|
||||
int dsl_deleg_can_unallow(char *ddname, nvlist_t *nvp, cred_t *cr);
|
||||
|
||||
@@ -43,12 +43,13 @@ extern "C" {
|
||||
#define FM_CLASS "class"
|
||||
#define FM_VERSION "version"
|
||||
|
||||
/* FM event class values */
|
||||
/* FM protocol category 1 class names */
|
||||
#define FM_EREPORT_CLASS "ereport"
|
||||
#define FM_FAULT_CLASS "fault"
|
||||
#define FM_DEFECT_CLASS "defect"
|
||||
#define FM_RSRC_CLASS "resource"
|
||||
#define FM_LIST_EVENT "list"
|
||||
#define FM_IREPORT_CLASS "ireport"
|
||||
|
||||
/* FM list.* event class values */
|
||||
#define FM_LIST_SUSPECT_CLASS FM_LIST_EVENT ".suspect"
|
||||
@@ -72,6 +73,12 @@ extern "C" {
|
||||
/* list.* event payload member names */
|
||||
#define FM_LIST_EVENT_SIZE "list-sz"
|
||||
|
||||
/* ireport.* event payload member names */
|
||||
#define FM_IREPORT_DETECTOR "detector"
|
||||
#define FM_IREPORT_UUID "uuid"
|
||||
#define FM_IREPORT_PRIORITY "pri"
|
||||
#define FM_IREPORT_ATTRIBUTES "attr"
|
||||
|
||||
/*
|
||||
* list.suspect, isolated, updated, repaired and resolved
|
||||
* versions/payload member names.
|
||||
@@ -192,6 +199,7 @@ extern "C" {
|
||||
#define FM_FMRI_SCHEME_PKG "pkg"
|
||||
#define FM_FMRI_SCHEME_LEGACY "legacy-hc"
|
||||
#define FM_FMRI_SCHEME_ZFS "zfs"
|
||||
#define FM_FMRI_SCHEME_SW "sw"
|
||||
|
||||
/* Scheme versions */
|
||||
#define FMD_SCHEME_VERSION0 0
|
||||
@@ -215,6 +223,8 @@ extern "C" {
|
||||
#define FM_SVC_SCHEME_VERSION SVC_SCHEME_VERSION0
|
||||
#define ZFS_SCHEME_VERSION0 0
|
||||
#define FM_ZFS_SCHEME_VERSION ZFS_SCHEME_VERSION0
|
||||
#define SW_SCHEME_VERSION0 0
|
||||
#define FM_SW_SCHEME_VERSION SW_SCHEME_VERSION0
|
||||
|
||||
/* hc scheme member names */
|
||||
#define FM_FMRI_HC_SERIAL_ID "serial"
|
||||
@@ -299,6 +309,25 @@ extern "C" {
|
||||
#define FM_FMRI_ZFS_POOL "pool"
|
||||
#define FM_FMRI_ZFS_VDEV "vdev"
|
||||
|
||||
/* sw scheme member names - extra indentation for members of an nvlist */
|
||||
#define FM_FMRI_SW_OBJ "object"
|
||||
#define FM_FMRI_SW_OBJ_PATH "path"
|
||||
#define FM_FMRI_SW_OBJ_ROOT "root"
|
||||
#define FM_FMRI_SW_OBJ_PKG "pkg"
|
||||
#define FM_FMRI_SW_SITE "site"
|
||||
#define FM_FMRI_SW_SITE_TOKEN "token"
|
||||
#define FM_FMRI_SW_SITE_MODULE "module"
|
||||
#define FM_FMRI_SW_SITE_FILE "file"
|
||||
#define FM_FMRI_SW_SITE_LINE "line"
|
||||
#define FM_FMRI_SW_SITE_FUNC "func"
|
||||
#define FM_FMRI_SW_CTXT "context"
|
||||
#define FM_FMRI_SW_CTXT_ORIGIN "origin"
|
||||
#define FM_FMRI_SW_CTXT_EXECNAME "execname"
|
||||
#define FM_FMRI_SW_CTXT_PID "pid"
|
||||
#define FM_FMRI_SW_CTXT_ZONE "zone"
|
||||
#define FM_FMRI_SW_CTXT_CTID "ctid"
|
||||
#define FM_FMRI_SW_CTXT_STACK "stack"
|
||||
|
||||
extern nv_alloc_t *fm_nva_xcreate(char *, size_t);
|
||||
extern void fm_nva_xdestroy(nv_alloc_t *);
|
||||
|
||||
|
||||
@@ -20,15 +20,12 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FM_UTIL_H
|
||||
#define _SYS_FM_UTIL_H
|
||||
|
||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -96,6 +93,7 @@ extern void fm_ereport_post(nvlist_t *, int);
|
||||
|
||||
extern void fm_payload_stack_add(nvlist_t *, const pc_t *, int);
|
||||
|
||||
extern int is_fm_panic();
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -40,7 +40,7 @@ extern "C" {
|
||||
*/
|
||||
#define FTAG ((char *)__func__)
|
||||
|
||||
#if defined(DEBUG) || !defined(_KERNEL)
|
||||
#ifdef ZFS_DEBUG
|
||||
typedef struct reference {
|
||||
list_node_t ref_link;
|
||||
void *ref_holder;
|
||||
@@ -67,11 +67,12 @@ int64_t refcount_add(refcount_t *rc, void *holder_tag);
|
||||
int64_t refcount_remove(refcount_t *rc, void *holder_tag);
|
||||
int64_t refcount_add_many(refcount_t *rc, uint64_t number, void *holder_tag);
|
||||
int64_t refcount_remove_many(refcount_t *rc, uint64_t number, void *holder_tag);
|
||||
void refcount_transfer(refcount_t *dst, refcount_t *src);
|
||||
|
||||
void refcount_init(void);
|
||||
void refcount_fini(void);
|
||||
|
||||
#else /* DEBUG */
|
||||
#else /* ZFS_DEBUG */
|
||||
|
||||
typedef struct refcount {
|
||||
uint64_t rc_count;
|
||||
@@ -97,7 +98,7 @@ typedef struct refcount {
|
||||
#define refcount_init()
|
||||
#define refcount_fini()
|
||||
|
||||
#endif /* DEBUG */
|
||||
#endif /* ZFS_DEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SA_H
|
||||
@@ -141,7 +140,7 @@ dmu_buf_t *sa_get_db(sa_handle_t *);
|
||||
uint64_t sa_handle_object(sa_handle_t *);
|
||||
boolean_t sa_attr_would_spill(sa_handle_t *, sa_attr_type_t, int size);
|
||||
void sa_register_update_callback(objset_t *, sa_update_cb_t *);
|
||||
sa_attr_type_t *sa_setup(objset_t *, uint64_t, sa_attr_reg_t *, int);
|
||||
int sa_setup(objset_t *, uint64_t, sa_attr_reg_t *, int, sa_attr_type_t **);
|
||||
void sa_tear_down(objset_t *);
|
||||
int sa_replace_all_by_template(sa_handle_t *, sa_bulk_attr_t *,
|
||||
int, dmu_tx_t *);
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SA_IMPL_H
|
||||
@@ -232,7 +231,7 @@ struct sa_handle {
|
||||
((a == DMU_OT_SA) ? B_TRUE : B_FALSE)
|
||||
|
||||
#define SA_BONUSTYPE_FROM_DB(db) \
|
||||
(((dmu_buf_impl_t *)db)->db_dnode->dn_bonustype)
|
||||
(dmu_get_bonustype((dmu_buf_t *)db))
|
||||
|
||||
#define SA_BLKPTR_SPACE (DN_MAX_BONUSLEN - sizeof (blkptr_t))
|
||||
|
||||
|
||||
@@ -418,8 +418,8 @@ extern int spa_get_stats(const char *pool, nvlist_t **config,
|
||||
extern int spa_create(const char *pool, nvlist_t *config, nvlist_t *props,
|
||||
const char *history_str, nvlist_t *zplprops);
|
||||
extern int spa_import_rootpool(char *devpath, char *devid);
|
||||
extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props);
|
||||
extern int spa_import_verbatim(const char *, nvlist_t *, nvlist_t *);
|
||||
extern int spa_import(const char *pool, nvlist_t *config, nvlist_t *props,
|
||||
uint64_t flags);
|
||||
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,
|
||||
@@ -602,6 +602,7 @@ extern objset_t *spa_meta_objset(spa_t *spa);
|
||||
|
||||
/* Miscellaneous support routines */
|
||||
extern int spa_rename(const char *oldname, const char *newname);
|
||||
extern spa_t *spa_by_guid(uint64_t pool_guid, uint64_t device_guid);
|
||||
extern boolean_t spa_guid_exists(uint64_t pool_guid, uint64_t device_guid);
|
||||
extern char *spa_strdup(const char *);
|
||||
extern void spa_strfree(char *);
|
||||
@@ -620,7 +621,6 @@ extern uint64_t bp_get_dsize(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 void spa_rewind_data_to_nvlist(spa_t *spa, nvlist_t *to);
|
||||
|
||||
extern int spa_mode(spa_t *spa);
|
||||
extern uint64_t strtonum(const char *str, char **nptr);
|
||||
|
||||
@@ -114,13 +114,14 @@ struct spa {
|
||||
nvlist_t *spa_config; /* last synced config */
|
||||
nvlist_t *spa_config_syncing; /* currently syncing config */
|
||||
nvlist_t *spa_config_splitting; /* config for splitting */
|
||||
nvlist_t *spa_load_info; /* info and errors from load */
|
||||
uint64_t spa_config_txg; /* txg of last config change */
|
||||
int spa_sync_pass; /* iterate-to-convergence */
|
||||
pool_state_t spa_state; /* pool state */
|
||||
int spa_inject_ref; /* injection references */
|
||||
uint8_t spa_sync_on; /* sync threads are running */
|
||||
spa_load_state_t spa_load_state; /* current load operation */
|
||||
boolean_t spa_load_verbatim; /* load the given config? */
|
||||
uint64_t spa_import_flags; /* import specific flags */
|
||||
taskq_t *spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
|
||||
dsl_pool_t *spa_dsl_pool;
|
||||
metaslab_class_t *spa_normal_class; /* normal data class */
|
||||
@@ -130,6 +131,7 @@ struct spa {
|
||||
uint64_t spa_freeze_txg; /* freeze pool at this txg */
|
||||
uint64_t spa_load_max_txg; /* best initial ub_txg */
|
||||
uint64_t spa_claim_max_txg; /* highest claimed birth txg */
|
||||
timespec_t spa_loaded_ts; /* 1st successful open time */
|
||||
objset_t *spa_meta_objset; /* copy of dp->dp_meta_objset */
|
||||
txg_list_t spa_vdev_txg_list; /* per-txg dirty vdev list */
|
||||
vdev_t *spa_root_vdev; /* top-level vdev container */
|
||||
@@ -146,9 +148,9 @@ struct spa {
|
||||
uberblock_t spa_ubsync; /* last synced uberblock */
|
||||
uberblock_t spa_uberblock; /* current uberblock */
|
||||
boolean_t spa_extreme_rewind; /* rewind past deferred frees */
|
||||
uint64_t spa_last_io; /* lbolt of last non-scan I/O */
|
||||
kmutex_t spa_scrub_lock; /* resilver/scrub lock */
|
||||
uint64_t spa_scrub_inflight; /* in-flight scrub I/Os */
|
||||
uint64_t spa_scrub_maxinflight; /* max in-flight scrub I/Os */
|
||||
kcondvar_t spa_scrub_io_cv; /* scrub I/O completion */
|
||||
uint8_t spa_scrub_active; /* active or suspended? */
|
||||
uint8_t spa_scrub_type; /* type of scrub we're doing */
|
||||
|
||||
@@ -169,6 +169,7 @@ struct vdev {
|
||||
uint64_t vdev_faulted; /* persistent faulted state */
|
||||
uint64_t vdev_degraded; /* persistent degraded state */
|
||||
uint64_t vdev_removed; /* persistent removed state */
|
||||
uint64_t vdev_resilvering; /* persistent resilvering state */
|
||||
uint64_t vdev_nparity; /* number of parity devices for raidz */
|
||||
char *vdev_path; /* vdev path (if any) */
|
||||
char *vdev_devid; /* vdev devid (if any) */
|
||||
@@ -283,6 +284,7 @@ extern void vdev_remove_parent(vdev_t *cvd);
|
||||
* vdev sync load and sync
|
||||
*/
|
||||
extern void vdev_load_log_state(vdev_t *nvd, vdev_t *ovd);
|
||||
extern boolean_t vdev_log_state_valid(vdev_t *vd);
|
||||
extern void vdev_load(vdev_t *vd);
|
||||
extern void vdev_sync(vdev_t *vd, uint64_t txg);
|
||||
extern void vdev_sync_done(vdev_t *vd, uint64_t txg);
|
||||
|
||||
@@ -185,10 +185,6 @@ typedef struct zfs_acl_ids {
|
||||
struct zfs_fuid_info *z_fuidp; /* for tracking fuids for log */
|
||||
} zfs_acl_ids_t;
|
||||
|
||||
#define ZFS_EXTERNAL_ACL(zp) \
|
||||
(zp->z_is_sa ? 0 : zfs_external_acl(zp))
|
||||
#define ZNODE_ACL_VERSION(zp) \
|
||||
(zp->z_is_sa ? ZFS_ACL_VERSION_FUID : zfs_znode_acl_version(zp))
|
||||
/*
|
||||
* Property values for acl_mode and acl_inherit.
|
||||
*
|
||||
@@ -222,7 +218,7 @@ int zfs_fastaccesschk_execute(struct znode *, cred_t *);
|
||||
extern int zfs_zaccess_rwx(struct znode *, mode_t, int, cred_t *);
|
||||
extern int zfs_zaccess_unix(struct znode *, mode_t, cred_t *);
|
||||
extern int zfs_acl_access(struct znode *, int, cred_t *);
|
||||
int zfs_acl_chmod_setattr(struct znode *, zfs_acl_t **, uint64_t);
|
||||
void zfs_acl_chmod_setattr(struct znode *, zfs_acl_t **, uint64_t);
|
||||
int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *);
|
||||
int zfs_zaccess_rename(struct znode *, struct znode *,
|
||||
struct znode *, struct znode *, cred_t *cr);
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZFS_IOCTL_H
|
||||
@@ -31,6 +30,7 @@
|
||||
#include <sys/zio.h>
|
||||
#include <sys/dsl_deleg.h>
|
||||
#include <sys/spa.h>
|
||||
#include <sys/zfs_stat.h>
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/nvpair.h>
|
||||
@@ -199,6 +199,22 @@ typedef struct dmu_replay_record {
|
||||
} drr_u;
|
||||
} dmu_replay_record_t;
|
||||
|
||||
/* diff record range types */
|
||||
typedef enum diff_type {
|
||||
DDR_NONE = 0x1,
|
||||
DDR_INUSE = 0x2,
|
||||
DDR_FREE = 0x4
|
||||
} diff_type_t;
|
||||
|
||||
/*
|
||||
* The diff reports back ranges of free or in-use objects.
|
||||
*/
|
||||
typedef struct dmu_diff_record {
|
||||
uint64_t ddr_type;
|
||||
uint64_t ddr_first;
|
||||
uint64_t ddr_last;
|
||||
} dmu_diff_record_t;
|
||||
|
||||
typedef struct zinject_record {
|
||||
uint64_t zi_objset;
|
||||
uint64_t zi_object;
|
||||
@@ -265,6 +281,13 @@ typedef struct zfs_cmd {
|
||||
zinject_record_t zc_inject_record;
|
||||
boolean_t zc_defer_destroy;
|
||||
boolean_t zc_temphold;
|
||||
uint64_t zc_action_handle;
|
||||
int zc_cleanup_fd;
|
||||
uint8_t zc_pad[4]; /* alignment */
|
||||
uint64_t zc_sendobj;
|
||||
uint64_t zc_fromobj;
|
||||
uint64_t zc_createtxg;
|
||||
zfs_stat_t zc_stat;
|
||||
} zfs_cmd_t;
|
||||
|
||||
typedef struct zfs_useracct {
|
||||
@@ -274,8 +297,8 @@ typedef struct zfs_useracct {
|
||||
uint64_t zu_space;
|
||||
} zfs_useracct_t;
|
||||
|
||||
#define ZVOL_MAX_MINOR (1 << 16)
|
||||
#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1)
|
||||
#define ZFSDEV_MAX_MINOR (1 << 16)
|
||||
#define ZFS_MIN_MINOR (ZFSDEV_MAX_MINOR + 1)
|
||||
|
||||
#define ZPOOL_EXPORT_AFTER_SPLIT 0x1
|
||||
|
||||
@@ -295,6 +318,28 @@ extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr);
|
||||
extern int zfs_busy(void);
|
||||
extern int zfs_unmount_snap(const char *, void *);
|
||||
|
||||
/*
|
||||
* ZFS minor numbers can refer to either a control device instance or
|
||||
* a zvol. Depending on the value of zss_type, zss_data points to either
|
||||
* a zvol_state_t or a zfs_onexit_t.
|
||||
*/
|
||||
enum zfs_soft_state_type {
|
||||
ZSST_ZVOL,
|
||||
ZSST_CTLDEV
|
||||
};
|
||||
|
||||
typedef struct zfs_soft_state {
|
||||
enum zfs_soft_state_type zss_type;
|
||||
void *zss_data;
|
||||
} zfs_soft_state_t;
|
||||
|
||||
extern void *zfsdev_get_soft_state(minor_t minor,
|
||||
enum zfs_soft_state_type which);
|
||||
extern minor_t zfsdev_minor_alloc(void);
|
||||
|
||||
extern void *zfsdev_state;
|
||||
extern kmutex_t zfsdev_state_lock;
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZFS_ONEXIT_H
|
||||
#define _SYS_ZFS_ONEXIT_H
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
typedef struct zfs_onexit {
|
||||
kmutex_t zo_lock;
|
||||
list_t zo_actions;
|
||||
} zfs_onexit_t;
|
||||
|
||||
typedef struct zfs_onexit_action_node {
|
||||
list_node_t za_link;
|
||||
void (*za_func)(void *);
|
||||
void *za_data;
|
||||
} zfs_onexit_action_node_t;
|
||||
|
||||
extern void zfs_onexit_init(zfs_onexit_t **zo);
|
||||
extern void zfs_onexit_destroy(zfs_onexit_t *zo);
|
||||
|
||||
#endif
|
||||
|
||||
extern int zfs_onexit_fd_hold(int fd, minor_t *minorp);
|
||||
extern void zfs_onexit_fd_rele(int fd);
|
||||
extern int zfs_onexit_add_cb(minor_t minor, void (*func)(void *), void *data,
|
||||
uint64_t *action_handle);
|
||||
extern int zfs_onexit_del_cb(minor_t minor, uint64_t action_handle,
|
||||
boolean_t fire);
|
||||
extern int zfs_onexit_cb_data(minor_t minor, uint64_t action_handle,
|
||||
void **data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ZFS_ONEXIT_H */
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_STAT_H
|
||||
#define _SYS_FS_ZFS_STAT_H
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/types32.h>
|
||||
#include <sys/dmu.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* A limited number of zpl level stats are retrievable
|
||||
* with an ioctl. zfs diff is the current consumer.
|
||||
*/
|
||||
typedef struct zfs_stat {
|
||||
uint64_t zs_gen;
|
||||
uint64_t zs_mode;
|
||||
uint64_t zs_links;
|
||||
uint64_t zs_ctime[2];
|
||||
} zfs_stat_t;
|
||||
|
||||
extern int zfs_obj_to_stats(objset_t *osp, uint64_t obj, zfs_stat_t *sb,
|
||||
char *buf, int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_FS_ZFS_STAT_H */
|
||||
@@ -79,6 +79,7 @@ struct zfsvfs {
|
||||
kmutex_t z_lock;
|
||||
uint64_t z_userquota_obj;
|
||||
uint64_t z_groupquota_obj;
|
||||
uint64_t z_replay_eof; /* New end of file - replay only */
|
||||
sa_attr_type_t *z_attr_table; /* SA attr mapping->id */
|
||||
#define ZFS_OBJ_MTX_SZ 64
|
||||
kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
|
||||
* Use is subject to license terms.
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FS_ZFS_ZNODE_H
|
||||
@@ -36,6 +35,7 @@
|
||||
#include <sys/zfs_vfsops.h>
|
||||
#include <sys/rrwlock.h>
|
||||
#include <sys/zfs_sa.h>
|
||||
#include <sys/zfs_stat.h>
|
||||
#endif
|
||||
#include <sys/zfs_acl.h>
|
||||
#include <sys/zil.h>
|
||||
@@ -60,6 +60,8 @@ extern "C" {
|
||||
#define ZFS_AV_QUARANTINED 0x0000020000000000
|
||||
#define ZFS_AV_MODIFIED 0x0000040000000000
|
||||
#define ZFS_REPARSE 0x0000080000000000
|
||||
#define ZFS_OFFLINE 0x0000100000000000
|
||||
#define ZFS_SPARSE 0x0000200000000000
|
||||
|
||||
#define ZFS_ATTR_SET(zp, attr, value, pflags, tx) \
|
||||
{ \
|
||||
@@ -188,17 +190,17 @@ typedef struct znode {
|
||||
uint8_t z_unlinked; /* file has been unlinked */
|
||||
uint8_t z_atime_dirty; /* atime needs to be synced */
|
||||
uint8_t z_zn_prefetch; /* Prefetch znodes? */
|
||||
uint8_t z_moved; /* Has this znode been moved? */
|
||||
uint_t z_blksz; /* block size in bytes */
|
||||
uint_t z_seq; /* modification sequence number */
|
||||
uint64_t z_mapcnt; /* number of pages mapped to file */
|
||||
uint64_t z_last_itx; /* last ZIL itx on this znode */
|
||||
uint64_t z_gen; /* generation (cached) */
|
||||
uint64_t z_size; /* file size (cached) */
|
||||
uint64_t z_atime[2]; /* atime (cached) */
|
||||
uint64_t z_links; /* file links (cached) */
|
||||
uint64_t z_pflags; /* pflags (cached) */
|
||||
uid_t z_uid; /* uid mapped (cached) */
|
||||
uid_t z_gid; /* gid mapped (cached) */
|
||||
uint64_t z_uid; /* uid fuid (cached) */
|
||||
uint64_t z_gid; /* gid fuid (cached) */
|
||||
mode_t z_mode; /* mode (cached) */
|
||||
uint32_t z_sync_cnt; /* synchronous open count */
|
||||
kmutex_t z_acl_lock; /* acl data lock */
|
||||
@@ -321,7 +323,8 @@ extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
|
||||
extern int zfs_log_create_txtype(zil_create_t, vsecattr_t *vsecp,
|
||||
vattr_t *vap);
|
||||
extern void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
|
||||
znode_t *dzp, char *name);
|
||||
znode_t *dzp, char *name, uint64_t foid);
|
||||
#define ZFS_NO_OBJECT 0 /* no object id */
|
||||
extern void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
|
||||
znode_t *dzp, znode_t *zp, char *name);
|
||||
extern void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
|
||||
|
||||
@@ -169,18 +169,14 @@ typedef enum zil_create {
|
||||
(txtype) == TX_ACL || \
|
||||
(txtype) == TX_WRITE2)
|
||||
|
||||
|
||||
/*
|
||||
* Format of log records.
|
||||
* The fields are carefully defined to allow them to be aligned
|
||||
* and sized the same on sparc & intel architectures.
|
||||
* Each log record has a common structure at the beginning.
|
||||
*
|
||||
* Note, lrc_seq holds two different sequence numbers. Whilst in memory
|
||||
* it contains the transaction sequence number. The log record on
|
||||
* disk holds the sequence number of all log records which is used to
|
||||
* ensure we don't replay the same record. The two sequence numbers are
|
||||
* different because the transactions can now be pushed out of order.
|
||||
* The log record on disk (lrc_seq) holds the sequence number of all log
|
||||
* records which is used to ensure we don't replay the same record.
|
||||
*/
|
||||
typedef struct { /* common log record header */
|
||||
uint64_t lrc_txtype; /* intent log transaction type */
|
||||
@@ -371,6 +367,7 @@ typedef struct itx {
|
||||
itx_wr_state_t itx_wr_state; /* write state */
|
||||
uint8_t itx_sync; /* synchronous transaction */
|
||||
uint64_t itx_sod; /* record size on disk */
|
||||
uint64_t itx_oid; /* object id */
|
||||
lr_t itx_lr; /* common part of log record */
|
||||
/* followed by type-specific part of lr_xx_t and its immediate data */
|
||||
} itx_t;
|
||||
@@ -402,15 +399,15 @@ extern void zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
|
||||
|
||||
extern itx_t *zil_itx_create(uint64_t txtype, size_t lrsize);
|
||||
extern void zil_itx_destroy(itx_t *itx);
|
||||
extern uint64_t zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
|
||||
extern void zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
|
||||
|
||||
extern void zil_commit(zilog_t *zilog, uint64_t seq, uint64_t oid);
|
||||
extern void zil_commit(zilog_t *zilog, uint64_t oid);
|
||||
|
||||
extern int zil_vdev_offline(const char *osname, void *txarg);
|
||||
extern int zil_claim(const char *osname, void *txarg);
|
||||
extern int zil_check_log_chain(const char *osname, void *txarg);
|
||||
extern void zil_sync(zilog_t *zilog, dmu_tx_t *tx);
|
||||
extern void zil_clean(zilog_t *zilog);
|
||||
extern void zil_clean(zilog_t *zilog, uint64_t synced_txg);
|
||||
|
||||
extern int zil_suspend(zilog_t *zilog);
|
||||
extern void zil_resume(zilog_t *zilog);
|
||||
|
||||
@@ -49,6 +49,28 @@ typedef struct lwb {
|
||||
list_node_t lwb_node; /* zilog->zl_lwb_list linkage */
|
||||
} lwb_t;
|
||||
|
||||
/*
|
||||
* Intent log transaction lists
|
||||
*/
|
||||
typedef struct itxs {
|
||||
list_t i_sync_list; /* list of synchronous itxs */
|
||||
avl_tree_t i_async_tree; /* tree of foids for async itxs */
|
||||
} itxs_t;
|
||||
|
||||
typedef struct itxg {
|
||||
kmutex_t itxg_lock; /* lock for this structure */
|
||||
uint64_t itxg_txg; /* txg for this chain */
|
||||
uint64_t itxg_sod; /* total size on disk for this txg */
|
||||
itxs_t *itxg_itxs; /* sync and async itxs */
|
||||
} itxg_t;
|
||||
|
||||
/* for async nodes we build up an AVL tree of lists of async itxs per file */
|
||||
typedef struct itx_async_node {
|
||||
uint64_t ia_foid; /* file object id */
|
||||
list_t ia_list; /* list of async itxs for this foid */
|
||||
avl_node_t ia_node; /* AVL tree linkage */
|
||||
} itx_async_node_t;
|
||||
|
||||
/*
|
||||
* Vdev flushing: during a zil_commit(), we build up an AVL tree of the vdevs
|
||||
* we've touched so we know which ones need a write cache flush at the end.
|
||||
@@ -71,9 +93,7 @@ struct zilog {
|
||||
objset_t *zl_os; /* object set we're logging */
|
||||
zil_get_data_t *zl_get_data; /* callback to get object content */
|
||||
zio_t *zl_root_zio; /* log writer root zio */
|
||||
uint64_t zl_itx_seq; /* next in-core itx sequence number */
|
||||
uint64_t zl_lr_seq; /* on-disk log record sequence number */
|
||||
uint64_t zl_commit_seq; /* committed upto this number */
|
||||
uint64_t zl_commit_lr_seq; /* last committed on-disk lr seq */
|
||||
uint64_t zl_destroy_txg; /* txg of last zil_destroy() */
|
||||
uint64_t zl_replayed_seq[TXG_SIZE]; /* last replayed rec seq */
|
||||
@@ -93,10 +113,13 @@ struct zilog {
|
||||
uint64_t zl_parse_lr_seq; /* highest lr seq on last parse */
|
||||
uint64_t zl_parse_blk_count; /* number of blocks parsed */
|
||||
uint64_t zl_parse_lr_count; /* number of log records parsed */
|
||||
list_t zl_itx_list; /* in-memory itx list */
|
||||
uint64_t zl_next_batch; /* next batch number */
|
||||
uint64_t zl_com_batch; /* committed batch number */
|
||||
kcondvar_t zl_cv_batch[2]; /* batch condition variables */
|
||||
itxg_t zl_itxg[TXG_SIZE]; /* intent log txg chains */
|
||||
list_t zl_itx_commit_list; /* itx list to be committed */
|
||||
uint64_t zl_itx_list_sz; /* total size of records on list */
|
||||
uint64_t zl_cur_used; /* current commit log size used */
|
||||
uint64_t zl_prev_used; /* previous commit log size used */
|
||||
list_t zl_lwb_list; /* in-flight log write list */
|
||||
kmutex_t zl_vdev_lock; /* protects zl_vdev_tree */
|
||||
avl_tree_t zl_vdev_tree; /* vdevs to flush in zil_commit() */
|
||||
|
||||
@@ -147,7 +147,7 @@ enum zio_flag {
|
||||
ZIO_FLAG_SELF_HEAL = 1 << 2,
|
||||
ZIO_FLAG_RESILVER = 1 << 3,
|
||||
ZIO_FLAG_SCRUB = 1 << 4,
|
||||
ZIO_FLAG_SCRUB_THREAD = 1 << 5,
|
||||
ZIO_FLAG_SCAN_THREAD = 1 << 5,
|
||||
|
||||
#define ZIO_FLAG_AGG_INHERIT (ZIO_FLAG_CANFAIL - 1)
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://www.opensolaris.org/os/licensing.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_ZRLOCK_H
|
||||
#define _SYS_ZRLOCK_H
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct zrlock {
|
||||
kmutex_t zr_mtx;
|
||||
volatile int32_t zr_refcount;
|
||||
kcondvar_t zr_cv;
|
||||
uint16_t zr_pad;
|
||||
#ifdef ZFS_DEBUG
|
||||
kthread_t *zr_owner;
|
||||
const char *zr_caller;
|
||||
#endif
|
||||
} zrlock_t;
|
||||
|
||||
extern void zrl_init(zrlock_t *);
|
||||
extern void zrl_destroy(zrlock_t *);
|
||||
#ifdef ZFS_DEBUG
|
||||
#define zrl_add(_z) zrl_add_debug((_z), __func__)
|
||||
extern void zrl_add_debug(zrlock_t *, const char *);
|
||||
#else
|
||||
extern void zrl_add(zrlock_t *);
|
||||
#endif
|
||||
extern void zrl_remove(zrlock_t *);
|
||||
extern int zrl_tryenter(zrlock_t *);
|
||||
extern void zrl_exit(zrlock_t *);
|
||||
extern int zrl_is_zero(zrlock_t *);
|
||||
extern int zrl_is_locked(zrlock_t *);
|
||||
#ifdef ZFS_DEBUG
|
||||
extern kthread_t *zrl_owner(zrlock_t *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_ZRLOCK_H */
|
||||
Reference in New Issue
Block a user