xref: /onnv-gate/usr/src/uts/common/fs/zfs/sys/zil.h (revision 12700:0f31afc2abec)
1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
51646Sperrin  * Common Development and Distribution License (the "License").
61646Sperrin  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
21789Sahrens /*
2212294SMark.Musante@Sun.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23789Sahrens  */
24789Sahrens 
2512294SMark.Musante@Sun.COM /* Portions Copyright 2010 Robert Milkowski */
2612294SMark.Musante@Sun.COM 
27789Sahrens #ifndef	_SYS_ZIL_H
28789Sahrens #define	_SYS_ZIL_H
29789Sahrens 
30789Sahrens #include <sys/types.h>
31789Sahrens #include <sys/spa.h>
32789Sahrens #include <sys/zio.h>
33789Sahrens #include <sys/dmu.h>
34789Sahrens 
35789Sahrens #ifdef	__cplusplus
36789Sahrens extern "C" {
37789Sahrens #endif
38789Sahrens 
39789Sahrens /*
40789Sahrens  * Intent log format:
41789Sahrens  *
42789Sahrens  * Each objset has its own intent log.  The log header (zil_header_t)
43789Sahrens  * for objset N's intent log is kept in the Nth object of the SPA's
44789Sahrens  * intent_log objset.  The log header points to a chain of log blocks,
45789Sahrens  * each of which contains log records (i.e., transactions) followed by
46789Sahrens  * a log block trailer (zil_trailer_t).  The format of a log record
47789Sahrens  * depends on the record (or transaction) type, but all records begin
48789Sahrens  * with a common structure that defines the type, length, and txg.
49789Sahrens  */
50789Sahrens 
51789Sahrens /*
52789Sahrens  * Intent log header - this on disk structure holds fields to manage
53789Sahrens  * the log.  All fields are 64 bit to easily handle cross architectures.
54789Sahrens  */
55789Sahrens typedef struct zil_header {
56789Sahrens 	uint64_t zh_claim_txg;	/* txg in which log blocks were claimed */
57789Sahrens 	uint64_t zh_replay_seq;	/* highest replayed sequence number */
58789Sahrens 	blkptr_t zh_log;	/* log chain */
5910922SJeff.Bonwick@Sun.COM 	uint64_t zh_claim_blk_seq; /* highest claimed block sequence number */
608989SNeil.Perrin@Sun.COM 	uint64_t zh_flags;	/* header flags */
6110922SJeff.Bonwick@Sun.COM 	uint64_t zh_claim_lr_seq; /* highest claimed lr sequence number */
6210922SJeff.Bonwick@Sun.COM 	uint64_t zh_pad[3];
63789Sahrens } zil_header_t;
64789Sahrens 
65789Sahrens /*
668989SNeil.Perrin@Sun.COM  * zh_flags bit settings
678989SNeil.Perrin@Sun.COM  */
6810922SJeff.Bonwick@Sun.COM #define	ZIL_REPLAY_NEEDED	0x1	/* replay needed - internal only */
6910922SJeff.Bonwick@Sun.COM #define	ZIL_CLAIM_LR_SEQ_VALID	0x2	/* zh_claim_lr_seq field is valid */
708989SNeil.Perrin@Sun.COM 
718989SNeil.Perrin@Sun.COM /*
7211670SNeil.Perrin@Sun.COM  * Log block chaining.
73789Sahrens  *
7411670SNeil.Perrin@Sun.COM  * Log blocks are chained together. Originally they were chained at the
7511670SNeil.Perrin@Sun.COM  * end of the block. For performance reasons the chain was moved to the
7611670SNeil.Perrin@Sun.COM  * beginning of the block which allows writes for only the data being used.
7711670SNeil.Perrin@Sun.COM  * The older position is supported for backwards compatability.
7811670SNeil.Perrin@Sun.COM  *
7911670SNeil.Perrin@Sun.COM  * The zio_eck_t contains a zec_cksum which for the intent log is
80789Sahrens  * the sequence number of this log block. A seq of 0 is invalid.
8111670SNeil.Perrin@Sun.COM  * The zec_cksum is checked by the SPA against the sequence
82789Sahrens  * number passed in the blk_cksum field of the blkptr_t
83789Sahrens  */
8411670SNeil.Perrin@Sun.COM typedef struct zil_chain {
8511670SNeil.Perrin@Sun.COM 	uint64_t zc_pad;
8611670SNeil.Perrin@Sun.COM 	blkptr_t zc_next_blk;	/* next block in chain */
8711670SNeil.Perrin@Sun.COM 	uint64_t zc_nused;	/* bytes in log block used */
8811670SNeil.Perrin@Sun.COM 	zio_eck_t zc_eck;	/* block trailer */
8911670SNeil.Perrin@Sun.COM } zil_chain_t;
90789Sahrens 
911842Sperrin #define	ZIL_MIN_BLKSZ	4096ULL
92789Sahrens #define	ZIL_MAX_BLKSZ	SPA_MAXBLOCKSIZE
93789Sahrens 
94789Sahrens /*
951807Sbonwick  * The words of a log block checksum.
961807Sbonwick  */
971807Sbonwick #define	ZIL_ZC_GUID_0	0
981807Sbonwick #define	ZIL_ZC_GUID_1	1
991807Sbonwick #define	ZIL_ZC_OBJSET	2
1001807Sbonwick #define	ZIL_ZC_SEQ	3
1011807Sbonwick 
1025331Samw typedef enum zil_create {
1035331Samw 	Z_FILE,
1045331Samw 	Z_DIR,
1055331Samw 	Z_XATTRDIR,
1065331Samw } zil_create_t;
1075331Samw 
1085331Samw /*
1095331Samw  * size of xvattr log section.
1105331Samw  * its composed of lr_attr_t + xvattr bitmap + 2 64 bit timestamps
1115331Samw  * for create time and a single 64 bit integer for all of the attributes,
1125331Samw  * and 4 64 bit integers (32 bytes) for the scanstamp.
1135331Samw  *
1145331Samw  */
1155331Samw 
1165331Samw #define	ZIL_XVAT_SIZE(mapsize) \
1175331Samw 	sizeof (lr_attr_t) + (sizeof (uint32_t) * (mapsize - 1)) + \
1185331Samw 	(sizeof (uint64_t) * 7)
1195435Smarks 
1205435Smarks /*
1215435Smarks  * Size of ACL in log.  The ACE data is padded out to properly align
1225435Smarks  * on 8 byte boundary.
1235435Smarks  */
1245435Smarks 
1255435Smarks #define	ZIL_ACE_LENGTH(x)	(roundup(x, sizeof (uint64_t)))
1265435Smarks 
1271807Sbonwick /*
128789Sahrens  * Intent log transaction types and record structures
129789Sahrens  */
1305331Samw #define	TX_CREATE		1	/* Create file */
1315331Samw #define	TX_MKDIR		2	/* Make directory */
1325331Samw #define	TX_MKXATTR		3	/* Make XATTR directory */
1335331Samw #define	TX_SYMLINK		4	/* Create symbolic link to a file */
1345331Samw #define	TX_REMOVE		5	/* Remove file */
1355331Samw #define	TX_RMDIR		6	/* Remove directory */
1365331Samw #define	TX_LINK			7	/* Create hard link to a file */
1375331Samw #define	TX_RENAME		8	/* Rename a file */
1385331Samw #define	TX_WRITE		9	/* File write */
1395331Samw #define	TX_TRUNCATE		10	/* Truncate a file */
1405331Samw #define	TX_SETATTR		11	/* Set file attributes */
1415331Samw #define	TX_ACL_V0		12	/* Set old formatted ACL */
1425331Samw #define	TX_ACL			13	/* Set ACL */
1435331Samw #define	TX_CREATE_ACL		14	/* create with ACL */
1445331Samw #define	TX_CREATE_ATTR		15	/* create + attrs */
1455331Samw #define	TX_CREATE_ACL_ATTR 	16	/* create with ACL + attrs */
1465331Samw #define	TX_MKDIR_ACL		17	/* mkdir with ACL */
1475331Samw #define	TX_MKDIR_ATTR		18	/* mkdir with attr */
1485331Samw #define	TX_MKDIR_ACL_ATTR	19	/* mkdir with ACL + attrs */
14910800SNeil.Perrin@Sun.COM #define	TX_WRITE2		20	/* dmu_sync EALREADY write */
15010800SNeil.Perrin@Sun.COM #define	TX_MAX_TYPE		21	/* Max transaction type */
1515331Samw 
1525331Samw /*
1535331Samw  * The transactions for mkdir, symlink, remove, rmdir, link, and rename
1545331Samw  * may have the following bit set, indicating the original request
1555331Samw  * specified case-insensitive handling of names.
1565331Samw  */
1575331Samw #define	TX_CI	((uint64_t)0x1 << 63) /* case-insensitive behavior requested */
158789Sahrens 
159789Sahrens /*
16010922SJeff.Bonwick@Sun.COM  * Transactions for write, truncate, setattr, acl_v0, and acl can be logged
16110922SJeff.Bonwick@Sun.COM  * out of order.  For convenience in the code, all such records must have
16210922SJeff.Bonwick@Sun.COM  * lr_foid at the same offset.
16310922SJeff.Bonwick@Sun.COM  */
16410922SJeff.Bonwick@Sun.COM #define	TX_OOO(txtype)			\
16510922SJeff.Bonwick@Sun.COM 	((txtype) == TX_WRITE ||	\
16610922SJeff.Bonwick@Sun.COM 	(txtype) == TX_TRUNCATE ||	\
16710922SJeff.Bonwick@Sun.COM 	(txtype) == TX_SETATTR ||	\
16810922SJeff.Bonwick@Sun.COM 	(txtype) == TX_ACL_V0 ||	\
16910922SJeff.Bonwick@Sun.COM 	(txtype) == TX_ACL ||		\
17010922SJeff.Bonwick@Sun.COM 	(txtype) == TX_WRITE2)
17110922SJeff.Bonwick@Sun.COM 
17210922SJeff.Bonwick@Sun.COM /*
173789Sahrens  * Format of log records.
174789Sahrens  * The fields are carefully defined to allow them to be aligned
175789Sahrens  * and sized the same on sparc & intel architectures.
176789Sahrens  * Each log record has a common structure at the beginning.
1772638Sperrin  *
17812699SNeil.Perrin@Sun.COM  * The log record on disk (lrc_seq) holds the sequence number of all log
17912699SNeil.Perrin@Sun.COM  * records which is used to ensure we don't replay the same record.
180789Sahrens  */
181789Sahrens typedef struct {			/* common log record header */
182789Sahrens 	uint64_t	lrc_txtype;	/* intent log transaction type */
183789Sahrens 	uint64_t	lrc_reclen;	/* transaction record length */
184789Sahrens 	uint64_t	lrc_txg;	/* dmu transaction group number */
1852638Sperrin 	uint64_t	lrc_seq;	/* see comment above */
186789Sahrens } lr_t;
187789Sahrens 
1885331Samw /*
18910922SJeff.Bonwick@Sun.COM  * Common start of all out-of-order record types (TX_OOO() above).
19010922SJeff.Bonwick@Sun.COM  */
19110922SJeff.Bonwick@Sun.COM typedef struct {
19210922SJeff.Bonwick@Sun.COM 	lr_t		lr_common;	/* common portion of log record */
19310922SJeff.Bonwick@Sun.COM 	uint64_t	lr_foid;	/* object id */
19410922SJeff.Bonwick@Sun.COM } lr_ooo_t;
19510922SJeff.Bonwick@Sun.COM 
19610922SJeff.Bonwick@Sun.COM /*
1975331Samw  * Handle option extended vattr attributes.
1985331Samw  *
1995331Samw  * Whenever new attributes are added the version number
2005331Samw  * will need to be updated as will code in
2015331Samw  * zfs_log.c and zfs_replay.c
2025331Samw  */
2035331Samw typedef struct {
2045331Samw 	uint32_t	lr_attr_masksize; /* number of elements in array */
2055331Samw 	uint32_t	lr_attr_bitmap; /* First entry of array */
2065331Samw 	/* remainder of array and any additional fields */
2075331Samw } lr_attr_t;
2085331Samw 
2095331Samw /*
2105331Samw  * log record for creates without optional ACL.
2115331Samw  * This log record does support optional xvattr_t attributes.
2125331Samw  */
213789Sahrens typedef struct {
214789Sahrens 	lr_t		lr_common;	/* common portion of log record */
215789Sahrens 	uint64_t	lr_doid;	/* object id of directory */
216789Sahrens 	uint64_t	lr_foid;	/* object id of created file object */
217789Sahrens 	uint64_t	lr_mode;	/* mode of object */
218789Sahrens 	uint64_t	lr_uid;		/* uid of object */
219789Sahrens 	uint64_t	lr_gid;		/* gid of object */
220789Sahrens 	uint64_t	lr_gen;		/* generation (txg of creation) */
221789Sahrens 	uint64_t	lr_crtime[2];	/* creation time */
222789Sahrens 	uint64_t	lr_rdev;	/* rdev of object to create */
223789Sahrens 	/* name of object to create follows this */
224789Sahrens 	/* for symlinks, link content follows name */
2255331Samw 	/* for creates with xvattr data, the name follows the xvattr info */
226789Sahrens } lr_create_t;
227789Sahrens 
2285331Samw /*
2295331Samw  * FUID ACL record will be an array of ACEs from the original ACL.
2305331Samw  * If this array includes ephemeral IDs, the record will also include
2315331Samw  * an array of log-specific FUIDs to replace the ephemeral IDs.
2325331Samw  * Only one copy of each unique domain will be present, so the log-specific
2335331Samw  * FUIDs will use an index into a compressed domain table.  On replay this
2345331Samw  * information will be used to construct real FUIDs (and bypass idmap,
2355331Samw  * since it may not be available).
2365331Samw  */
2375331Samw 
2385331Samw /*
2395331Samw  * Log record for creates with optional ACL
2405331Samw  * This log record is also used for recording any FUID
2415331Samw  * information needed for replaying the create.  If the
2425331Samw  * file doesn't have any actual ACEs then the lr_aclcnt
2435331Samw  * would be zero.
2445331Samw  */
2455331Samw typedef struct {
2465331Samw 	lr_create_t	lr_create;	/* common create portion */
2475331Samw 	uint64_t	lr_aclcnt;	/* number of ACEs in ACL */
2485331Samw 	uint64_t	lr_domcnt;	/* number of unique domains */
2495331Samw 	uint64_t	lr_fuidcnt;	/* number of real fuids */
2505331Samw 	uint64_t	lr_acl_bytes;	/* number of bytes in ACL */
2515331Samw 	uint64_t	lr_acl_flags;	/* ACL flags */
2525331Samw 	/* lr_acl_bytes number of variable sized ace's follows */
2535331Samw 	/* if create is also setting xvattr's, then acl data follows xvattr */
2545331Samw 	/* if ACE FUIDs are needed then they will follow the xvattr_t */
2555331Samw 	/* Following the FUIDs will be the domain table information. */
2565331Samw 	/* The FUIDs for the owner and group will be in the lr_create */
2575331Samw 	/* portion of the record. */
2585331Samw 	/* name follows ACL data */
2595331Samw } lr_acl_create_t;
2605331Samw 
261789Sahrens typedef struct {
262789Sahrens 	lr_t		lr_common;	/* common portion of log record */
263789Sahrens 	uint64_t	lr_doid;	/* obj id of directory */
264789Sahrens 	/* name of object to remove follows this */
265789Sahrens } lr_remove_t;
266789Sahrens 
267789Sahrens typedef struct {
268789Sahrens 	lr_t		lr_common;	/* common portion of log record */
269789Sahrens 	uint64_t	lr_doid;	/* obj id of directory */
270789Sahrens 	uint64_t	lr_link_obj;	/* obj id of link */
271789Sahrens 	/* name of object to link follows this */
272789Sahrens } lr_link_t;
273789Sahrens 
274789Sahrens typedef struct {
275789Sahrens 	lr_t		lr_common;	/* common portion of log record */
276789Sahrens 	uint64_t	lr_sdoid;	/* obj id of source directory */
277789Sahrens 	uint64_t	lr_tdoid;	/* obj id of target directory */
278789Sahrens 	/* 2 strings: names of source and destination follow this */
279789Sahrens } lr_rename_t;
280789Sahrens 
281789Sahrens typedef struct {
282789Sahrens 	lr_t		lr_common;	/* common portion of log record */
283789Sahrens 	uint64_t	lr_foid;	/* file object to write */
284789Sahrens 	uint64_t	lr_offset;	/* offset to write to */
285789Sahrens 	uint64_t	lr_length;	/* user data length to write */
28610922SJeff.Bonwick@Sun.COM 	uint64_t	lr_blkoff;	/* no longer used */
287789Sahrens 	blkptr_t	lr_blkptr;	/* spa block pointer for replay */
288789Sahrens 	/* write data will follow for small writes */
289789Sahrens } lr_write_t;
290789Sahrens 
291789Sahrens typedef struct {
292789Sahrens 	lr_t		lr_common;	/* common portion of log record */
293789Sahrens 	uint64_t	lr_foid;	/* object id of file to truncate */
294789Sahrens 	uint64_t	lr_offset;	/* offset to truncate from */
295789Sahrens 	uint64_t	lr_length;	/* length to truncate */
296789Sahrens } lr_truncate_t;
297789Sahrens 
298789Sahrens typedef struct {
299789Sahrens 	lr_t		lr_common;	/* common portion of log record */
300789Sahrens 	uint64_t	lr_foid;	/* file object to change attributes */
301789Sahrens 	uint64_t	lr_mask;	/* mask of attributes to set */
302789Sahrens 	uint64_t	lr_mode;	/* mode to set */
303789Sahrens 	uint64_t	lr_uid;		/* uid to set */
304789Sahrens 	uint64_t	lr_gid;		/* gid to set */
305789Sahrens 	uint64_t	lr_size;	/* size to set */
306789Sahrens 	uint64_t	lr_atime[2];	/* access time */
307789Sahrens 	uint64_t	lr_mtime[2];	/* modification time */
3085331Samw 	/* optional attribute lr_attr_t may be here */
309789Sahrens } lr_setattr_t;
310789Sahrens 
311789Sahrens typedef struct {
312789Sahrens 	lr_t		lr_common;	/* common portion of log record */
313789Sahrens 	uint64_t	lr_foid;	/* obj id of file */
314789Sahrens 	uint64_t	lr_aclcnt;	/* number of acl entries */
315789Sahrens 	/* lr_aclcnt number of ace_t entries follow this */
3165331Samw } lr_acl_v0_t;
3175331Samw 
3185331Samw typedef struct {
3195331Samw 	lr_t		lr_common;	/* common portion of log record */
3205331Samw 	uint64_t	lr_foid;	/* obj id of file */
3215331Samw 	uint64_t	lr_aclcnt;	/* number of ACEs in ACL */
3225331Samw 	uint64_t	lr_domcnt;	/* number of unique domains */
3235331Samw 	uint64_t	lr_fuidcnt;	/* number of real fuids */
3245331Samw 	uint64_t	lr_acl_bytes;	/* number of bytes in ACL */
3255331Samw 	uint64_t	lr_acl_flags;	/* ACL flags */
3265331Samw 	/* lr_acl_bytes number of variable sized ace's follows */
327789Sahrens } lr_acl_t;
328789Sahrens 
329789Sahrens /*
330789Sahrens  * ZIL structure definitions, interface function prototype and globals.
331789Sahrens  */
332789Sahrens 
333789Sahrens /*
3349401SNeil.Perrin@Sun.COM  * Writes are handled in three different ways:
3359401SNeil.Perrin@Sun.COM  *
3369401SNeil.Perrin@Sun.COM  * WR_INDIRECT:
3379401SNeil.Perrin@Sun.COM  *    In this mode, if we need to commit the write later, then the block
3389401SNeil.Perrin@Sun.COM  *    is immediately written into the file system (using dmu_sync),
3399401SNeil.Perrin@Sun.COM  *    and a pointer to the block is put into the log record.
3409401SNeil.Perrin@Sun.COM  *    When the txg commits the block is linked in.
3419401SNeil.Perrin@Sun.COM  *    This saves additionally writing the data into the log record.
3429401SNeil.Perrin@Sun.COM  *    There are a few requirements for this to occur:
3439401SNeil.Perrin@Sun.COM  *	- write is greater than zfs/zvol_immediate_write_sz
3449401SNeil.Perrin@Sun.COM  *	- not using slogs (as slogs are assumed to always be faster
3459401SNeil.Perrin@Sun.COM  *	  than writing into the main pool)
3469401SNeil.Perrin@Sun.COM  *	- the write occupies only one block
3479401SNeil.Perrin@Sun.COM  * WR_COPIED:
3489401SNeil.Perrin@Sun.COM  *    If we know we'll immediately be committing the
3499401SNeil.Perrin@Sun.COM  *    transaction (FSYNC or FDSYNC), the we allocate a larger
3509401SNeil.Perrin@Sun.COM  *    log record here for the data and copy the data in.
3519401SNeil.Perrin@Sun.COM  * WR_NEED_COPY:
3529401SNeil.Perrin@Sun.COM  *    Otherwise we don't allocate a buffer, and *if* we need to
3539401SNeil.Perrin@Sun.COM  *    flush the write later then a buffer is allocated and
3549401SNeil.Perrin@Sun.COM  *    we retrieve the data using the dmu.
355789Sahrens  */
3561669Sperrin typedef enum {
3571669Sperrin 	WR_INDIRECT,	/* indirect - a large write (dmu_sync() data */
3581669Sperrin 			/* and put blkptr in log, rather than actual data) */
3591669Sperrin 	WR_COPIED,	/* immediate - data is copied into lr_write_t */
3601669Sperrin 	WR_NEED_COPY,	/* immediate - data needs to be copied if pushed */
36110922SJeff.Bonwick@Sun.COM 	WR_NUM_STATES	/* number of states */
3621669Sperrin } itx_wr_state_t;
3631669Sperrin 
364789Sahrens typedef struct itx {
365789Sahrens 	list_node_t	itx_node;	/* linkage on zl_itx_list */
366789Sahrens 	void		*itx_private;	/* type-specific opaque data */
3671669Sperrin 	itx_wr_state_t	itx_wr_state;	/* write state */
3683063Sperrin 	uint8_t		itx_sync;	/* synchronous transaction */
3696101Sperrin 	uint64_t	itx_sod;	/* record size on disk */
370*12700SNeil.Perrin@Sun.COM 	uint64_t	itx_oid;	/* object id */
371789Sahrens 	lr_t		itx_lr;		/* common part of log record */
372789Sahrens 	/* followed by type-specific part of lr_xx_t and its immediate data */
373789Sahrens } itx_t;
374789Sahrens 
37510922SJeff.Bonwick@Sun.COM typedef int zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg,
376789Sahrens     uint64_t txg);
37710922SJeff.Bonwick@Sun.COM typedef int zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg,
378789Sahrens     uint64_t txg);
379789Sahrens typedef int zil_replay_func_t();
3802237Smaybee typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio);
381789Sahrens 
38210922SJeff.Bonwick@Sun.COM extern int zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
383789Sahrens     zil_parse_lr_func_t *parse_lr_func, void *arg, uint64_t txg);
384789Sahrens 
385789Sahrens extern void	zil_init(void);
386789Sahrens extern void	zil_fini(void);
387789Sahrens 
388789Sahrens extern zilog_t	*zil_alloc(objset_t *os, zil_header_t *zh_phys);
389789Sahrens extern void	zil_free(zilog_t *zilog);
390789Sahrens 
391789Sahrens extern zilog_t	*zil_open(objset_t *os, zil_get_data_t *get_data);
392789Sahrens extern void	zil_close(zilog_t *zilog);
393789Sahrens 
3948227SNeil.Perrin@Sun.COM extern void	zil_replay(objset_t *os, void *arg,
3958227SNeil.Perrin@Sun.COM     zil_replay_func_t *replay_func[TX_MAX_TYPE]);
39610922SJeff.Bonwick@Sun.COM extern boolean_t zil_replaying(zilog_t *zilog, dmu_tx_t *tx);
3971807Sbonwick extern void	zil_destroy(zilog_t *zilog, boolean_t keep_first);
3984935Sperrin extern void	zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
399789Sahrens 
4005331Samw extern itx_t	*zil_itx_create(uint64_t txtype, size_t lrsize);
40110922SJeff.Bonwick@Sun.COM extern void	zil_itx_destroy(itx_t *itx);
40212699SNeil.Perrin@Sun.COM extern void	zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
403789Sahrens 
40412699SNeil.Perrin@Sun.COM extern void	zil_commit(zilog_t *zilog, uint64_t oid);
405789Sahrens 
40611209SMatthew.Ahrens@Sun.COM extern int	zil_vdev_offline(const char *osname, void *txarg);
40711209SMatthew.Ahrens@Sun.COM extern int	zil_claim(const char *osname, void *txarg);
40811209SMatthew.Ahrens@Sun.COM extern int	zil_check_log_chain(const char *osname, void *txarg);
409789Sahrens extern void	zil_sync(zilog_t *zilog, dmu_tx_t *tx);
41012699SNeil.Perrin@Sun.COM extern void	zil_clean(zilog_t *zilog, uint64_t synced_txg);
411789Sahrens 
412789Sahrens extern int	zil_suspend(zilog_t *zilog);
413789Sahrens extern void	zil_resume(zilog_t *zilog);
414789Sahrens 
41510922SJeff.Bonwick@Sun.COM extern void	zil_add_block(zilog_t *zilog, const blkptr_t *bp);
41610922SJeff.Bonwick@Sun.COM extern int	zil_bp_tree_add(zilog_t *zilog, const blkptr_t *bp);
41710922SJeff.Bonwick@Sun.COM 
41812294SMark.Musante@Sun.COM extern void	zil_set_sync(zilog_t *zilog, uint64_t syncval);
41912294SMark.Musante@Sun.COM 
42010310SNeil.Perrin@Sun.COM extern void	zil_set_logbias(zilog_t *zilog, uint64_t slogval);
42110310SNeil.Perrin@Sun.COM 
42212294SMark.Musante@Sun.COM extern int zil_replay_disable;
423789Sahrens 
424789Sahrens #ifdef	__cplusplus
425789Sahrens }
426789Sahrens #endif
427789Sahrens 
428789Sahrens #endif	/* _SYS_ZIL_H */
429