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