xref: /OK3568_Linux_fs/u-boot/include/zfs/zil.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  *  GRUB  --  GRand Unified Bootloader
3*4882a593Smuzhiyun  *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun /*
8*4882a593Smuzhiyun  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
9*4882a593Smuzhiyun  * Use is subject to license terms.
10*4882a593Smuzhiyun  */
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #ifndef	_SYS_ZIL_H
13*4882a593Smuzhiyun #define	_SYS_ZIL_H
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /*
16*4882a593Smuzhiyun  * Intent log format:
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * Each objset has its own intent log.  The log header (zil_header_t)
19*4882a593Smuzhiyun  * for objset N's intent log is kept in the Nth object of the SPA's
20*4882a593Smuzhiyun  * intent_log objset.  The log header points to a chain of log blocks,
21*4882a593Smuzhiyun  * each of which contains log records (i.e., transactions) followed by
22*4882a593Smuzhiyun  * a log block trailer (zil_trailer_t).  The format of a log record
23*4882a593Smuzhiyun  * depends on the record (or transaction) type, but all records begin
24*4882a593Smuzhiyun  * with a common structure that defines the type, length, and txg.
25*4882a593Smuzhiyun  */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun /*
28*4882a593Smuzhiyun  * Intent log header - this on disk structure holds fields to manage
29*4882a593Smuzhiyun  * the log.  All fields are 64 bit to easily handle cross architectures.
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun typedef struct zil_header {
32*4882a593Smuzhiyun 	uint64_t zh_claim_txg;   /* txg in which log blocks were claimed */
33*4882a593Smuzhiyun 	uint64_t zh_replay_seq;  /* highest replayed sequence number */
34*4882a593Smuzhiyun 	blkptr_t zh_log;	/* log chain */
35*4882a593Smuzhiyun 	uint64_t zh_claim_seq;	/* highest claimed sequence number */
36*4882a593Smuzhiyun 	uint64_t zh_flags;	/* header flags */
37*4882a593Smuzhiyun 	uint64_t zh_pad[4];
38*4882a593Smuzhiyun } zil_header_t;
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun /*
41*4882a593Smuzhiyun  * zh_flags bit settings
42*4882a593Smuzhiyun  */
43*4882a593Smuzhiyun #define	ZIL_REPLAY_NEEDED 0x1	/* replay needed - internal only */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif	/* _SYS_ZIL_H */
46