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