2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #ifndef __XFS_INODE_ITEM_H__
33 #define __XFS_INODE_ITEM_H__
36 * This is the structure used to lay out an inode log item in the
37 * log. The size of the inline data/extents/b-tree root to be logged
38 * (if any) is indicated in the ilf_dsize field. Changes to this structure
39 * must be added on to the end.
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.
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
51 * so a new structure definition wasn't necessary. However, we had
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
57 * for a change in the inode cluster size. This new version was
58 * released with IRIX 6.2.
60 typedef 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 */
68 xfs_dev_t ilfu_rdev
; /* rdev value for dev inode*/
69 uuid_t ilfu_uuid
; /* mount point value */
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
;
76 /* Initial version shipped with IRIX 5.3-XFS */
77 typedef 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 */
84 xfs_dev_t ilfu_rdev
; /* rdev value for dev inode*/
85 uuid_t ilfu_uuid
; /* mount point value */
87 } xfs_inode_log_format_t_v1
;
90 * Flags for xfs_trans_log_inode flags field.
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 */
102 #define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
103 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
104 XFS_ILOG_UUID | XFS_ILOG_ADATA | \
105 XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
107 #define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
110 #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
113 #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
114 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
115 XFS_ILOG_DEV | XFS_ILOG_UUID | \
116 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
119 #define XFS_ILI_HOLD 0x1
120 #define XFS_ILI_IOLOCKED_EXCL 0x2
121 #define XFS_ILI_IOLOCKED_SHARED 0x4
123 #define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
129 struct xfs_bmbt_rec_64
;
134 typedef 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 */
144 struct xfs_bmbt_rec_64
*ili_extents_buf
; /* array of logged
146 struct xfs_bmbt_rec_64
*ili_aextents_buf
; /* array of logged
148 unsigned int ili_pushbuf_flag
; /* one bit used in push_ail */
151 uint64_t ili_push_owner
; /* one who sets pushbuf_flag
152 above gets to push the buf */
154 #ifdef XFS_TRANS_DEBUG
158 xfs_inode_log_format_t ili_format
; /* logged structure */
159 } xfs_inode_log_item_t
;
162 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
163 int xfs_ilog_fdata(int w
);
164 #define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
166 #define XFS_ILOG_FDATA(w) \
167 ((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA)
170 #endif /* __KERNEL__ */
172 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
173 int xfs_ilog_fbroot(int w
);
174 #define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
176 #define XFS_ILOG_FBROOT(w) \
177 ((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT)
179 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT)
180 int xfs_ilog_fext(int w
);
181 #define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
183 #define XFS_ILOG_FEXT(w) \
184 ((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT)
189 void xfs_inode_item_init(struct xfs_inode
*, struct xfs_mount
*);
190 void xfs_inode_item_destroy(struct xfs_inode
*);
191 void xfs_iflush_done(struct xfs_buf
*, xfs_inode_log_item_t
*);
192 void xfs_istale_done(struct xfs_buf
*, xfs_inode_log_item_t
*);
193 void xfs_iflush_abort(struct xfs_inode
*);
195 #endif /* __KERNEL__ */
197 #endif /* __XFS_INODE_ITEM_H__ */