162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
462306a36Sopenharmony_ci * All Rights Reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef	__XFS_LOG_FORMAT_H__
762306a36Sopenharmony_ci#define __XFS_LOG_FORMAT_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct xfs_mount;
1062306a36Sopenharmony_cistruct xfs_trans_res;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/*
1362306a36Sopenharmony_ci * On-disk Log Format definitions.
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * This file contains all the on-disk format definitions used within the log. It
1662306a36Sopenharmony_ci * includes the physical log structure itself, as well as all the log item
1762306a36Sopenharmony_ci * format structures that are written into the log and intepreted by log
1862306a36Sopenharmony_ci * recovery. We start with the physical log format definitions, and then work
1962306a36Sopenharmony_ci * through all the log items definitions and everything they encode into the
2062306a36Sopenharmony_ci * log.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_citypedef uint32_t xlog_tid_t;
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define XLOG_MIN_ICLOGS		2
2562306a36Sopenharmony_ci#define XLOG_MAX_ICLOGS		8
2662306a36Sopenharmony_ci#define XLOG_HEADER_MAGIC_NUM	0xFEEDbabe	/* Invalid cycle number */
2762306a36Sopenharmony_ci#define XLOG_VERSION_1		1
2862306a36Sopenharmony_ci#define XLOG_VERSION_2		2		/* Large IClogs, Log sunit */
2962306a36Sopenharmony_ci#define XLOG_VERSION_OKBITS	(XLOG_VERSION_1 | XLOG_VERSION_2)
3062306a36Sopenharmony_ci#define XLOG_MIN_RECORD_BSIZE	(16*1024)	/* eventually 32k */
3162306a36Sopenharmony_ci#define XLOG_BIG_RECORD_BSIZE	(32*1024)	/* 32k buffers */
3262306a36Sopenharmony_ci#define XLOG_MAX_RECORD_BSIZE	(256*1024)
3362306a36Sopenharmony_ci#define XLOG_HEADER_CYCLE_SIZE	(32*1024)	/* cycle data in header */
3462306a36Sopenharmony_ci#define XLOG_MIN_RECORD_BSHIFT	14		/* 16384 == 1 << 14 */
3562306a36Sopenharmony_ci#define XLOG_BIG_RECORD_BSHIFT	15		/* 32k == 1 << 15 */
3662306a36Sopenharmony_ci#define XLOG_MAX_RECORD_BSHIFT	18		/* 256k == 1 << 18 */
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define XLOG_HEADER_SIZE	512
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* Minimum number of transactions that must fit in the log (defined by mkfs) */
4162306a36Sopenharmony_ci#define XFS_MIN_LOG_FACTOR	3
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define XLOG_REC_SHIFT(log) \
4462306a36Sopenharmony_ci	BTOBB(1 << (xfs_has_logv2(log->l_mp) ? \
4562306a36Sopenharmony_ci	 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
4662306a36Sopenharmony_ci#define XLOG_TOTAL_REC_SHIFT(log) \
4762306a36Sopenharmony_ci	BTOBB(XLOG_MAX_ICLOGS << (xfs_has_logv2(log->l_mp) ? \
4862306a36Sopenharmony_ci	 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* get lsn fields */
5162306a36Sopenharmony_ci#define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
5262306a36Sopenharmony_ci#define BLOCK_LSN(lsn) ((uint)(lsn))
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* this is used in a spot where we might otherwise double-endian-flip */
5562306a36Sopenharmony_ci#define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistatic inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)
5862306a36Sopenharmony_ci{
5962306a36Sopenharmony_ci	return ((xfs_lsn_t)cycle << 32) | block;
6062306a36Sopenharmony_ci}
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cistatic inline uint xlog_get_cycle(char *ptr)
6362306a36Sopenharmony_ci{
6462306a36Sopenharmony_ci	if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
6562306a36Sopenharmony_ci		return be32_to_cpu(*((__be32 *)ptr + 1));
6662306a36Sopenharmony_ci	else
6762306a36Sopenharmony_ci		return be32_to_cpu(*(__be32 *)ptr);
6862306a36Sopenharmony_ci}
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/* Log Clients */
7162306a36Sopenharmony_ci#define XFS_TRANSACTION		0x69
7262306a36Sopenharmony_ci#define XFS_LOG			0xaa
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define XLOG_UNMOUNT_TYPE	0x556e	/* Un for Unmount */
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci/*
7762306a36Sopenharmony_ci * Log item for unmount records.
7862306a36Sopenharmony_ci *
7962306a36Sopenharmony_ci * The unmount record used to have a string "Unmount filesystem--" in the
8062306a36Sopenharmony_ci * data section where the "Un" was really a magic number (XLOG_UNMOUNT_TYPE).
8162306a36Sopenharmony_ci * We just write the magic number now; see xfs_log_unmount_write.
8262306a36Sopenharmony_ci */
8362306a36Sopenharmony_cistruct xfs_unmount_log_format {
8462306a36Sopenharmony_ci	uint16_t	magic;	/* XLOG_UNMOUNT_TYPE */
8562306a36Sopenharmony_ci	uint16_t	pad1;
8662306a36Sopenharmony_ci	uint32_t	pad2;	/* may as well make it 64 bits */
8762306a36Sopenharmony_ci};
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* Region types for iovec's i_type */
9062306a36Sopenharmony_ci#define XLOG_REG_TYPE_BFORMAT		1
9162306a36Sopenharmony_ci#define XLOG_REG_TYPE_BCHUNK		2
9262306a36Sopenharmony_ci#define XLOG_REG_TYPE_EFI_FORMAT	3
9362306a36Sopenharmony_ci#define XLOG_REG_TYPE_EFD_FORMAT	4
9462306a36Sopenharmony_ci#define XLOG_REG_TYPE_IFORMAT		5
9562306a36Sopenharmony_ci#define XLOG_REG_TYPE_ICORE		6
9662306a36Sopenharmony_ci#define XLOG_REG_TYPE_IEXT		7
9762306a36Sopenharmony_ci#define XLOG_REG_TYPE_IBROOT		8
9862306a36Sopenharmony_ci#define XLOG_REG_TYPE_ILOCAL		9
9962306a36Sopenharmony_ci#define XLOG_REG_TYPE_IATTR_EXT		10
10062306a36Sopenharmony_ci#define XLOG_REG_TYPE_IATTR_BROOT	11
10162306a36Sopenharmony_ci#define XLOG_REG_TYPE_IATTR_LOCAL	12
10262306a36Sopenharmony_ci#define XLOG_REG_TYPE_QFORMAT		13
10362306a36Sopenharmony_ci#define XLOG_REG_TYPE_DQUOT		14
10462306a36Sopenharmony_ci#define XLOG_REG_TYPE_QUOTAOFF		15
10562306a36Sopenharmony_ci#define XLOG_REG_TYPE_LRHEADER		16
10662306a36Sopenharmony_ci#define XLOG_REG_TYPE_UNMOUNT		17
10762306a36Sopenharmony_ci#define XLOG_REG_TYPE_COMMIT		18
10862306a36Sopenharmony_ci#define XLOG_REG_TYPE_TRANSHDR		19
10962306a36Sopenharmony_ci#define XLOG_REG_TYPE_ICREATE		20
11062306a36Sopenharmony_ci#define XLOG_REG_TYPE_RUI_FORMAT	21
11162306a36Sopenharmony_ci#define XLOG_REG_TYPE_RUD_FORMAT	22
11262306a36Sopenharmony_ci#define XLOG_REG_TYPE_CUI_FORMAT	23
11362306a36Sopenharmony_ci#define XLOG_REG_TYPE_CUD_FORMAT	24
11462306a36Sopenharmony_ci#define XLOG_REG_TYPE_BUI_FORMAT	25
11562306a36Sopenharmony_ci#define XLOG_REG_TYPE_BUD_FORMAT	26
11662306a36Sopenharmony_ci#define XLOG_REG_TYPE_ATTRI_FORMAT	27
11762306a36Sopenharmony_ci#define XLOG_REG_TYPE_ATTRD_FORMAT	28
11862306a36Sopenharmony_ci#define XLOG_REG_TYPE_ATTR_NAME	29
11962306a36Sopenharmony_ci#define XLOG_REG_TYPE_ATTR_VALUE	30
12062306a36Sopenharmony_ci#define XLOG_REG_TYPE_MAX		30
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/*
12462306a36Sopenharmony_ci * Flags to log operation header
12562306a36Sopenharmony_ci *
12662306a36Sopenharmony_ci * The first write of a new transaction will be preceded with a start
12762306a36Sopenharmony_ci * record, XLOG_START_TRANS.  Once a transaction is committed, a commit
12862306a36Sopenharmony_ci * record is written, XLOG_COMMIT_TRANS.  If a single region can not fit into
12962306a36Sopenharmony_ci * the remainder of the current active in-core log, it is split up into
13062306a36Sopenharmony_ci * multiple regions.  Each partial region will be marked with a
13162306a36Sopenharmony_ci * XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS.
13262306a36Sopenharmony_ci *
13362306a36Sopenharmony_ci */
13462306a36Sopenharmony_ci#define XLOG_START_TRANS	0x01	/* Start a new transaction */
13562306a36Sopenharmony_ci#define XLOG_COMMIT_TRANS	0x02	/* Commit this transaction */
13662306a36Sopenharmony_ci#define XLOG_CONTINUE_TRANS	0x04	/* Cont this trans into new region */
13762306a36Sopenharmony_ci#define XLOG_WAS_CONT_TRANS	0x08	/* Cont this trans into new region */
13862306a36Sopenharmony_ci#define XLOG_END_TRANS		0x10	/* End a continued transaction */
13962306a36Sopenharmony_ci#define XLOG_UNMOUNT_TRANS	0x20	/* Unmount a filesystem transaction */
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_citypedef struct xlog_op_header {
14362306a36Sopenharmony_ci	__be32	   oh_tid;	/* transaction id of operation	:  4 b */
14462306a36Sopenharmony_ci	__be32	   oh_len;	/* bytes in data region		:  4 b */
14562306a36Sopenharmony_ci	__u8	   oh_clientid;	/* who sent me this		:  1 b */
14662306a36Sopenharmony_ci	__u8	   oh_flags;	/*				:  1 b */
14762306a36Sopenharmony_ci	__u16	   oh_res2;	/* 32 bit align			:  2 b */
14862306a36Sopenharmony_ci} xlog_op_header_t;
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci/* valid values for h_fmt */
15162306a36Sopenharmony_ci#define XLOG_FMT_UNKNOWN  0
15262306a36Sopenharmony_ci#define XLOG_FMT_LINUX_LE 1
15362306a36Sopenharmony_ci#define XLOG_FMT_LINUX_BE 2
15462306a36Sopenharmony_ci#define XLOG_FMT_IRIX_BE  3
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci/* our fmt */
15762306a36Sopenharmony_ci#ifdef XFS_NATIVE_HOST
15862306a36Sopenharmony_ci#define XLOG_FMT XLOG_FMT_LINUX_BE
15962306a36Sopenharmony_ci#else
16062306a36Sopenharmony_ci#define XLOG_FMT XLOG_FMT_LINUX_LE
16162306a36Sopenharmony_ci#endif
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_citypedef struct xlog_rec_header {
16462306a36Sopenharmony_ci	__be32	  h_magicno;	/* log record (LR) identifier		:  4 */
16562306a36Sopenharmony_ci	__be32	  h_cycle;	/* write cycle of log			:  4 */
16662306a36Sopenharmony_ci	__be32	  h_version;	/* LR version				:  4 */
16762306a36Sopenharmony_ci	__be32	  h_len;	/* len in bytes; should be 64-bit aligned: 4 */
16862306a36Sopenharmony_ci	__be64	  h_lsn;	/* lsn of this LR			:  8 */
16962306a36Sopenharmony_ci	__be64	  h_tail_lsn;	/* lsn of 1st LR w/ buffers not committed: 8 */
17062306a36Sopenharmony_ci	__le32	  h_crc;	/* crc of log record                    :  4 */
17162306a36Sopenharmony_ci	__be32	  h_prev_block; /* block number to previous LR		:  4 */
17262306a36Sopenharmony_ci	__be32	  h_num_logops;	/* number of log operations in this LR	:  4 */
17362306a36Sopenharmony_ci	__be32	  h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE];
17462306a36Sopenharmony_ci	/* new fields */
17562306a36Sopenharmony_ci	__be32    h_fmt;        /* format of log record                 :  4 */
17662306a36Sopenharmony_ci	uuid_t	  h_fs_uuid;    /* uuid of FS                           : 16 */
17762306a36Sopenharmony_ci	__be32	  h_size;	/* iclog size				:  4 */
17862306a36Sopenharmony_ci} xlog_rec_header_t;
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_citypedef struct xlog_rec_ext_header {
18162306a36Sopenharmony_ci	__be32	  xh_cycle;	/* write cycle of log			: 4 */
18262306a36Sopenharmony_ci	__be32	  xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /*	: 256 */
18362306a36Sopenharmony_ci} xlog_rec_ext_header_t;
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci/*
18662306a36Sopenharmony_ci * Quite misnamed, because this union lays out the actual on-disk log buffer.
18762306a36Sopenharmony_ci */
18862306a36Sopenharmony_citypedef union xlog_in_core2 {
18962306a36Sopenharmony_ci	xlog_rec_header_t	hic_header;
19062306a36Sopenharmony_ci	xlog_rec_ext_header_t	hic_xheader;
19162306a36Sopenharmony_ci	char			hic_sector[XLOG_HEADER_SIZE];
19262306a36Sopenharmony_ci} xlog_in_core_2_t;
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci/* not an on-disk structure, but needed by log recovery in userspace */
19562306a36Sopenharmony_citypedef struct xfs_log_iovec {
19662306a36Sopenharmony_ci	void		*i_addr;	/* beginning address of region */
19762306a36Sopenharmony_ci	int		i_len;		/* length in bytes of region */
19862306a36Sopenharmony_ci	uint		i_type;		/* type of region */
19962306a36Sopenharmony_ci} xfs_log_iovec_t;
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci/*
20362306a36Sopenharmony_ci * Transaction Header definitions.
20462306a36Sopenharmony_ci *
20562306a36Sopenharmony_ci * This is the structure written in the log at the head of every transaction. It
20662306a36Sopenharmony_ci * identifies the type and id of the transaction, and contains the number of
20762306a36Sopenharmony_ci * items logged by the transaction so we know how many to expect during
20862306a36Sopenharmony_ci * recovery.
20962306a36Sopenharmony_ci *
21062306a36Sopenharmony_ci * Do not change the below structure without redoing the code in
21162306a36Sopenharmony_ci * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans().
21262306a36Sopenharmony_ci */
21362306a36Sopenharmony_citypedef struct xfs_trans_header {
21462306a36Sopenharmony_ci	uint		th_magic;		/* magic number */
21562306a36Sopenharmony_ci	uint		th_type;		/* transaction type */
21662306a36Sopenharmony_ci	int32_t		th_tid;			/* transaction id (unused) */
21762306a36Sopenharmony_ci	uint		th_num_items;		/* num items logged by trans */
21862306a36Sopenharmony_ci} xfs_trans_header_t;
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#define	XFS_TRANS_HEADER_MAGIC	0x5452414e	/* TRAN */
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci/*
22362306a36Sopenharmony_ci * The only type valid for th_type in CIL-enabled file system logs:
22462306a36Sopenharmony_ci */
22562306a36Sopenharmony_ci#define XFS_TRANS_CHECKPOINT	40
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci/*
22862306a36Sopenharmony_ci * Log item types.
22962306a36Sopenharmony_ci */
23062306a36Sopenharmony_ci#define	XFS_LI_EFI		0x1236
23162306a36Sopenharmony_ci#define	XFS_LI_EFD		0x1237
23262306a36Sopenharmony_ci#define	XFS_LI_IUNLINK		0x1238
23362306a36Sopenharmony_ci#define	XFS_LI_INODE		0x123b	/* aligned ino chunks, var-size ibufs */
23462306a36Sopenharmony_ci#define	XFS_LI_BUF		0x123c	/* v2 bufs, variable sized inode bufs */
23562306a36Sopenharmony_ci#define	XFS_LI_DQUOT		0x123d
23662306a36Sopenharmony_ci#define	XFS_LI_QUOTAOFF		0x123e
23762306a36Sopenharmony_ci#define	XFS_LI_ICREATE		0x123f
23862306a36Sopenharmony_ci#define	XFS_LI_RUI		0x1240	/* rmap update intent */
23962306a36Sopenharmony_ci#define	XFS_LI_RUD		0x1241
24062306a36Sopenharmony_ci#define	XFS_LI_CUI		0x1242	/* refcount update intent */
24162306a36Sopenharmony_ci#define	XFS_LI_CUD		0x1243
24262306a36Sopenharmony_ci#define	XFS_LI_BUI		0x1244	/* bmbt update intent */
24362306a36Sopenharmony_ci#define	XFS_LI_BUD		0x1245
24462306a36Sopenharmony_ci#define	XFS_LI_ATTRI		0x1246  /* attr set/remove intent*/
24562306a36Sopenharmony_ci#define	XFS_LI_ATTRD		0x1247  /* attr set/remove done */
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci#define XFS_LI_TYPE_DESC \
24862306a36Sopenharmony_ci	{ XFS_LI_EFI,		"XFS_LI_EFI" }, \
24962306a36Sopenharmony_ci	{ XFS_LI_EFD,		"XFS_LI_EFD" }, \
25062306a36Sopenharmony_ci	{ XFS_LI_IUNLINK,	"XFS_LI_IUNLINK" }, \
25162306a36Sopenharmony_ci	{ XFS_LI_INODE,		"XFS_LI_INODE" }, \
25262306a36Sopenharmony_ci	{ XFS_LI_BUF,		"XFS_LI_BUF" }, \
25362306a36Sopenharmony_ci	{ XFS_LI_DQUOT,		"XFS_LI_DQUOT" }, \
25462306a36Sopenharmony_ci	{ XFS_LI_QUOTAOFF,	"XFS_LI_QUOTAOFF" }, \
25562306a36Sopenharmony_ci	{ XFS_LI_ICREATE,	"XFS_LI_ICREATE" }, \
25662306a36Sopenharmony_ci	{ XFS_LI_RUI,		"XFS_LI_RUI" }, \
25762306a36Sopenharmony_ci	{ XFS_LI_RUD,		"XFS_LI_RUD" }, \
25862306a36Sopenharmony_ci	{ XFS_LI_CUI,		"XFS_LI_CUI" }, \
25962306a36Sopenharmony_ci	{ XFS_LI_CUD,		"XFS_LI_CUD" }, \
26062306a36Sopenharmony_ci	{ XFS_LI_BUI,		"XFS_LI_BUI" }, \
26162306a36Sopenharmony_ci	{ XFS_LI_BUD,		"XFS_LI_BUD" }, \
26262306a36Sopenharmony_ci	{ XFS_LI_ATTRI,		"XFS_LI_ATTRI" }, \
26362306a36Sopenharmony_ci	{ XFS_LI_ATTRD,		"XFS_LI_ATTRD" }
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci/*
26662306a36Sopenharmony_ci * Inode Log Item Format definitions.
26762306a36Sopenharmony_ci *
26862306a36Sopenharmony_ci * This is the structure used to lay out an inode log item in the
26962306a36Sopenharmony_ci * log.  The size of the inline data/extents/b-tree root to be logged
27062306a36Sopenharmony_ci * (if any) is indicated in the ilf_dsize field.  Changes to this structure
27162306a36Sopenharmony_ci * must be added on to the end.
27262306a36Sopenharmony_ci */
27362306a36Sopenharmony_cistruct xfs_inode_log_format {
27462306a36Sopenharmony_ci	uint16_t		ilf_type;	/* inode log item type */
27562306a36Sopenharmony_ci	uint16_t		ilf_size;	/* size of this item */
27662306a36Sopenharmony_ci	uint32_t		ilf_fields;	/* flags for fields logged */
27762306a36Sopenharmony_ci	uint16_t		ilf_asize;	/* size of attr d/ext/root */
27862306a36Sopenharmony_ci	uint16_t		ilf_dsize;	/* size of data/ext/root */
27962306a36Sopenharmony_ci	uint32_t		ilf_pad;	/* pad for 64 bit boundary */
28062306a36Sopenharmony_ci	uint64_t		ilf_ino;	/* inode number */
28162306a36Sopenharmony_ci	union {
28262306a36Sopenharmony_ci		uint32_t	ilfu_rdev;	/* rdev value for dev inode*/
28362306a36Sopenharmony_ci		uint8_t		__pad[16];	/* unused */
28462306a36Sopenharmony_ci	} ilf_u;
28562306a36Sopenharmony_ci	int64_t			ilf_blkno;	/* blkno of inode buffer */
28662306a36Sopenharmony_ci	int32_t			ilf_len;	/* len of inode buffer */
28762306a36Sopenharmony_ci	int32_t			ilf_boffset;	/* off of inode in buffer */
28862306a36Sopenharmony_ci};
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci/*
29162306a36Sopenharmony_ci * Old 32 bit systems will log in this format without the 64 bit
29262306a36Sopenharmony_ci * alignment padding. Recovery will detect this and convert it to the
29362306a36Sopenharmony_ci * correct format.
29462306a36Sopenharmony_ci */
29562306a36Sopenharmony_cistruct xfs_inode_log_format_32 {
29662306a36Sopenharmony_ci	uint16_t		ilf_type;	/* inode log item type */
29762306a36Sopenharmony_ci	uint16_t		ilf_size;	/* size of this item */
29862306a36Sopenharmony_ci	uint32_t		ilf_fields;	/* flags for fields logged */
29962306a36Sopenharmony_ci	uint16_t		ilf_asize;	/* size of attr d/ext/root */
30062306a36Sopenharmony_ci	uint16_t		ilf_dsize;	/* size of data/ext/root */
30162306a36Sopenharmony_ci	uint64_t		ilf_ino;	/* inode number */
30262306a36Sopenharmony_ci	union {
30362306a36Sopenharmony_ci		uint32_t	ilfu_rdev;	/* rdev value for dev inode*/
30462306a36Sopenharmony_ci		uint8_t		__pad[16];	/* unused */
30562306a36Sopenharmony_ci	} ilf_u;
30662306a36Sopenharmony_ci	int64_t			ilf_blkno;	/* blkno of inode buffer */
30762306a36Sopenharmony_ci	int32_t			ilf_len;	/* len of inode buffer */
30862306a36Sopenharmony_ci	int32_t			ilf_boffset;	/* off of inode in buffer */
30962306a36Sopenharmony_ci} __attribute__((packed));
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci/*
31362306a36Sopenharmony_ci * Flags for xfs_trans_log_inode flags field.
31462306a36Sopenharmony_ci */
31562306a36Sopenharmony_ci#define	XFS_ILOG_CORE	0x001	/* log standard inode fields */
31662306a36Sopenharmony_ci#define	XFS_ILOG_DDATA	0x002	/* log i_df.if_data */
31762306a36Sopenharmony_ci#define	XFS_ILOG_DEXT	0x004	/* log i_df.if_extents */
31862306a36Sopenharmony_ci#define	XFS_ILOG_DBROOT	0x008	/* log i_df.i_broot */
31962306a36Sopenharmony_ci#define	XFS_ILOG_DEV	0x010	/* log the dev field */
32062306a36Sopenharmony_ci#define	XFS_ILOG_UUID	0x020	/* added long ago, but never used */
32162306a36Sopenharmony_ci#define	XFS_ILOG_ADATA	0x040	/* log i_af.if_data */
32262306a36Sopenharmony_ci#define	XFS_ILOG_AEXT	0x080	/* log i_af.if_extents */
32362306a36Sopenharmony_ci#define	XFS_ILOG_ABROOT	0x100	/* log i_af.i_broot */
32462306a36Sopenharmony_ci#define XFS_ILOG_DOWNER	0x200	/* change the data fork owner on replay */
32562306a36Sopenharmony_ci#define XFS_ILOG_AOWNER	0x400	/* change the attr fork owner on replay */
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci/*
32862306a36Sopenharmony_ci * The timestamps are dirty, but not necessarily anything else in the inode
32962306a36Sopenharmony_ci * core.  Unlike the other fields above this one must never make it to disk
33062306a36Sopenharmony_ci * in the ilf_fields of the inode_log_format, but is purely store in-memory in
33162306a36Sopenharmony_ci * ili_fields in the inode_log_item.
33262306a36Sopenharmony_ci */
33362306a36Sopenharmony_ci#define XFS_ILOG_TIMESTAMP	0x4000
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci/*
33662306a36Sopenharmony_ci * The version field has been changed, but not necessarily anything else of
33762306a36Sopenharmony_ci * interest. This must never make it to disk - it is used purely to ensure that
33862306a36Sopenharmony_ci * the inode item ->precommit operation can update the fsync flag triggers
33962306a36Sopenharmony_ci * in the inode item correctly.
34062306a36Sopenharmony_ci */
34162306a36Sopenharmony_ci#define XFS_ILOG_IVERSION	0x8000
34262306a36Sopenharmony_ci
34362306a36Sopenharmony_ci#define	XFS_ILOG_NONCORE	(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
34462306a36Sopenharmony_ci				 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
34562306a36Sopenharmony_ci				 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
34662306a36Sopenharmony_ci				 XFS_ILOG_ABROOT | XFS_ILOG_DOWNER | \
34762306a36Sopenharmony_ci				 XFS_ILOG_AOWNER)
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci#define	XFS_ILOG_DFORK		(XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
35062306a36Sopenharmony_ci				 XFS_ILOG_DBROOT)
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci#define	XFS_ILOG_AFORK		(XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
35362306a36Sopenharmony_ci				 XFS_ILOG_ABROOT)
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci#define	XFS_ILOG_ALL		(XFS_ILOG_CORE | XFS_ILOG_DDATA | \
35662306a36Sopenharmony_ci				 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
35762306a36Sopenharmony_ci				 XFS_ILOG_DEV | XFS_ILOG_ADATA | \
35862306a36Sopenharmony_ci				 XFS_ILOG_AEXT | XFS_ILOG_ABROOT | \
35962306a36Sopenharmony_ci				 XFS_ILOG_TIMESTAMP | XFS_ILOG_DOWNER | \
36062306a36Sopenharmony_ci				 XFS_ILOG_AOWNER)
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_cistatic inline int xfs_ilog_fbroot(int w)
36362306a36Sopenharmony_ci{
36462306a36Sopenharmony_ci	return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
36562306a36Sopenharmony_ci}
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_cistatic inline int xfs_ilog_fext(int w)
36862306a36Sopenharmony_ci{
36962306a36Sopenharmony_ci	return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
37062306a36Sopenharmony_ci}
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_cistatic inline int xfs_ilog_fdata(int w)
37362306a36Sopenharmony_ci{
37462306a36Sopenharmony_ci	return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
37562306a36Sopenharmony_ci}
37662306a36Sopenharmony_ci
37762306a36Sopenharmony_ci/*
37862306a36Sopenharmony_ci * Incore version of the on-disk inode core structures. We log this directly
37962306a36Sopenharmony_ci * into the journal in host CPU format (for better or worse) and as such
38062306a36Sopenharmony_ci * directly mirrors the xfs_dinode structure as it must contain all the same
38162306a36Sopenharmony_ci * information.
38262306a36Sopenharmony_ci */
38362306a36Sopenharmony_citypedef uint64_t xfs_log_timestamp_t;
38462306a36Sopenharmony_ci
38562306a36Sopenharmony_ci/* Legacy timestamp encoding format. */
38662306a36Sopenharmony_cistruct xfs_log_legacy_timestamp {
38762306a36Sopenharmony_ci	int32_t		t_sec;		/* timestamp seconds */
38862306a36Sopenharmony_ci	int32_t		t_nsec;		/* timestamp nanoseconds */
38962306a36Sopenharmony_ci};
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci/*
39262306a36Sopenharmony_ci * Define the format of the inode core that is logged. This structure must be
39362306a36Sopenharmony_ci * kept identical to struct xfs_dinode except for the endianness annotations.
39462306a36Sopenharmony_ci */
39562306a36Sopenharmony_cistruct xfs_log_dinode {
39662306a36Sopenharmony_ci	uint16_t	di_magic;	/* inode magic # = XFS_DINODE_MAGIC */
39762306a36Sopenharmony_ci	uint16_t	di_mode;	/* mode and type of file */
39862306a36Sopenharmony_ci	int8_t		di_version;	/* inode version */
39962306a36Sopenharmony_ci	int8_t		di_format;	/* format of di_c data */
40062306a36Sopenharmony_ci	uint8_t		di_pad3[2];	/* unused in v2/3 inodes */
40162306a36Sopenharmony_ci	uint32_t	di_uid;		/* owner's user id */
40262306a36Sopenharmony_ci	uint32_t	di_gid;		/* owner's group id */
40362306a36Sopenharmony_ci	uint32_t	di_nlink;	/* number of links to file */
40462306a36Sopenharmony_ci	uint16_t	di_projid_lo;	/* lower part of owner's project id */
40562306a36Sopenharmony_ci	uint16_t	di_projid_hi;	/* higher part of owner's project id */
40662306a36Sopenharmony_ci	union {
40762306a36Sopenharmony_ci		/* Number of data fork extents if NREXT64 is set */
40862306a36Sopenharmony_ci		uint64_t	di_big_nextents;
40962306a36Sopenharmony_ci
41062306a36Sopenharmony_ci		/* Padding for V3 inodes without NREXT64 set. */
41162306a36Sopenharmony_ci		uint64_t	di_v3_pad;
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ci		/* Padding and inode flush counter for V2 inodes. */
41462306a36Sopenharmony_ci		struct {
41562306a36Sopenharmony_ci			uint8_t	di_v2_pad[6];	/* V2 inode zeroed space */
41662306a36Sopenharmony_ci			uint16_t di_flushiter;	/* V2 inode incremented on flush */
41762306a36Sopenharmony_ci		};
41862306a36Sopenharmony_ci	};
41962306a36Sopenharmony_ci	xfs_log_timestamp_t di_atime;	/* time last accessed */
42062306a36Sopenharmony_ci	xfs_log_timestamp_t di_mtime;	/* time last modified */
42162306a36Sopenharmony_ci	xfs_log_timestamp_t di_ctime;	/* time created/inode modified */
42262306a36Sopenharmony_ci	xfs_fsize_t	di_size;	/* number of bytes in file */
42362306a36Sopenharmony_ci	xfs_rfsblock_t	di_nblocks;	/* # of direct & btree blocks used */
42462306a36Sopenharmony_ci	xfs_extlen_t	di_extsize;	/* basic/minimum extent size for file */
42562306a36Sopenharmony_ci	union {
42662306a36Sopenharmony_ci		/*
42762306a36Sopenharmony_ci		 * For V2 inodes and V3 inodes without NREXT64 set, this
42862306a36Sopenharmony_ci		 * is the number of data and attr fork extents.
42962306a36Sopenharmony_ci		 */
43062306a36Sopenharmony_ci		struct {
43162306a36Sopenharmony_ci			uint32_t  di_nextents;
43262306a36Sopenharmony_ci			uint16_t  di_anextents;
43362306a36Sopenharmony_ci		} __packed;
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci		/* Number of attr fork extents if NREXT64 is set. */
43662306a36Sopenharmony_ci		struct {
43762306a36Sopenharmony_ci			uint32_t  di_big_anextents;
43862306a36Sopenharmony_ci			uint16_t  di_nrext64_pad;
43962306a36Sopenharmony_ci		} __packed;
44062306a36Sopenharmony_ci	} __packed;
44162306a36Sopenharmony_ci	uint8_t		di_forkoff;	/* attr fork offs, <<3 for 64b align */
44262306a36Sopenharmony_ci	int8_t		di_aformat;	/* format of attr fork's data */
44362306a36Sopenharmony_ci	uint32_t	di_dmevmask;	/* DMIG event mask */
44462306a36Sopenharmony_ci	uint16_t	di_dmstate;	/* DMIG state info */
44562306a36Sopenharmony_ci	uint16_t	di_flags;	/* random flags, XFS_DIFLAG_... */
44662306a36Sopenharmony_ci	uint32_t	di_gen;		/* generation number */
44762306a36Sopenharmony_ci
44862306a36Sopenharmony_ci	/* di_next_unlinked is the only non-core field in the old dinode */
44962306a36Sopenharmony_ci	xfs_agino_t	di_next_unlinked;/* agi unlinked list ptr */
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci	/* start of the extended dinode, writable fields */
45262306a36Sopenharmony_ci	uint32_t	di_crc;		/* CRC of the inode */
45362306a36Sopenharmony_ci	uint64_t	di_changecount;	/* number of attribute changes */
45462306a36Sopenharmony_ci
45562306a36Sopenharmony_ci	/*
45662306a36Sopenharmony_ci	 * The LSN we write to this field during formatting is not a reflection
45762306a36Sopenharmony_ci	 * of the current on-disk LSN. It should never be used for recovery
45862306a36Sopenharmony_ci	 * sequencing, nor should it be recovered into the on-disk inode at all.
45962306a36Sopenharmony_ci	 * See xlog_recover_inode_commit_pass2() and xfs_log_dinode_to_disk()
46062306a36Sopenharmony_ci	 * for details.
46162306a36Sopenharmony_ci	 */
46262306a36Sopenharmony_ci	xfs_lsn_t	di_lsn;
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ci	uint64_t	di_flags2;	/* more random flags */
46562306a36Sopenharmony_ci	uint32_t	di_cowextsize;	/* basic cow extent size for file */
46662306a36Sopenharmony_ci	uint8_t		di_pad2[12];	/* more padding for future expansion */
46762306a36Sopenharmony_ci
46862306a36Sopenharmony_ci	/* fields only written to during inode creation */
46962306a36Sopenharmony_ci	xfs_log_timestamp_t di_crtime;	/* time created */
47062306a36Sopenharmony_ci	xfs_ino_t	di_ino;		/* inode number */
47162306a36Sopenharmony_ci	uuid_t		di_uuid;	/* UUID of the filesystem */
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ci	/* structure must be padded to 64 bit alignment */
47462306a36Sopenharmony_ci};
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci#define xfs_log_dinode_size(mp)						\
47762306a36Sopenharmony_ci	(xfs_has_v3inodes((mp)) ?					\
47862306a36Sopenharmony_ci		sizeof(struct xfs_log_dinode) :				\
47962306a36Sopenharmony_ci		offsetof(struct xfs_log_dinode, di_next_unlinked))
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci/*
48262306a36Sopenharmony_ci * Buffer Log Format definitions
48362306a36Sopenharmony_ci *
48462306a36Sopenharmony_ci * These are the physical dirty bitmap definitions for the log format structure.
48562306a36Sopenharmony_ci */
48662306a36Sopenharmony_ci#define	XFS_BLF_CHUNK		128
48762306a36Sopenharmony_ci#define	XFS_BLF_SHIFT		7
48862306a36Sopenharmony_ci#define	BIT_TO_WORD_SHIFT	5
48962306a36Sopenharmony_ci#define	NBWORD			(NBBY * sizeof(unsigned int))
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci/*
49262306a36Sopenharmony_ci * This flag indicates that the buffer contains on disk inodes
49362306a36Sopenharmony_ci * and requires special recovery handling.
49462306a36Sopenharmony_ci */
49562306a36Sopenharmony_ci#define	XFS_BLF_INODE_BUF	(1<<0)
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ci/*
49862306a36Sopenharmony_ci * This flag indicates that the buffer should not be replayed
49962306a36Sopenharmony_ci * during recovery because its blocks are being freed.
50062306a36Sopenharmony_ci */
50162306a36Sopenharmony_ci#define	XFS_BLF_CANCEL		(1<<1)
50262306a36Sopenharmony_ci
50362306a36Sopenharmony_ci/*
50462306a36Sopenharmony_ci * This flag indicates that the buffer contains on disk
50562306a36Sopenharmony_ci * user or group dquots and may require special recovery handling.
50662306a36Sopenharmony_ci */
50762306a36Sopenharmony_ci#define	XFS_BLF_UDQUOT_BUF	(1<<2)
50862306a36Sopenharmony_ci#define XFS_BLF_PDQUOT_BUF	(1<<3)
50962306a36Sopenharmony_ci#define	XFS_BLF_GDQUOT_BUF	(1<<4)
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci/*
51262306a36Sopenharmony_ci * This is the structure used to lay out a buf log item in the log.  The data
51362306a36Sopenharmony_ci * map describes which 128 byte chunks of the buffer have been logged.
51462306a36Sopenharmony_ci *
51562306a36Sopenharmony_ci * The placement of blf_map_size causes blf_data_map to start at an odd
51662306a36Sopenharmony_ci * multiple of sizeof(unsigned int) offset within the struct.  Because the data
51762306a36Sopenharmony_ci * bitmap size will always be an even number, the end of the data_map (and
51862306a36Sopenharmony_ci * therefore the structure) will also be at an odd multiple of sizeof(unsigned
51962306a36Sopenharmony_ci * int).  Some 64-bit compilers will insert padding at the end of the struct to
52062306a36Sopenharmony_ci * ensure 64-bit alignment of blf_blkno, but 32-bit ones will not.  Therefore,
52162306a36Sopenharmony_ci * XFS_BLF_DATAMAP_SIZE must be an odd number to make the padding explicit and
52262306a36Sopenharmony_ci * keep the structure size consistent between 32-bit and 64-bit platforms.
52362306a36Sopenharmony_ci */
52462306a36Sopenharmony_ci#define __XFS_BLF_DATAMAP_SIZE	((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD)
52562306a36Sopenharmony_ci#define XFS_BLF_DATAMAP_SIZE	(__XFS_BLF_DATAMAP_SIZE + 1)
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_citypedef struct xfs_buf_log_format {
52862306a36Sopenharmony_ci	unsigned short	blf_type;	/* buf log item type indicator */
52962306a36Sopenharmony_ci	unsigned short	blf_size;	/* size of this item */
53062306a36Sopenharmony_ci	unsigned short	blf_flags;	/* misc state */
53162306a36Sopenharmony_ci	unsigned short	blf_len;	/* number of blocks in this buf */
53262306a36Sopenharmony_ci	int64_t		blf_blkno;	/* starting blkno of this buf */
53362306a36Sopenharmony_ci	unsigned int	blf_map_size;	/* used size of data bitmap in words */
53462306a36Sopenharmony_ci	unsigned int	blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */
53562306a36Sopenharmony_ci} xfs_buf_log_format_t;
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci/*
53862306a36Sopenharmony_ci * All buffers now need to tell recovery where the magic number
53962306a36Sopenharmony_ci * is so that it can verify and calculate the CRCs on the buffer correctly
54062306a36Sopenharmony_ci * once the changes have been replayed into the buffer.
54162306a36Sopenharmony_ci *
54262306a36Sopenharmony_ci * The type value is held in the upper 5 bits of the blf_flags field, which is
54362306a36Sopenharmony_ci * an unsigned 16 bit field. Hence we need to shift it 11 bits up and down.
54462306a36Sopenharmony_ci */
54562306a36Sopenharmony_ci#define XFS_BLFT_BITS	5
54662306a36Sopenharmony_ci#define XFS_BLFT_SHIFT	11
54762306a36Sopenharmony_ci#define XFS_BLFT_MASK	(((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT)
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_cienum xfs_blft {
55062306a36Sopenharmony_ci	XFS_BLFT_UNKNOWN_BUF = 0,
55162306a36Sopenharmony_ci	XFS_BLFT_UDQUOT_BUF,
55262306a36Sopenharmony_ci	XFS_BLFT_PDQUOT_BUF,
55362306a36Sopenharmony_ci	XFS_BLFT_GDQUOT_BUF,
55462306a36Sopenharmony_ci	XFS_BLFT_BTREE_BUF,
55562306a36Sopenharmony_ci	XFS_BLFT_AGF_BUF,
55662306a36Sopenharmony_ci	XFS_BLFT_AGFL_BUF,
55762306a36Sopenharmony_ci	XFS_BLFT_AGI_BUF,
55862306a36Sopenharmony_ci	XFS_BLFT_DINO_BUF,
55962306a36Sopenharmony_ci	XFS_BLFT_SYMLINK_BUF,
56062306a36Sopenharmony_ci	XFS_BLFT_DIR_BLOCK_BUF,
56162306a36Sopenharmony_ci	XFS_BLFT_DIR_DATA_BUF,
56262306a36Sopenharmony_ci	XFS_BLFT_DIR_FREE_BUF,
56362306a36Sopenharmony_ci	XFS_BLFT_DIR_LEAF1_BUF,
56462306a36Sopenharmony_ci	XFS_BLFT_DIR_LEAFN_BUF,
56562306a36Sopenharmony_ci	XFS_BLFT_DA_NODE_BUF,
56662306a36Sopenharmony_ci	XFS_BLFT_ATTR_LEAF_BUF,
56762306a36Sopenharmony_ci	XFS_BLFT_ATTR_RMT_BUF,
56862306a36Sopenharmony_ci	XFS_BLFT_SB_BUF,
56962306a36Sopenharmony_ci	XFS_BLFT_RTBITMAP_BUF,
57062306a36Sopenharmony_ci	XFS_BLFT_RTSUMMARY_BUF,
57162306a36Sopenharmony_ci	XFS_BLFT_MAX_BUF = (1 << XFS_BLFT_BITS),
57262306a36Sopenharmony_ci};
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_cistatic inline void
57562306a36Sopenharmony_cixfs_blft_to_flags(struct xfs_buf_log_format *blf, enum xfs_blft type)
57662306a36Sopenharmony_ci{
57762306a36Sopenharmony_ci	ASSERT(type > XFS_BLFT_UNKNOWN_BUF && type < XFS_BLFT_MAX_BUF);
57862306a36Sopenharmony_ci	blf->blf_flags &= ~XFS_BLFT_MASK;
57962306a36Sopenharmony_ci	blf->blf_flags |= ((type << XFS_BLFT_SHIFT) & XFS_BLFT_MASK);
58062306a36Sopenharmony_ci}
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_cistatic inline uint16_t
58362306a36Sopenharmony_cixfs_blft_from_flags(struct xfs_buf_log_format *blf)
58462306a36Sopenharmony_ci{
58562306a36Sopenharmony_ci	return (blf->blf_flags & XFS_BLFT_MASK) >> XFS_BLFT_SHIFT;
58662306a36Sopenharmony_ci}
58762306a36Sopenharmony_ci
58862306a36Sopenharmony_ci/*
58962306a36Sopenharmony_ci * EFI/EFD log format definitions
59062306a36Sopenharmony_ci */
59162306a36Sopenharmony_citypedef struct xfs_extent {
59262306a36Sopenharmony_ci	xfs_fsblock_t	ext_start;
59362306a36Sopenharmony_ci	xfs_extlen_t	ext_len;
59462306a36Sopenharmony_ci} xfs_extent_t;
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci/*
59762306a36Sopenharmony_ci * Since an xfs_extent_t has types (start:64, len: 32)
59862306a36Sopenharmony_ci * there are different alignments on 32 bit and 64 bit kernels.
59962306a36Sopenharmony_ci * So we provide the different variants for use by a
60062306a36Sopenharmony_ci * conversion routine.
60162306a36Sopenharmony_ci */
60262306a36Sopenharmony_citypedef struct xfs_extent_32 {
60362306a36Sopenharmony_ci	uint64_t	ext_start;
60462306a36Sopenharmony_ci	uint32_t	ext_len;
60562306a36Sopenharmony_ci} __attribute__((packed)) xfs_extent_32_t;
60662306a36Sopenharmony_ci
60762306a36Sopenharmony_citypedef struct xfs_extent_64 {
60862306a36Sopenharmony_ci	uint64_t	ext_start;
60962306a36Sopenharmony_ci	uint32_t	ext_len;
61062306a36Sopenharmony_ci	uint32_t	ext_pad;
61162306a36Sopenharmony_ci} xfs_extent_64_t;
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci/*
61462306a36Sopenharmony_ci * This is the structure used to lay out an efi log item in the
61562306a36Sopenharmony_ci * log.  The efi_extents field is a variable size array whose
61662306a36Sopenharmony_ci * size is given by efi_nextents.
61762306a36Sopenharmony_ci */
61862306a36Sopenharmony_citypedef struct xfs_efi_log_format {
61962306a36Sopenharmony_ci	uint16_t		efi_type;	/* efi log item type */
62062306a36Sopenharmony_ci	uint16_t		efi_size;	/* size of this item */
62162306a36Sopenharmony_ci	uint32_t		efi_nextents;	/* # extents to free */
62262306a36Sopenharmony_ci	uint64_t		efi_id;		/* efi identifier */
62362306a36Sopenharmony_ci	xfs_extent_t		efi_extents[];	/* array of extents to free */
62462306a36Sopenharmony_ci} xfs_efi_log_format_t;
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_cistatic inline size_t
62762306a36Sopenharmony_cixfs_efi_log_format_sizeof(
62862306a36Sopenharmony_ci	unsigned int		nr)
62962306a36Sopenharmony_ci{
63062306a36Sopenharmony_ci	return sizeof(struct xfs_efi_log_format) +
63162306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent);
63262306a36Sopenharmony_ci}
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_citypedef struct xfs_efi_log_format_32 {
63562306a36Sopenharmony_ci	uint16_t		efi_type;	/* efi log item type */
63662306a36Sopenharmony_ci	uint16_t		efi_size;	/* size of this item */
63762306a36Sopenharmony_ci	uint32_t		efi_nextents;	/* # extents to free */
63862306a36Sopenharmony_ci	uint64_t		efi_id;		/* efi identifier */
63962306a36Sopenharmony_ci	xfs_extent_32_t		efi_extents[];	/* array of extents to free */
64062306a36Sopenharmony_ci} __attribute__((packed)) xfs_efi_log_format_32_t;
64162306a36Sopenharmony_ci
64262306a36Sopenharmony_cistatic inline size_t
64362306a36Sopenharmony_cixfs_efi_log_format32_sizeof(
64462306a36Sopenharmony_ci	unsigned int		nr)
64562306a36Sopenharmony_ci{
64662306a36Sopenharmony_ci	return sizeof(struct xfs_efi_log_format_32) +
64762306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent_32);
64862306a36Sopenharmony_ci}
64962306a36Sopenharmony_ci
65062306a36Sopenharmony_citypedef struct xfs_efi_log_format_64 {
65162306a36Sopenharmony_ci	uint16_t		efi_type;	/* efi log item type */
65262306a36Sopenharmony_ci	uint16_t		efi_size;	/* size of this item */
65362306a36Sopenharmony_ci	uint32_t		efi_nextents;	/* # extents to free */
65462306a36Sopenharmony_ci	uint64_t		efi_id;		/* efi identifier */
65562306a36Sopenharmony_ci	xfs_extent_64_t		efi_extents[];	/* array of extents to free */
65662306a36Sopenharmony_ci} xfs_efi_log_format_64_t;
65762306a36Sopenharmony_ci
65862306a36Sopenharmony_cistatic inline size_t
65962306a36Sopenharmony_cixfs_efi_log_format64_sizeof(
66062306a36Sopenharmony_ci	unsigned int		nr)
66162306a36Sopenharmony_ci{
66262306a36Sopenharmony_ci	return sizeof(struct xfs_efi_log_format_64) +
66362306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent_64);
66462306a36Sopenharmony_ci}
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci/*
66762306a36Sopenharmony_ci * This is the structure used to lay out an efd log item in the
66862306a36Sopenharmony_ci * log.  The efd_extents array is a variable size array whose
66962306a36Sopenharmony_ci * size is given by efd_nextents;
67062306a36Sopenharmony_ci */
67162306a36Sopenharmony_citypedef struct xfs_efd_log_format {
67262306a36Sopenharmony_ci	uint16_t		efd_type;	/* efd log item type */
67362306a36Sopenharmony_ci	uint16_t		efd_size;	/* size of this item */
67462306a36Sopenharmony_ci	uint32_t		efd_nextents;	/* # of extents freed */
67562306a36Sopenharmony_ci	uint64_t		efd_efi_id;	/* id of corresponding efi */
67662306a36Sopenharmony_ci	xfs_extent_t		efd_extents[];	/* array of extents freed */
67762306a36Sopenharmony_ci} xfs_efd_log_format_t;
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_cistatic inline size_t
68062306a36Sopenharmony_cixfs_efd_log_format_sizeof(
68162306a36Sopenharmony_ci	unsigned int		nr)
68262306a36Sopenharmony_ci{
68362306a36Sopenharmony_ci	return sizeof(struct xfs_efd_log_format) +
68462306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent);
68562306a36Sopenharmony_ci}
68662306a36Sopenharmony_ci
68762306a36Sopenharmony_citypedef struct xfs_efd_log_format_32 {
68862306a36Sopenharmony_ci	uint16_t		efd_type;	/* efd log item type */
68962306a36Sopenharmony_ci	uint16_t		efd_size;	/* size of this item */
69062306a36Sopenharmony_ci	uint32_t		efd_nextents;	/* # of extents freed */
69162306a36Sopenharmony_ci	uint64_t		efd_efi_id;	/* id of corresponding efi */
69262306a36Sopenharmony_ci	xfs_extent_32_t		efd_extents[];	/* array of extents freed */
69362306a36Sopenharmony_ci} __attribute__((packed)) xfs_efd_log_format_32_t;
69462306a36Sopenharmony_ci
69562306a36Sopenharmony_cistatic inline size_t
69662306a36Sopenharmony_cixfs_efd_log_format32_sizeof(
69762306a36Sopenharmony_ci	unsigned int		nr)
69862306a36Sopenharmony_ci{
69962306a36Sopenharmony_ci	return sizeof(struct xfs_efd_log_format_32) +
70062306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent_32);
70162306a36Sopenharmony_ci}
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_citypedef struct xfs_efd_log_format_64 {
70462306a36Sopenharmony_ci	uint16_t		efd_type;	/* efd log item type */
70562306a36Sopenharmony_ci	uint16_t		efd_size;	/* size of this item */
70662306a36Sopenharmony_ci	uint32_t		efd_nextents;	/* # of extents freed */
70762306a36Sopenharmony_ci	uint64_t		efd_efi_id;	/* id of corresponding efi */
70862306a36Sopenharmony_ci	xfs_extent_64_t		efd_extents[];	/* array of extents freed */
70962306a36Sopenharmony_ci} xfs_efd_log_format_64_t;
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_cistatic inline size_t
71262306a36Sopenharmony_cixfs_efd_log_format64_sizeof(
71362306a36Sopenharmony_ci	unsigned int		nr)
71462306a36Sopenharmony_ci{
71562306a36Sopenharmony_ci	return sizeof(struct xfs_efd_log_format_64) +
71662306a36Sopenharmony_ci			nr * sizeof(struct xfs_extent_64);
71762306a36Sopenharmony_ci}
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ci/*
72062306a36Sopenharmony_ci * RUI/RUD (reverse mapping) log format definitions
72162306a36Sopenharmony_ci */
72262306a36Sopenharmony_cistruct xfs_map_extent {
72362306a36Sopenharmony_ci	uint64_t		me_owner;
72462306a36Sopenharmony_ci	uint64_t		me_startblock;
72562306a36Sopenharmony_ci	uint64_t		me_startoff;
72662306a36Sopenharmony_ci	uint32_t		me_len;
72762306a36Sopenharmony_ci	uint32_t		me_flags;
72862306a36Sopenharmony_ci};
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ci/* rmap me_flags: upper bits are flags, lower byte is type code */
73162306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_MAP		1
73262306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_MAP_SHARED	2
73362306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_UNMAP		3
73462306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_UNMAP_SHARED	4
73562306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_CONVERT		5
73662306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_CONVERT_SHARED	6
73762306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_ALLOC		7
73862306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_FREE		8
73962306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_TYPE_MASK	0xFF
74062306a36Sopenharmony_ci
74162306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_ATTR_FORK	(1U << 31)
74262306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_BMBT_BLOCK	(1U << 30)
74362306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_UNWRITTEN	(1U << 29)
74462306a36Sopenharmony_ci
74562306a36Sopenharmony_ci#define XFS_RMAP_EXTENT_FLAGS		(XFS_RMAP_EXTENT_TYPE_MASK | \
74662306a36Sopenharmony_ci					 XFS_RMAP_EXTENT_ATTR_FORK | \
74762306a36Sopenharmony_ci					 XFS_RMAP_EXTENT_BMBT_BLOCK | \
74862306a36Sopenharmony_ci					 XFS_RMAP_EXTENT_UNWRITTEN)
74962306a36Sopenharmony_ci
75062306a36Sopenharmony_ci/*
75162306a36Sopenharmony_ci * This is the structure used to lay out an rui log item in the
75262306a36Sopenharmony_ci * log.  The rui_extents field is a variable size array whose
75362306a36Sopenharmony_ci * size is given by rui_nextents.
75462306a36Sopenharmony_ci */
75562306a36Sopenharmony_cistruct xfs_rui_log_format {
75662306a36Sopenharmony_ci	uint16_t		rui_type;	/* rui log item type */
75762306a36Sopenharmony_ci	uint16_t		rui_size;	/* size of this item */
75862306a36Sopenharmony_ci	uint32_t		rui_nextents;	/* # extents to free */
75962306a36Sopenharmony_ci	uint64_t		rui_id;		/* rui identifier */
76062306a36Sopenharmony_ci	struct xfs_map_extent	rui_extents[];	/* array of extents to rmap */
76162306a36Sopenharmony_ci};
76262306a36Sopenharmony_ci
76362306a36Sopenharmony_cistatic inline size_t
76462306a36Sopenharmony_cixfs_rui_log_format_sizeof(
76562306a36Sopenharmony_ci	unsigned int		nr)
76662306a36Sopenharmony_ci{
76762306a36Sopenharmony_ci	return sizeof(struct xfs_rui_log_format) +
76862306a36Sopenharmony_ci			nr * sizeof(struct xfs_map_extent);
76962306a36Sopenharmony_ci}
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_ci/*
77262306a36Sopenharmony_ci * This is the structure used to lay out an rud log item in the
77362306a36Sopenharmony_ci * log.  The rud_extents array is a variable size array whose
77462306a36Sopenharmony_ci * size is given by rud_nextents;
77562306a36Sopenharmony_ci */
77662306a36Sopenharmony_cistruct xfs_rud_log_format {
77762306a36Sopenharmony_ci	uint16_t		rud_type;	/* rud log item type */
77862306a36Sopenharmony_ci	uint16_t		rud_size;	/* size of this item */
77962306a36Sopenharmony_ci	uint32_t		__pad;
78062306a36Sopenharmony_ci	uint64_t		rud_rui_id;	/* id of corresponding rui */
78162306a36Sopenharmony_ci};
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ci/*
78462306a36Sopenharmony_ci * CUI/CUD (refcount update) log format definitions
78562306a36Sopenharmony_ci */
78662306a36Sopenharmony_cistruct xfs_phys_extent {
78762306a36Sopenharmony_ci	uint64_t		pe_startblock;
78862306a36Sopenharmony_ci	uint32_t		pe_len;
78962306a36Sopenharmony_ci	uint32_t		pe_flags;
79062306a36Sopenharmony_ci};
79162306a36Sopenharmony_ci
79262306a36Sopenharmony_ci/* refcount pe_flags: upper bits are flags, lower byte is type code */
79362306a36Sopenharmony_ci/* Type codes are taken directly from enum xfs_refcount_intent_type. */
79462306a36Sopenharmony_ci#define XFS_REFCOUNT_EXTENT_TYPE_MASK	0xFF
79562306a36Sopenharmony_ci
79662306a36Sopenharmony_ci#define XFS_REFCOUNT_EXTENT_FLAGS	(XFS_REFCOUNT_EXTENT_TYPE_MASK)
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci/*
79962306a36Sopenharmony_ci * This is the structure used to lay out a cui log item in the
80062306a36Sopenharmony_ci * log.  The cui_extents field is a variable size array whose
80162306a36Sopenharmony_ci * size is given by cui_nextents.
80262306a36Sopenharmony_ci */
80362306a36Sopenharmony_cistruct xfs_cui_log_format {
80462306a36Sopenharmony_ci	uint16_t		cui_type;	/* cui log item type */
80562306a36Sopenharmony_ci	uint16_t		cui_size;	/* size of this item */
80662306a36Sopenharmony_ci	uint32_t		cui_nextents;	/* # extents to free */
80762306a36Sopenharmony_ci	uint64_t		cui_id;		/* cui identifier */
80862306a36Sopenharmony_ci	struct xfs_phys_extent	cui_extents[];	/* array of extents */
80962306a36Sopenharmony_ci};
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_cistatic inline size_t
81262306a36Sopenharmony_cixfs_cui_log_format_sizeof(
81362306a36Sopenharmony_ci	unsigned int		nr)
81462306a36Sopenharmony_ci{
81562306a36Sopenharmony_ci	return sizeof(struct xfs_cui_log_format) +
81662306a36Sopenharmony_ci			nr * sizeof(struct xfs_phys_extent);
81762306a36Sopenharmony_ci}
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_ci/*
82062306a36Sopenharmony_ci * This is the structure used to lay out a cud log item in the
82162306a36Sopenharmony_ci * log.  The cud_extents array is a variable size array whose
82262306a36Sopenharmony_ci * size is given by cud_nextents;
82362306a36Sopenharmony_ci */
82462306a36Sopenharmony_cistruct xfs_cud_log_format {
82562306a36Sopenharmony_ci	uint16_t		cud_type;	/* cud log item type */
82662306a36Sopenharmony_ci	uint16_t		cud_size;	/* size of this item */
82762306a36Sopenharmony_ci	uint32_t		__pad;
82862306a36Sopenharmony_ci	uint64_t		cud_cui_id;	/* id of corresponding cui */
82962306a36Sopenharmony_ci};
83062306a36Sopenharmony_ci
83162306a36Sopenharmony_ci/*
83262306a36Sopenharmony_ci * BUI/BUD (inode block mapping) log format definitions
83362306a36Sopenharmony_ci */
83462306a36Sopenharmony_ci
83562306a36Sopenharmony_ci/* bmbt me_flags: upper bits are flags, lower byte is type code */
83662306a36Sopenharmony_ci/* Type codes are taken directly from enum xfs_bmap_intent_type. */
83762306a36Sopenharmony_ci#define XFS_BMAP_EXTENT_TYPE_MASK	0xFF
83862306a36Sopenharmony_ci
83962306a36Sopenharmony_ci#define XFS_BMAP_EXTENT_ATTR_FORK	(1U << 31)
84062306a36Sopenharmony_ci#define XFS_BMAP_EXTENT_UNWRITTEN	(1U << 30)
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci#define XFS_BMAP_EXTENT_FLAGS		(XFS_BMAP_EXTENT_TYPE_MASK | \
84362306a36Sopenharmony_ci					 XFS_BMAP_EXTENT_ATTR_FORK | \
84462306a36Sopenharmony_ci					 XFS_BMAP_EXTENT_UNWRITTEN)
84562306a36Sopenharmony_ci
84662306a36Sopenharmony_ci/*
84762306a36Sopenharmony_ci * This is the structure used to lay out an bui log item in the
84862306a36Sopenharmony_ci * log.  The bui_extents field is a variable size array whose
84962306a36Sopenharmony_ci * size is given by bui_nextents.
85062306a36Sopenharmony_ci */
85162306a36Sopenharmony_cistruct xfs_bui_log_format {
85262306a36Sopenharmony_ci	uint16_t		bui_type;	/* bui log item type */
85362306a36Sopenharmony_ci	uint16_t		bui_size;	/* size of this item */
85462306a36Sopenharmony_ci	uint32_t		bui_nextents;	/* # extents to free */
85562306a36Sopenharmony_ci	uint64_t		bui_id;		/* bui identifier */
85662306a36Sopenharmony_ci	struct xfs_map_extent	bui_extents[];	/* array of extents to bmap */
85762306a36Sopenharmony_ci};
85862306a36Sopenharmony_ci
85962306a36Sopenharmony_cistatic inline size_t
86062306a36Sopenharmony_cixfs_bui_log_format_sizeof(
86162306a36Sopenharmony_ci	unsigned int		nr)
86262306a36Sopenharmony_ci{
86362306a36Sopenharmony_ci	return sizeof(struct xfs_bui_log_format) +
86462306a36Sopenharmony_ci			nr * sizeof(struct xfs_map_extent);
86562306a36Sopenharmony_ci}
86662306a36Sopenharmony_ci
86762306a36Sopenharmony_ci/*
86862306a36Sopenharmony_ci * This is the structure used to lay out an bud log item in the
86962306a36Sopenharmony_ci * log.  The bud_extents array is a variable size array whose
87062306a36Sopenharmony_ci * size is given by bud_nextents;
87162306a36Sopenharmony_ci */
87262306a36Sopenharmony_cistruct xfs_bud_log_format {
87362306a36Sopenharmony_ci	uint16_t		bud_type;	/* bud log item type */
87462306a36Sopenharmony_ci	uint16_t		bud_size;	/* size of this item */
87562306a36Sopenharmony_ci	uint32_t		__pad;
87662306a36Sopenharmony_ci	uint64_t		bud_bui_id;	/* id of corresponding bui */
87762306a36Sopenharmony_ci};
87862306a36Sopenharmony_ci
87962306a36Sopenharmony_ci/*
88062306a36Sopenharmony_ci * Dquot Log format definitions.
88162306a36Sopenharmony_ci *
88262306a36Sopenharmony_ci * The first two fields must be the type and size fitting into
88362306a36Sopenharmony_ci * 32 bits : log_recovery code assumes that.
88462306a36Sopenharmony_ci */
88562306a36Sopenharmony_citypedef struct xfs_dq_logformat {
88662306a36Sopenharmony_ci	uint16_t		qlf_type;      /* dquot log item type */
88762306a36Sopenharmony_ci	uint16_t		qlf_size;      /* size of this item */
88862306a36Sopenharmony_ci	xfs_dqid_t		qlf_id;	       /* usr/grp/proj id : 32 bits */
88962306a36Sopenharmony_ci	int64_t			qlf_blkno;     /* blkno of dquot buffer */
89062306a36Sopenharmony_ci	int32_t			qlf_len;       /* len of dquot buffer */
89162306a36Sopenharmony_ci	uint32_t		qlf_boffset;   /* off of dquot in buffer */
89262306a36Sopenharmony_ci} xfs_dq_logformat_t;
89362306a36Sopenharmony_ci
89462306a36Sopenharmony_ci/*
89562306a36Sopenharmony_ci * log format struct for QUOTAOFF records.
89662306a36Sopenharmony_ci * The first two fields must be the type and size fitting into
89762306a36Sopenharmony_ci * 32 bits : log_recovery code assumes that.
89862306a36Sopenharmony_ci * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
89962306a36Sopenharmony_ci * to the first and ensures that the first logitem is taken out of the AIL
90062306a36Sopenharmony_ci * only when the last one is securely committed.
90162306a36Sopenharmony_ci */
90262306a36Sopenharmony_citypedef struct xfs_qoff_logformat {
90362306a36Sopenharmony_ci	unsigned short		qf_type;	/* quotaoff log item type */
90462306a36Sopenharmony_ci	unsigned short		qf_size;	/* size of this item */
90562306a36Sopenharmony_ci	unsigned int		qf_flags;	/* USR and/or GRP */
90662306a36Sopenharmony_ci	char			qf_pad[12];	/* padding for future */
90762306a36Sopenharmony_ci} xfs_qoff_logformat_t;
90862306a36Sopenharmony_ci
90962306a36Sopenharmony_ci/*
91062306a36Sopenharmony_ci * Disk quotas status in m_qflags, and also sb_qflags. 16 bits.
91162306a36Sopenharmony_ci */
91262306a36Sopenharmony_ci#define XFS_UQUOTA_ACCT	0x0001  /* user quota accounting ON */
91362306a36Sopenharmony_ci#define XFS_UQUOTA_ENFD	0x0002  /* user quota limits enforced */
91462306a36Sopenharmony_ci#define XFS_UQUOTA_CHKD	0x0004  /* quotacheck run on usr quotas */
91562306a36Sopenharmony_ci#define XFS_PQUOTA_ACCT	0x0008  /* project quota accounting ON */
91662306a36Sopenharmony_ci#define XFS_OQUOTA_ENFD	0x0010  /* other (grp/prj) quota limits enforced */
91762306a36Sopenharmony_ci#define XFS_OQUOTA_CHKD	0x0020  /* quotacheck run on other (grp/prj) quotas */
91862306a36Sopenharmony_ci#define XFS_GQUOTA_ACCT	0x0040  /* group quota accounting ON */
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci/*
92162306a36Sopenharmony_ci * Conversion to and from the combined OQUOTA flag (if necessary)
92262306a36Sopenharmony_ci * is done only in xfs_sb_qflags_to_disk() and xfs_sb_qflags_from_disk()
92362306a36Sopenharmony_ci */
92462306a36Sopenharmony_ci#define XFS_GQUOTA_ENFD	0x0080  /* group quota limits enforced */
92562306a36Sopenharmony_ci#define XFS_GQUOTA_CHKD	0x0100  /* quotacheck run on group quotas */
92662306a36Sopenharmony_ci#define XFS_PQUOTA_ENFD	0x0200  /* project quota limits enforced */
92762306a36Sopenharmony_ci#define XFS_PQUOTA_CHKD	0x0400  /* quotacheck run on project quotas */
92862306a36Sopenharmony_ci
92962306a36Sopenharmony_ci#define XFS_ALL_QUOTA_ACCT	\
93062306a36Sopenharmony_ci		(XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
93162306a36Sopenharmony_ci#define XFS_ALL_QUOTA_ENFD	\
93262306a36Sopenharmony_ci		(XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_ENFD)
93362306a36Sopenharmony_ci#define XFS_ALL_QUOTA_CHKD	\
93462306a36Sopenharmony_ci		(XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD)
93562306a36Sopenharmony_ci
93662306a36Sopenharmony_ci#define XFS_MOUNT_QUOTA_ALL	(XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
93762306a36Sopenharmony_ci				 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\
93862306a36Sopenharmony_ci				 XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD|\
93962306a36Sopenharmony_ci				 XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|\
94062306a36Sopenharmony_ci				 XFS_PQUOTA_CHKD)
94162306a36Sopenharmony_ci
94262306a36Sopenharmony_ci/*
94362306a36Sopenharmony_ci * Inode create log item structure
94462306a36Sopenharmony_ci *
94562306a36Sopenharmony_ci * Log recovery assumes the first two entries are the type and size and they fit
94662306a36Sopenharmony_ci * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so
94762306a36Sopenharmony_ci * decoding can be done correctly.
94862306a36Sopenharmony_ci */
94962306a36Sopenharmony_cistruct xfs_icreate_log {
95062306a36Sopenharmony_ci	uint16_t	icl_type;	/* type of log format structure */
95162306a36Sopenharmony_ci	uint16_t	icl_size;	/* size of log format structure */
95262306a36Sopenharmony_ci	__be32		icl_ag;		/* ag being allocated in */
95362306a36Sopenharmony_ci	__be32		icl_agbno;	/* start block of inode range */
95462306a36Sopenharmony_ci	__be32		icl_count;	/* number of inodes to initialise */
95562306a36Sopenharmony_ci	__be32		icl_isize;	/* size of inodes */
95662306a36Sopenharmony_ci	__be32		icl_length;	/* length of extent to initialise */
95762306a36Sopenharmony_ci	__be32		icl_gen;	/* inode generation number to use */
95862306a36Sopenharmony_ci};
95962306a36Sopenharmony_ci
96062306a36Sopenharmony_ci/*
96162306a36Sopenharmony_ci * Flags for deferred attribute operations.
96262306a36Sopenharmony_ci * Upper bits are flags, lower byte is type code
96362306a36Sopenharmony_ci */
96462306a36Sopenharmony_ci#define XFS_ATTRI_OP_FLAGS_SET		1	/* Set the attribute */
96562306a36Sopenharmony_ci#define XFS_ATTRI_OP_FLAGS_REMOVE	2	/* Remove the attribute */
96662306a36Sopenharmony_ci#define XFS_ATTRI_OP_FLAGS_REPLACE	3	/* Replace the attribute */
96762306a36Sopenharmony_ci#define XFS_ATTRI_OP_FLAGS_TYPE_MASK	0xFF	/* Flags type mask */
96862306a36Sopenharmony_ci
96962306a36Sopenharmony_ci/*
97062306a36Sopenharmony_ci * alfi_attr_filter captures the state of xfs_da_args.attr_filter, so it should
97162306a36Sopenharmony_ci * never have any other bits set.
97262306a36Sopenharmony_ci */
97362306a36Sopenharmony_ci#define XFS_ATTRI_FILTER_MASK		(XFS_ATTR_ROOT | \
97462306a36Sopenharmony_ci					 XFS_ATTR_SECURE | \
97562306a36Sopenharmony_ci					 XFS_ATTR_INCOMPLETE)
97662306a36Sopenharmony_ci
97762306a36Sopenharmony_ci/*
97862306a36Sopenharmony_ci * This is the structure used to lay out an attr log item in the
97962306a36Sopenharmony_ci * log.
98062306a36Sopenharmony_ci */
98162306a36Sopenharmony_cistruct xfs_attri_log_format {
98262306a36Sopenharmony_ci	uint16_t	alfi_type;	/* attri log item type */
98362306a36Sopenharmony_ci	uint16_t	alfi_size;	/* size of this item */
98462306a36Sopenharmony_ci	uint32_t	__pad;		/* pad to 64 bit aligned */
98562306a36Sopenharmony_ci	uint64_t	alfi_id;	/* attri identifier */
98662306a36Sopenharmony_ci	uint64_t	alfi_ino;	/* the inode for this attr operation */
98762306a36Sopenharmony_ci	uint32_t	alfi_op_flags;	/* marks the op as a set or remove */
98862306a36Sopenharmony_ci	uint32_t	alfi_name_len;	/* attr name length */
98962306a36Sopenharmony_ci	uint32_t	alfi_value_len;	/* attr value length */
99062306a36Sopenharmony_ci	uint32_t	alfi_attr_filter;/* attr filter flags */
99162306a36Sopenharmony_ci};
99262306a36Sopenharmony_ci
99362306a36Sopenharmony_cistruct xfs_attrd_log_format {
99462306a36Sopenharmony_ci	uint16_t	alfd_type;	/* attrd log item type */
99562306a36Sopenharmony_ci	uint16_t	alfd_size;	/* size of this item */
99662306a36Sopenharmony_ci	uint32_t	__pad;		/* pad to 64 bit aligned */
99762306a36Sopenharmony_ci	uint64_t	alfd_alf_id;	/* id of corresponding attri */
99862306a36Sopenharmony_ci};
99962306a36Sopenharmony_ci
100062306a36Sopenharmony_ci#endif /* __XFS_LOG_FORMAT_H__ */
1001