]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - include/xfs_inode_item.h
Merge whitespace changes over
[thirdparty/xfsprogs-dev.git] / include / xfs_inode_item.h
CommitLineData
2bd0ea18 1/*
854f7c66 2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
5000d01d 3 *
2bd0ea18
NS
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
5000d01d 7 *
2bd0ea18
NS
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5000d01d 11 *
2bd0ea18
NS
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
dfc130f3 14 * or the like. Any license provided herein, whether implied or
2bd0ea18
NS
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
5000d01d 18 *
2bd0ea18
NS
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
5000d01d 22 *
2bd0ea18
NS
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
5000d01d
SL
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
2bd0ea18
NS
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
dfc130f3
RC
32#ifndef __XFS_INODE_ITEM_H__
33#define __XFS_INODE_ITEM_H__
2bd0ea18
NS
34
35/*
36 * This is the structure used to lay out an inode log item in the
dfc130f3 37 * log. The size of the inline data/extents/b-tree root to be logged
2bd0ea18
NS
38 * (if any) is indicated in the ilf_dsize field. Changes to this structure
39 * must be added on to the end.
40 *
41 * Convention for naming inode log item versions : The current version
42 * is always named XFS_LI_INODE. When an inode log item gets superseded,
43 * add the latest version of IRIX that will generate logs with that item
44 * to the version name.
45 *
46 * -Version 1 of this structure (XFS_LI_5_3_INODE) included up to the first
47 * union (ilf_u) field. This was released with IRIX 5.3-XFS.
48 * -Version 2 of this structure (XFS_LI_6_1_INODE) is currently the entire
49 * structure. This was released with IRIX 6.0.1-XFS and IRIX 6.1.
50 * -Version 3 of this structure (XFS_LI_INODE) is the same as version 2
dfc130f3 51 * so a new structure definition wasn't necessary. However, we had
2bd0ea18
NS
52 * to add a new type because the inode cluster size changed from 4K
53 * to 8K and the version number had to be rev'ved to keep older kernels
54 * from trying to recover logs with the 8K buffers in them. The logging
55 * code can handle recovery on different-sized clusters now so hopefully
56 * this'll be the last time we need to change the inode log item just
dfc130f3 57 * for a change in the inode cluster size. This new version was
2bd0ea18
NS
58 * released with IRIX 6.2.
59 */
60typedef struct xfs_inode_log_format {
61 unsigned short ilf_type; /* inode log item type */
62 unsigned short ilf_size; /* size of this item */
63 uint ilf_fields; /* flags for fields logged */
64 ushort ilf_asize; /* size of attr d/ext/root */
65 ushort ilf_dsize; /* size of data/ext/root */
66 xfs_ino_t ilf_ino; /* inode number */
67 union {
68 xfs_dev_t ilfu_rdev; /* rdev value for dev inode*/
69 uuid_t ilfu_uuid; /* mount point value */
70 } ilf_u;
71 __int64_t ilf_blkno; /* blkno of inode buffer */
72 int ilf_len; /* len of inode buffer */
73 int ilf_boffset; /* off of inode in buffer */
74} xfs_inode_log_format_t;
75
76/* Initial version shipped with IRIX 5.3-XFS */
77typedef struct xfs_inode_log_format_v1 {
78 unsigned short ilf_type; /* inode log item type */
79 unsigned short ilf_size; /* size of this item */
80 uint ilf_fields; /* flags for fields logged */
81 uint ilf_dsize; /* size of data/ext/root */
82 xfs_ino_t ilf_ino; /* inode number */
83 union {
84 xfs_dev_t ilfu_rdev; /* rdev value for dev inode*/
85 uuid_t ilfu_uuid; /* mount point value */
86 } ilf_u;
87} xfs_inode_log_format_t_v1;
88
89/*
90 * Flags for xfs_trans_log_inode flags field.
91 */
dfc130f3
RC
92#define XFS_ILOG_CORE 0x001 /* log standard inode fields */
93#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
94#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
95#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
96#define XFS_ILOG_DEV 0x010 /* log the dev field */
97#define XFS_ILOG_UUID 0x020 /* log the uuid field */
98#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
99#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
100#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
101
102#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
2bd0ea18
NS
103 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
104 XFS_ILOG_UUID | XFS_ILOG_ADATA | \
105 XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
106
dfc130f3 107#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
2bd0ea18
NS
108 XFS_ILOG_DBROOT)
109
dfc130f3 110#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
2bd0ea18
NS
111 XFS_ILOG_ABROOT)
112
dfc130f3 113#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
2bd0ea18
NS
114 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
115 XFS_ILOG_DEV | XFS_ILOG_UUID | \
116 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
117 XFS_ILOG_ABROOT)
118
dfc130f3
RC
119#define XFS_ILI_HOLD 0x1
120#define XFS_ILI_IOLOCKED_EXCL 0x2
121#define XFS_ILI_IOLOCKED_SHARED 0x4
2bd0ea18 122
dfc130f3 123#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
2bd0ea18
NS
124
125
126#ifdef __KERNEL__
127
128struct xfs_buf;
f9e56f43 129struct xfs_bmbt_rec_64;
2bd0ea18
NS
130struct xfs_inode;
131struct xfs_mount;
132
133
134typedef struct xfs_inode_log_item {
135 xfs_log_item_t ili_item; /* common portion */
136 struct xfs_inode *ili_inode; /* inode ptr */
137 xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
138 xfs_lsn_t ili_last_lsn; /* lsn at last transaction */
139 unsigned short ili_ilock_recur; /* lock recursion count */
140 unsigned short ili_iolock_recur; /* lock recursion count */
141 unsigned short ili_flags; /* misc flags */
142 unsigned short ili_logged; /* flushed logged data */
143 unsigned int ili_last_fields; /* fields when flushed */
f9e56f43
NS
144 struct xfs_bmbt_rec_64 *ili_extents_buf; /* array of logged
145 data exts */
146 struct xfs_bmbt_rec_64 *ili_aextents_buf; /* array of logged
147 attr exts */
dfc130f3 148 unsigned int ili_pushbuf_flag; /* one bit used in push_ail */
2bd0ea18
NS
149
150#ifdef DEBUG
dfc130f3 151 uint64_t ili_push_owner; /* one who sets pushbuf_flag
2bd0ea18
NS
152 above gets to push the buf */
153#endif
154#ifdef XFS_TRANS_DEBUG
155 int ili_root_size;
156 char *ili_orig_root;
157#endif
158 xfs_inode_log_format_t ili_format; /* logged structure */
159} xfs_inode_log_item_t;
160
161
162#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
163int xfs_ilog_fdata(int w);
dfc130f3 164#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
2bd0ea18 165#else
dfc130f3 166#define XFS_ILOG_FDATA(w) \
2bd0ea18
NS
167 ((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA)
168#endif
169
170#endif /* __KERNEL__ */
171
172#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
173int xfs_ilog_fbroot(int w);
dfc130f3 174#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
2bd0ea18 175#else
dfc130f3 176#define XFS_ILOG_FBROOT(w) \
2bd0ea18
NS
177 ((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT)
178#endif
179#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT)
180int xfs_ilog_fext(int w);
dfc130f3 181#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
2bd0ea18 182#else
dfc130f3 183#define XFS_ILOG_FEXT(w) \
2bd0ea18
NS
184 ((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT)
185#endif
186
187#ifdef __KERNEL__
188
189void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
190void xfs_inode_item_destroy(struct xfs_inode *);
191void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *);
192void xfs_iflush_abort(struct xfs_inode *);
193
194#endif /* __KERNEL__ */
195
196#endif /* __XFS_INODE_ITEM_H__ */