xref: /openbmc/u-boot/include/zfs/zil.h (revision 4d3c95f5)
1*4d3c95f5SJorgen Lundman /*
2*4d3c95f5SJorgen Lundman  *  GRUB  --  GRand Unified Bootloader
3*4d3c95f5SJorgen Lundman  *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
4*4d3c95f5SJorgen Lundman  *
5*4d3c95f5SJorgen Lundman  *  This program is free software; you can redistribute it and/or modify
6*4d3c95f5SJorgen Lundman  *  it under the terms of the GNU General Public License as published by
7*4d3c95f5SJorgen Lundman  *  the Free Software Foundation; either version 2 of the License, or
8*4d3c95f5SJorgen Lundman  *  (at your option) any later version.
9*4d3c95f5SJorgen Lundman  *
10*4d3c95f5SJorgen Lundman  *  This program is distributed in the hope that it will be useful,
11*4d3c95f5SJorgen Lundman  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12*4d3c95f5SJorgen Lundman  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13*4d3c95f5SJorgen Lundman  *  GNU General Public License for more details.
14*4d3c95f5SJorgen Lundman  *
15*4d3c95f5SJorgen Lundman  *  You should have received a copy of the GNU General Public License
16*4d3c95f5SJorgen Lundman  *  along with this program; if not, write to the Free Software
17*4d3c95f5SJorgen Lundman  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*4d3c95f5SJorgen Lundman  */
19*4d3c95f5SJorgen Lundman /*
20*4d3c95f5SJorgen Lundman  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
21*4d3c95f5SJorgen Lundman  * Use is subject to license terms.
22*4d3c95f5SJorgen Lundman  */
23*4d3c95f5SJorgen Lundman 
24*4d3c95f5SJorgen Lundman #ifndef	_SYS_ZIL_H
25*4d3c95f5SJorgen Lundman #define	_SYS_ZIL_H
26*4d3c95f5SJorgen Lundman 
27*4d3c95f5SJorgen Lundman /*
28*4d3c95f5SJorgen Lundman  * Intent log format:
29*4d3c95f5SJorgen Lundman  *
30*4d3c95f5SJorgen Lundman  * Each objset has its own intent log.  The log header (zil_header_t)
31*4d3c95f5SJorgen Lundman  * for objset N's intent log is kept in the Nth object of the SPA's
32*4d3c95f5SJorgen Lundman  * intent_log objset.  The log header points to a chain of log blocks,
33*4d3c95f5SJorgen Lundman  * each of which contains log records (i.e., transactions) followed by
34*4d3c95f5SJorgen Lundman  * a log block trailer (zil_trailer_t).  The format of a log record
35*4d3c95f5SJorgen Lundman  * depends on the record (or transaction) type, but all records begin
36*4d3c95f5SJorgen Lundman  * with a common structure that defines the type, length, and txg.
37*4d3c95f5SJorgen Lundman  */
38*4d3c95f5SJorgen Lundman 
39*4d3c95f5SJorgen Lundman /*
40*4d3c95f5SJorgen Lundman  * Intent log header - this on disk structure holds fields to manage
41*4d3c95f5SJorgen Lundman  * the log.  All fields are 64 bit to easily handle cross architectures.
42*4d3c95f5SJorgen Lundman  */
43*4d3c95f5SJorgen Lundman typedef struct zil_header {
44*4d3c95f5SJorgen Lundman 	uint64_t zh_claim_txg;   /* txg in which log blocks were claimed */
45*4d3c95f5SJorgen Lundman 	uint64_t zh_replay_seq;  /* highest replayed sequence number */
46*4d3c95f5SJorgen Lundman 	blkptr_t zh_log;	/* log chain */
47*4d3c95f5SJorgen Lundman 	uint64_t zh_claim_seq;	/* highest claimed sequence number */
48*4d3c95f5SJorgen Lundman 	uint64_t zh_flags;	/* header flags */
49*4d3c95f5SJorgen Lundman 	uint64_t zh_pad[4];
50*4d3c95f5SJorgen Lundman } zil_header_t;
51*4d3c95f5SJorgen Lundman 
52*4d3c95f5SJorgen Lundman /*
53*4d3c95f5SJorgen Lundman  * zh_flags bit settings
54*4d3c95f5SJorgen Lundman  */
55*4d3c95f5SJorgen Lundman #define	ZIL_REPLAY_NEEDED 0x1	/* replay needed - internal only */
56*4d3c95f5SJorgen Lundman 
57*4d3c95f5SJorgen Lundman #endif	/* _SYS_ZIL_H */
58