2 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef __XFS_INODE_ITEM_H__
19 #define __XFS_INODE_ITEM_H__
22 * This is the structure used to lay out an inode log item in the
23 * log. The size of the inline data/extents/b-tree root to be logged
24 * (if any) is indicated in the ilf_dsize field. Changes to this structure
25 * must be added on to the end.
27 * Convention for naming inode log item versions : The current version
28 * is always named XFS_LI_INODE. When an inode log item gets superseded,
29 * add the latest version of IRIX that will generate logs with that item
30 * to the version name.
32 * -Version 1 of this structure (XFS_LI_5_3_INODE) included up to the first
33 * union (ilf_u) field. This was released with IRIX 5.3-XFS.
34 * -Version 2 of this structure (XFS_LI_6_1_INODE) is currently the entire
35 * structure. This was released with IRIX 6.0.1-XFS and IRIX 6.1.
36 * -Version 3 of this structure (XFS_LI_INODE) is the same as version 2
37 * so a new structure definition wasn't necessary. However, we had
38 * to add a new type because the inode cluster size changed from 4K
39 * to 8K and the version number had to be rev'ved to keep older kernels
40 * from trying to recover logs with the 8K buffers in them. The logging
41 * code can handle recovery on different-sized clusters now so hopefully
42 * this'll be the last time we need to change the inode log item just
43 * for a change in the inode cluster size. This new version was
44 * released with IRIX 6.2.
46 typedef struct xfs_inode_log_format
{
47 unsigned short ilf_type
; /* inode log item type */
48 unsigned short ilf_size
; /* size of this item */
49 uint ilf_fields
; /* flags for fields logged */
50 ushort ilf_asize
; /* size of attr d/ext/root */
51 ushort ilf_dsize
; /* size of data/ext/root */
52 xfs_ino_t ilf_ino
; /* inode number */
54 xfs_dev_t ilfu_rdev
; /* rdev value for dev inode*/
55 uuid_t ilfu_uuid
; /* mount point value */
57 __int64_t ilf_blkno
; /* blkno of inode buffer */
58 int ilf_len
; /* len of inode buffer */
59 int ilf_boffset
; /* off of inode in buffer */
60 } xfs_inode_log_format_t
;
62 /* Initial version shipped with IRIX 5.3-XFS */
63 typedef struct xfs_inode_log_format_v1
{
64 unsigned short ilf_type
; /* inode log item type */
65 unsigned short ilf_size
; /* size of this item */
66 uint ilf_fields
; /* flags for fields logged */
67 uint ilf_dsize
; /* size of data/ext/root */
68 xfs_ino_t ilf_ino
; /* inode number */
70 xfs_dev_t ilfu_rdev
; /* rdev value for dev inode*/
71 uuid_t ilfu_uuid
; /* mount point value */
73 } xfs_inode_log_format_t_v1
;
76 * Flags for xfs_trans_log_inode flags field.
78 #define XFS_ILOG_CORE 0x001 /* log standard inode fields */
79 #define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
80 #define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
81 #define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
82 #define XFS_ILOG_DEV 0x010 /* log the dev field */
83 #define XFS_ILOG_UUID 0x020 /* log the uuid field */
84 #define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
85 #define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
86 #define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
88 #define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
89 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
90 XFS_ILOG_UUID | XFS_ILOG_ADATA | \
91 XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
93 #define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
96 #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
99 #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
100 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
101 XFS_ILOG_DEV | XFS_ILOG_UUID | \
102 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
105 #define XFS_ILI_HOLD 0x1
106 #define XFS_ILI_IOLOCKED_EXCL 0x2
107 #define XFS_ILI_IOLOCKED_SHARED 0x4
109 #define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
115 struct xfs_bmbt_rec_64
;
120 typedef struct xfs_inode_log_item
{
121 xfs_log_item_t ili_item
; /* common portion */
122 struct xfs_inode
*ili_inode
; /* inode ptr */
123 xfs_lsn_t ili_flush_lsn
; /* lsn at last flush */
124 xfs_lsn_t ili_last_lsn
; /* lsn at last transaction */
125 unsigned short ili_ilock_recur
; /* lock recursion count */
126 unsigned short ili_iolock_recur
; /* lock recursion count */
127 unsigned short ili_flags
; /* misc flags */
128 unsigned short ili_logged
; /* flushed logged data */
129 unsigned int ili_last_fields
; /* fields when flushed */
130 struct xfs_bmbt_rec_64
*ili_extents_buf
; /* array of logged
132 struct xfs_bmbt_rec_64
*ili_aextents_buf
; /* array of logged
134 unsigned int ili_pushbuf_flag
; /* one bit used in push_ail */
137 uint64_t ili_push_owner
; /* one who sets pushbuf_flag
138 above gets to push the buf */
140 #ifdef XFS_TRANS_DEBUG
144 xfs_inode_log_format_t ili_format
; /* logged structure */
145 } xfs_inode_log_item_t
;
148 #define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
149 static inline int xfs_ilog_fdata(int w
)
151 return (w
== XFS_DATA_FORK
? XFS_ILOG_DDATA
: XFS_ILOG_ADATA
);
154 #endif /* __KERNEL__ */
156 #define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
157 static inline int xfs_ilog_fbroot(int w
)
159 return (w
== XFS_DATA_FORK
? XFS_ILOG_DBROOT
: XFS_ILOG_ABROOT
);
162 #define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
163 static inline int xfs_ilog_fext(int w
)
165 return (w
== XFS_DATA_FORK
? XFS_ILOG_DEXT
: XFS_ILOG_AEXT
);
170 extern void xfs_inode_item_init(struct xfs_inode
*, struct xfs_mount
*);
171 extern void xfs_inode_item_destroy(struct xfs_inode
*);
172 extern void xfs_iflush_done(struct xfs_buf
*, xfs_inode_log_item_t
*);
173 extern void xfs_istale_done(struct xfs_buf
*, xfs_inode_log_item_t
*);
174 extern void xfs_iflush_abort(struct xfs_inode
*);
176 #endif /* __KERNEL__ */
178 #endif /* __XFS_INODE_ITEM_H__ */