usr/src/uts/common/fs/zfs/sys/zil.h
author Neil Perrin <Neil.Perrin@Sun.COM>
Thu, 18 Sep 2008 17:18:10 -0600
changeset 7638 5505e89fa6c8
parent 7294 c9c31ef4c960
child 8227 f7d7be9b1f56
permissions -rw-r--r--
6741237 zfs hang in txg_wait_open() on boot
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1646
b4e43ae19fff 6393443 Remove remaining txg_wait_synced() from zfs unmount path.
perrin
parents: 789
diff changeset
     5
 * Common Development and Distribution License (the "License").
b4e43ae19fff 6393443 Remove remaining txg_wait_synced() from zfs unmount path.
perrin
parents: 789
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
6101
915df4cedbc9 6658511 zl_itx_list_sz incorrect for WR_NEED_COPY writes
perrin
parents: 5688
diff changeset
    22
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#ifndef	_SYS_ZIL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_ZIL_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#include <sys/types.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
#include <sys/spa.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
#include <sys/zio.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
#include <sys/dmu.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    39
 * Intent log format:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    40
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
 * Each objset has its own intent log.  The log header (zil_header_t)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
 * for objset N's intent log is kept in the Nth object of the SPA's
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    43
 * intent_log objset.  The log header points to a chain of log blocks,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
 * each of which contains log records (i.e., transactions) followed by
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
 * a log block trailer (zil_trailer_t).  The format of a log record
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    46
 * depends on the record (or transaction) type, but all records begin
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    47
 * with a common structure that defines the type, length, and txg.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    48
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    49
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    50
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
 * Intent log header - this on disk structure holds fields to manage
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
 * the log.  All fields are 64 bit to easily handle cross architectures.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
typedef struct zil_header {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
	uint64_t zh_claim_txg;	/* txg in which log blocks were claimed */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    56
	uint64_t zh_replay_seq;	/* highest replayed sequence number */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
	blkptr_t zh_log;	/* log chain */
1807
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    58
	uint64_t zh_claim_seq;	/* highest claimed sequence number */
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    59
	uint64_t zh_pad[5];
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
} zil_header_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
 * Log block trailer - structure at the end of the header and each log block
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    64
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    65
 * The zit_bt contains a zbt_cksum which for the intent log is
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    66
 * the sequence number of this log block. A seq of 0 is invalid.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
 * The zbt_cksum is checked by the SPA against the sequence
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
 * number passed in the blk_cksum field of the blkptr_t
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
typedef struct zil_trailer {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
	uint64_t zit_pad;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
	blkptr_t zit_next_blk;	/* next block in chain */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    73
	uint64_t zit_nused;	/* bytes in log block used */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    74
	zio_block_tail_t zit_bt; /* block trailer */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    75
} zil_trailer_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    76
1842
1712a484fc9d 6413731 pathologically slower fsync on 32 bit systems
perrin
parents: 1807
diff changeset
    77
#define	ZIL_MIN_BLKSZ	4096ULL
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    78
#define	ZIL_MAX_BLKSZ	SPA_MAXBLOCKSIZE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    79
#define	ZIL_BLK_DATA_SZ(lwb)	((lwb)->lwb_sz - sizeof (zil_trailer_t))
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    80
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    81
/*
1807
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    82
 * The words of a log block checksum.
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    83
 */
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    84
#define	ZIL_ZC_GUID_0	0
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    85
#define	ZIL_ZC_GUID_1	1
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    86
#define	ZIL_ZC_OBJSET	2
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    87
#define	ZIL_ZC_SEQ	3
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
    88
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    89
typedef enum zil_create {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    90
	Z_FILE,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    91
	Z_DIR,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    92
	Z_XATTRDIR,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    93
} zil_create_t;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    94
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    95
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    96
 * size of xvattr log section.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    97
 * its composed of lr_attr_t + xvattr bitmap + 2 64 bit timestamps
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    98
 * for create time and a single 64 bit integer for all of the attributes,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
    99
 * and 4 64 bit integers (32 bytes) for the scanstamp.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   100
 *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   101
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   102
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   103
#define	ZIL_XVAT_SIZE(mapsize) \
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   104
	sizeof (lr_attr_t) + (sizeof (uint32_t) * (mapsize - 1)) + \
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   105
	(sizeof (uint64_t) * 7)
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   106
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   107
/*
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   108
 * Size of ACL in log.  The ACE data is padded out to properly align
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   109
 * on 8 byte boundary.
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   110
 */
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   111
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   112
#define	ZIL_ACE_LENGTH(x)	(roundup(x, sizeof (uint64_t)))
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   113
1807
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
   114
/*
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   115
 * Intent log transaction types and record structures
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   116
 */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   117
#define	TX_CREATE		1	/* Create file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   118
#define	TX_MKDIR		2	/* Make directory */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   119
#define	TX_MKXATTR		3	/* Make XATTR directory */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   120
#define	TX_SYMLINK		4	/* Create symbolic link to a file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   121
#define	TX_REMOVE		5	/* Remove file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   122
#define	TX_RMDIR		6	/* Remove directory */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   123
#define	TX_LINK			7	/* Create hard link to a file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   124
#define	TX_RENAME		8	/* Rename a file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   125
#define	TX_WRITE		9	/* File write */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   126
#define	TX_TRUNCATE		10	/* Truncate a file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   127
#define	TX_SETATTR		11	/* Set file attributes */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   128
#define	TX_ACL_V0		12	/* Set old formatted ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   129
#define	TX_ACL			13	/* Set ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   130
#define	TX_CREATE_ACL		14	/* create with ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   131
#define	TX_CREATE_ATTR		15	/* create + attrs */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   132
#define	TX_CREATE_ACL_ATTR 	16	/* create with ACL + attrs */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   133
#define	TX_MKDIR_ACL		17	/* mkdir with ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   134
#define	TX_MKDIR_ATTR		18	/* mkdir with attr */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   135
#define	TX_MKDIR_ACL_ATTR	19	/* mkdir with ACL + attrs */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   136
#define	TX_MAX_TYPE		20	/* Max transaction type */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   137
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   138
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   139
 * The transactions for mkdir, symlink, remove, rmdir, link, and rename
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   140
 * may have the following bit set, indicating the original request
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   141
 * specified case-insensitive handling of names.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   142
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   143
#define	TX_CI	((uint64_t)0x1 << 63) /* case-insensitive behavior requested */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   144
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   145
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   146
 * Format of log records.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   147
 * The fields are carefully defined to allow them to be aligned
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   148
 * and sized the same on sparc & intel architectures.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   149
 * Each log record has a common structure at the beginning.
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   150
 *
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   151
 * Note, lrc_seq holds two different sequence numbers. Whilst in memory
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   152
 * it contains the transaction sequence number.  The log record on
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   153
 * disk holds the sequence number of all log records which is used to
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   154
 * ensure we don't replay the same record.  The two sequence numbers are
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   155
 * different because the transactions can now be pushed out of order.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   156
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   157
typedef struct {			/* common log record header */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   158
	uint64_t	lrc_txtype;	/* intent log transaction type */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   159
	uint64_t	lrc_reclen;	/* transaction record length */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   160
	uint64_t	lrc_txg;	/* dmu transaction group number */
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   161
	uint64_t	lrc_seq;	/* see comment above */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   162
} lr_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   163
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   164
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   165
 * Handle option extended vattr attributes.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   166
 *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   167
 * Whenever new attributes are added the version number
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   168
 * will need to be updated as will code in
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   169
 * zfs_log.c and zfs_replay.c
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   170
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   171
typedef struct {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   172
	uint32_t	lr_attr_masksize; /* number of elements in array */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   173
	uint32_t	lr_attr_bitmap; /* First entry of array */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   174
	/* remainder of array and any additional fields */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   175
} lr_attr_t;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   176
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   177
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   178
 * log record for creates without optional ACL.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   179
 * This log record does support optional xvattr_t attributes.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   180
 */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   181
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   182
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   183
	uint64_t	lr_doid;	/* object id of directory */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   184
	uint64_t	lr_foid;	/* object id of created file object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   185
	uint64_t	lr_mode;	/* mode of object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   186
	uint64_t	lr_uid;		/* uid of object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   187
	uint64_t	lr_gid;		/* gid of object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   188
	uint64_t	lr_gen;		/* generation (txg of creation) */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   189
	uint64_t	lr_crtime[2];	/* creation time */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   190
	uint64_t	lr_rdev;	/* rdev of object to create */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   191
	/* name of object to create follows this */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   192
	/* for symlinks, link content follows name */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   193
	/* for creates with xvattr data, the name follows the xvattr info */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   194
} lr_create_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   195
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   196
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   197
 * FUID ACL record will be an array of ACEs from the original ACL.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   198
 * If this array includes ephemeral IDs, the record will also include
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   199
 * an array of log-specific FUIDs to replace the ephemeral IDs.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   200
 * Only one copy of each unique domain will be present, so the log-specific
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   201
 * FUIDs will use an index into a compressed domain table.  On replay this
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   202
 * information will be used to construct real FUIDs (and bypass idmap,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   203
 * since it may not be available).
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   204
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   205
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   206
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   207
 * Log record for creates with optional ACL
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   208
 * This log record is also used for recording any FUID
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   209
 * information needed for replaying the create.  If the
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   210
 * file doesn't have any actual ACEs then the lr_aclcnt
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   211
 * would be zero.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   212
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   213
typedef struct {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   214
	lr_create_t	lr_create;	/* common create portion */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   215
	uint64_t	lr_aclcnt;	/* number of ACEs in ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   216
	uint64_t	lr_domcnt;	/* number of unique domains */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   217
	uint64_t	lr_fuidcnt;	/* number of real fuids */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   218
	uint64_t	lr_acl_bytes;	/* number of bytes in ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   219
	uint64_t	lr_acl_flags;	/* ACL flags */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   220
	/* lr_acl_bytes number of variable sized ace's follows */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   221
	/* if create is also setting xvattr's, then acl data follows xvattr */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   222
	/* if ACE FUIDs are needed then they will follow the xvattr_t */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   223
	/* Following the FUIDs will be the domain table information. */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   224
	/* The FUIDs for the owner and group will be in the lr_create */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   225
	/* portion of the record. */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   226
	/* name follows ACL data */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   227
} lr_acl_create_t;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   228
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   229
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   230
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   231
	uint64_t	lr_doid;	/* obj id of directory */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   232
	/* name of object to remove follows this */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   233
} lr_remove_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   234
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   235
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   236
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   237
	uint64_t	lr_doid;	/* obj id of directory */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   238
	uint64_t	lr_link_obj;	/* obj id of link */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   239
	/* name of object to link follows this */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   240
} lr_link_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   241
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   242
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   243
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   244
	uint64_t	lr_sdoid;	/* obj id of source directory */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   245
	uint64_t	lr_tdoid;	/* obj id of target directory */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   246
	/* 2 strings: names of source and destination follow this */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   247
} lr_rename_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   248
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   249
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   250
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   251
	uint64_t	lr_foid;	/* file object to write */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   252
	uint64_t	lr_offset;	/* offset to write to */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   253
	uint64_t	lr_length;	/* user data length to write */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   254
	uint64_t	lr_blkoff;	/* offset represented by lr_blkptr */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   255
	blkptr_t	lr_blkptr;	/* spa block pointer for replay */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   256
	/* write data will follow for small writes */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   257
} lr_write_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   258
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   259
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   260
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   261
	uint64_t	lr_foid;	/* object id of file to truncate */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   262
	uint64_t	lr_offset;	/* offset to truncate from */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   263
	uint64_t	lr_length;	/* length to truncate */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   264
} lr_truncate_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   265
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   266
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   267
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   268
	uint64_t	lr_foid;	/* file object to change attributes */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   269
	uint64_t	lr_mask;	/* mask of attributes to set */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   270
	uint64_t	lr_mode;	/* mode to set */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   271
	uint64_t	lr_uid;		/* uid to set */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   272
	uint64_t	lr_gid;		/* gid to set */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   273
	uint64_t	lr_size;	/* size to set */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   274
	uint64_t	lr_atime[2];	/* access time */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   275
	uint64_t	lr_mtime[2];	/* modification time */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   276
	/* optional attribute lr_attr_t may be here */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   277
} lr_setattr_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   278
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   279
typedef struct {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   280
	lr_t		lr_common;	/* common portion of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   281
	uint64_t	lr_foid;	/* obj id of file */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   282
	uint64_t	lr_aclcnt;	/* number of acl entries */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   283
	/* lr_aclcnt number of ace_t entries follow this */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   284
} lr_acl_v0_t;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   285
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   286
typedef struct {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   287
	lr_t		lr_common;	/* common portion of log record */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   288
	uint64_t	lr_foid;	/* obj id of file */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   289
	uint64_t	lr_aclcnt;	/* number of ACEs in ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   290
	uint64_t	lr_domcnt;	/* number of unique domains */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   291
	uint64_t	lr_fuidcnt;	/* number of real fuids */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   292
	uint64_t	lr_acl_bytes;	/* number of bytes in ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   293
	uint64_t	lr_acl_flags;	/* ACL flags */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   294
	/* lr_acl_bytes number of variable sized ace's follows */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   295
} lr_acl_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   296
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   297
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   298
 * ZIL structure definitions, interface function prototype and globals.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   299
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   300
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   301
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   302
 * ZFS intent log transaction structure
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   303
 */
1669
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   304
typedef enum {
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   305
	WR_INDIRECT,	/* indirect - a large write (dmu_sync() data */
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   306
			/* and put blkptr in log, rather than actual data) */
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   307
	WR_COPIED,	/* immediate - data is copied into lr_write_t */
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   308
	WR_NEED_COPY,	/* immediate - data needs to be copied if pushed */
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   309
} itx_wr_state_t;
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   310
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   311
typedef struct itx {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   312
	list_node_t	itx_node;	/* linkage on zl_itx_list */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   313
	void		*itx_private;	/* type-specific opaque data */
1669
3521dbbcb2e8 6343608 ZFS file range locking
perrin
parents: 1646
diff changeset
   314
	itx_wr_state_t	itx_wr_state;	/* write state */
3063
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   315
	uint8_t		itx_sync;	/* synchronous transaction */
6101
915df4cedbc9 6658511 zl_itx_list_sz incorrect for WR_NEED_COPY writes
perrin
parents: 5688
diff changeset
   316
	uint64_t	itx_sod;	/* record size on disk */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   317
	lr_t		itx_lr;		/* common part of log record */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   318
	/* followed by type-specific part of lr_xx_t and its immediate data */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   319
} itx_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   320
3063
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   321
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   322
/*
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   323
 * zgd_t is passed through dmu_sync() to the callback routine zfs_get_done()
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   324
 * to handle the cleanup of the dmu_sync() buffer write
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   325
 */
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   326
typedef struct {
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   327
	zilog_t		*zgd_zilog;	/* zilog */
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   328
	blkptr_t	*zgd_bp;	/* block pointer */
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   329
	struct rl	*zgd_rl;	/* range lock */
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   330
} zgd_t;
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   331
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   332
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   333
typedef void zil_parse_blk_func_t(zilog_t *zilog, blkptr_t *bp, void *arg,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   334
    uint64_t txg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   335
typedef void zil_parse_lr_func_t(zilog_t *zilog, lr_t *lr, void *arg,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   336
    uint64_t txg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   337
typedef int zil_replay_func_t();
7638
5505e89fa6c8 6741237 zfs hang in txg_wait_open() on boot
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 7294
diff changeset
   338
typedef void zil_replay_cleaner_t();
2237
45affe88ed99 6416482 filebench oltp workload hangs in zfs
maybee
parents: 2199
diff changeset
   339
typedef int zil_get_data_t(void *arg, lr_write_t *lr, char *dbuf, zio_t *zio);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   340
1807
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
   341
extern uint64_t	zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   342
    zil_parse_lr_func_t *parse_lr_func, void *arg, uint64_t txg);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   343
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   344
extern void	zil_init(void);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   345
extern void	zil_fini(void);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   346
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   347
extern zilog_t	*zil_alloc(objset_t *os, zil_header_t *zh_phys);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   348
extern void	zil_free(zilog_t *zilog);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   349
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   350
extern zilog_t	*zil_open(objset_t *os, zil_get_data_t *get_data);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   351
extern void	zil_close(zilog_t *zilog);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   352
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   353
extern void	zil_replay(objset_t *os, void *arg, uint64_t *txgp,
7638
5505e89fa6c8 6741237 zfs hang in txg_wait_open() on boot
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 7294
diff changeset
   354
    zil_replay_func_t *replay_func[TX_MAX_TYPE],
5505e89fa6c8 6741237 zfs hang in txg_wait_open() on boot
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 7294
diff changeset
   355
    zil_replay_cleaner_t *replay_cleaner);
1807
35c8b566d7af 6410711 intent log blocks don't get invited to pool parties
bonwick
parents: 1669
diff changeset
   356
extern void	zil_destroy(zilog_t *zilog, boolean_t keep_first);
4935
c80bf0e6f4aa 6534949 Stale need for range locking comment in zvol.c
perrin
parents: 3461
diff changeset
   357
extern void	zil_rollback_destroy(zilog_t *zilog, dmu_tx_t *tx);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   358
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4935
diff changeset
   359
extern itx_t	*zil_itx_create(uint64_t txtype, size_t lrsize);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   360
extern uint64_t zil_itx_assign(zilog_t *zilog, itx_t *itx, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   361
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 2237
diff changeset
   362
extern void	zil_commit(zilog_t *zilog, uint64_t seq, uint64_t oid);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   363
2199
712a788c2dfd PSARC 2006/388 snapshot -r
ahrens
parents: 1842
diff changeset
   364
extern int	zil_claim(char *osname, void *txarg);
7294
c9c31ef4c960 PSARC 2008/486 Intent log replay failure handling
perrin
parents: 6101
diff changeset
   365
extern int	zil_check_log_chain(char *osname, void *txarg);
c9c31ef4c960 PSARC 2008/486 Intent log replay failure handling
perrin
parents: 6101
diff changeset
   366
extern int	zil_clear_log_chain(char *osname, void *txarg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   367
extern void	zil_sync(zilog_t *zilog, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   368
extern void	zil_clean(zilog_t *zilog);
1646
b4e43ae19fff 6393443 Remove remaining txg_wait_synced() from zfs unmount path.
perrin
parents: 789
diff changeset
   369
extern int	zil_is_committed(zilog_t *zilog);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   370
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   371
extern int	zil_suspend(zilog_t *zilog);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   372
extern void	zil_resume(zilog_t *zilog);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   373
5688
c0b02c8fd2c0 6640580 spa_get_random() is insanely slow in userland
bonwick
parents: 5435
diff changeset
   374
extern void	zil_add_block(zilog_t *zilog, blkptr_t *bp);
3063
b252896b372b 6341569 zio_alloc_blk() vdev distribution performs badly
perrin
parents: 2638
diff changeset
   375
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   376
extern int zil_disable;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   377
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   378
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   379
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   380
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   381
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   382
#endif	/* _SYS_ZIL_H */