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