aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_format.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-08-12 06:49:23 -0400
committerBen Myers <bpm@sgi.com>2013-08-12 17:05:19 -0400
commit69432832fd7466c20c7c92cbd92c561ac78988c2 (patch)
treee88e0d4698eab40c93248c7be3b7d8d2ffd52c19 /fs/xfs/xfs_log_format.h
parentfc06c6d064dd50f7aa157065ef79216190d75c91 (diff)
xfs: split out inode log item format definition
The log item format definitions are shared with userspace. Split them out of header files that contain kernel only defintions to make it simple to shared them. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log_format.h')
-rw-r--r--fs/xfs/xfs_log_format.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/fs/xfs/xfs_log_format.h b/fs/xfs/xfs_log_format.h
index 9f9aeb63545a..fd46a7f2293a 100644
--- a/fs/xfs/xfs_log_format.h
+++ b/fs/xfs/xfs_log_format.h
@@ -18,6 +18,16 @@
18#ifndef __XFS_LOG_FORMAT_H__ 18#ifndef __XFS_LOG_FORMAT_H__
19#define __XFS_LOG_FORMAT_H__ 19#define __XFS_LOG_FORMAT_H__
20 20
21/*
22 * On-disk Log Format definitions.
23 *
24 * This file contains all the on-disk format definitions used within the log. It
25 * includes the physical log structure itself, as well as all the log item
26 * format structures that are written into the log and intepreted by log
27 * recovery. We start with the physical log format definitions, and then work
28 * through all the log items definitions and everything they encode into the
29 * log.
30 */
21typedef __uint32_t xlog_tid_t; 31typedef __uint32_t xlog_tid_t;
22 32
23#define XLOG_MIN_ICLOGS 2 33#define XLOG_MIN_ICLOGS 2
@@ -175,4 +185,183 @@ typedef struct xfs_log_iovec {
175 uint i_type; /* type of region */ 185 uint i_type; /* type of region */
176} xfs_log_iovec_t; 186} xfs_log_iovec_t;
177 187
188
189/*
190 * Inode Log Item Format definitions.
191 *
192 * This is the structure used to lay out an inode log item in the
193 * log. The size of the inline data/extents/b-tree root to be logged
194 * (if any) is indicated in the ilf_dsize field. Changes to this structure
195 * must be added on to the end.
196 */
197typedef struct xfs_inode_log_format {
198 __uint16_t ilf_type; /* inode log item type */
199 __uint16_t ilf_size; /* size of this item */
200 __uint32_t ilf_fields; /* flags for fields logged */
201 __uint16_t ilf_asize; /* size of attr d/ext/root */
202 __uint16_t ilf_dsize; /* size of data/ext/root */
203 __uint64_t ilf_ino; /* inode number */
204 union {
205 __uint32_t ilfu_rdev; /* rdev value for dev inode*/
206 uuid_t ilfu_uuid; /* mount point value */
207 } ilf_u;
208 __int64_t ilf_blkno; /* blkno of inode buffer */
209 __int32_t ilf_len; /* len of inode buffer */
210 __int32_t ilf_boffset; /* off of inode in buffer */
211} xfs_inode_log_format_t;
212
213typedef struct xfs_inode_log_format_32 {
214 __uint16_t ilf_type; /* inode log item type */
215 __uint16_t ilf_size; /* size of this item */
216 __uint32_t ilf_fields; /* flags for fields logged */
217 __uint16_t ilf_asize; /* size of attr d/ext/root */
218 __uint16_t ilf_dsize; /* size of data/ext/root */
219 __uint64_t ilf_ino; /* inode number */
220 union {
221 __uint32_t ilfu_rdev; /* rdev value for dev inode*/
222 uuid_t ilfu_uuid; /* mount point value */
223 } ilf_u;
224 __int64_t ilf_blkno; /* blkno of inode buffer */
225 __int32_t ilf_len; /* len of inode buffer */
226 __int32_t ilf_boffset; /* off of inode in buffer */
227} __attribute__((packed)) xfs_inode_log_format_32_t;
228
229typedef struct xfs_inode_log_format_64 {
230 __uint16_t ilf_type; /* inode log item type */
231 __uint16_t ilf_size; /* size of this item */
232 __uint32_t ilf_fields; /* flags for fields logged */
233 __uint16_t ilf_asize; /* size of attr d/ext/root */
234 __uint16_t ilf_dsize; /* size of data/ext/root */
235 __uint32_t ilf_pad; /* pad for 64 bit boundary */
236 __uint64_t ilf_ino; /* inode number */
237 union {
238 __uint32_t ilfu_rdev; /* rdev value for dev inode*/
239 uuid_t ilfu_uuid; /* mount point value */
240 } ilf_u;
241 __int64_t ilf_blkno; /* blkno of inode buffer */
242 __int32_t ilf_len; /* len of inode buffer */
243 __int32_t ilf_boffset; /* off of inode in buffer */
244} xfs_inode_log_format_64_t;
245
246/*
247 * Flags for xfs_trans_log_inode flags field.
248 */
249#define XFS_ILOG_CORE 0x001 /* log standard inode fields */
250#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
251#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
252#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
253#define XFS_ILOG_DEV 0x010 /* log the dev field */
254#define XFS_ILOG_UUID 0x020 /* log the uuid field */
255#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
256#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
257#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
258
259
260/*
261 * The timestamps are dirty, but not necessarily anything else in the inode
262 * core. Unlike the other fields above this one must never make it to disk
263 * in the ilf_fields of the inode_log_format, but is purely store in-memory in
264 * ili_fields in the inode_log_item.
265 */
266#define XFS_ILOG_TIMESTAMP 0x4000
267
268#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
269 XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
270 XFS_ILOG_UUID | XFS_ILOG_ADATA | \
271 XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
272
273#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
274 XFS_ILOG_DBROOT)
275
276#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
277 XFS_ILOG_ABROOT)
278
279#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
280 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
281 XFS_ILOG_DEV | XFS_ILOG_UUID | \
282 XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
283 XFS_ILOG_ABROOT | XFS_ILOG_TIMESTAMP)
284
285static inline int xfs_ilog_fbroot(int w)
286{
287 return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
288}
289
290static inline int xfs_ilog_fext(int w)
291{
292 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
293}
294
295static inline int xfs_ilog_fdata(int w)
296{
297 return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
298}
299
300/*
301 * Incore version of the on-disk inode core structures. We log this directly
302 * into the journal in host CPU format (for better or worse) and as such
303 * directly mirrors the xfs_dinode structure as it must contain all the same
304 * information.
305 */
306typedef struct xfs_ictimestamp {
307 __int32_t t_sec; /* timestamp seconds */
308 __int32_t t_nsec; /* timestamp nanoseconds */
309} xfs_ictimestamp_t;
310
311/*
312 * NOTE: This structure must be kept identical to struct xfs_dinode
313 * in xfs_dinode.h except for the endianness annotations.
314 */
315typedef struct xfs_icdinode {
316 __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
317 __uint16_t di_mode; /* mode and type of file */
318 __int8_t di_version; /* inode version */
319 __int8_t di_format; /* format of di_c data */
320 __uint16_t di_onlink; /* old number of links to file */
321 __uint32_t di_uid; /* owner's user id */
322 __uint32_t di_gid; /* owner's group id */
323 __uint32_t di_nlink; /* number of links to file */
324 __uint16_t di_projid_lo; /* lower part of owner's project id */
325 __uint16_t di_projid_hi; /* higher part of owner's project id */
326 __uint8_t di_pad[6]; /* unused, zeroed space */
327 __uint16_t di_flushiter; /* incremented on flush */
328 xfs_ictimestamp_t di_atime; /* time last accessed */
329 xfs_ictimestamp_t di_mtime; /* time last modified */
330 xfs_ictimestamp_t di_ctime; /* time created/inode modified */
331 xfs_fsize_t di_size; /* number of bytes in file */
332 xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */
333 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
334 xfs_extnum_t di_nextents; /* number of extents in data fork */
335 xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/
336 __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
337 __int8_t di_aformat; /* format of attr fork's data */
338 __uint32_t di_dmevmask; /* DMIG event mask */
339 __uint16_t di_dmstate; /* DMIG state info */
340 __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
341 __uint32_t di_gen; /* generation number */
342
343 /* di_next_unlinked is the only non-core field in the old dinode */
344 xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */
345
346 /* start of the extended dinode, writable fields */
347 __uint32_t di_crc; /* CRC of the inode */
348 __uint64_t di_changecount; /* number of attribute changes */
349 xfs_lsn_t di_lsn; /* flush sequence */
350 __uint64_t di_flags2; /* more random flags */
351 __uint8_t di_pad2[16]; /* more padding for future expansion */
352
353 /* fields only written to during inode creation */
354 xfs_ictimestamp_t di_crtime; /* time created */
355 xfs_ino_t di_ino; /* inode number */
356 uuid_t di_uuid; /* UUID of the filesystem */
357
358 /* structure must be padded to 64 bit alignment */
359} xfs_icdinode_t;
360
361static inline uint xfs_icdinode_size(int version)
362{
363 if (version == 3)
364 return sizeof(struct xfs_icdinode);
365 return offsetof(struct xfs_icdinode, di_next_unlinked);
366}
178#endif /* __XFS_LOG_FORMAT_H__ */ 367#endif /* __XFS_LOG_FORMAT_H__ */