1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6 #ifndef __XFS_LOG_FORMAT_H__
7 #define __XFS_LOG_FORMAT_H__
8
9 struct xfs_mount;
10 struct xfs_trans_res;
11
12 /*
13 * On-disk Log Format definitions.
14 *
15 * This file contains all the on-disk format definitions used within the log. It
16 * includes the physical log structure itself, as well as all the log item
17 * format structures that are written into the log and intepreted by log
18 * recovery. We start with the physical log format definitions, and then work
19 * through all the log items definitions and everything they encode into the
20 * log.
21 */
22 typedef uint32_t xlog_tid_t;
23
24 #define XLOG_MIN_ICLOGS 2
25 #define XLOG_MAX_ICLOGS 8
26 #define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */
27 #define XLOG_VERSION_1 1
28 #define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */
29 #define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2)
30 #define XLOG_MIN_RECORD_BSIZE (16*1024) /* eventually 32k */
31 #define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */
32 #define XLOG_MAX_RECORD_BSIZE (256*1024)
33 #define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */
34 #define XLOG_CYCLE_DATA_SIZE (XLOG_HEADER_CYCLE_SIZE / BBSIZE)
35 #define XLOG_MIN_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */
36 #define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */
37 #define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */
38
39 #define XLOG_HEADER_SIZE 512
40
41 /* Minimum number of transactions that must fit in the log (defined by mkfs) */
42 #define XFS_MIN_LOG_FACTOR 3
43
44 #define XLOG_REC_SHIFT(log) \
45 BTOBB(1 << (xfs_has_logv2(log->l_mp) ? \
46 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
47 #define XLOG_TOTAL_REC_SHIFT(log) \
48 BTOBB(XLOG_MAX_ICLOGS << (xfs_has_logv2(log->l_mp) ? \
49 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
50
51 /* get lsn fields */
52 #define CYCLE_LSN(lsn) ((uint)((lsn)>>32))
53 #define BLOCK_LSN(lsn) ((uint)(lsn))
54
55 /*
56 * By comparing each component, we don't have to worry about extra endian issues
57 * in treating two 32 bit numbers as one 64 bit number
58 */
XFS_LSN_CMP(xfs_lsn_t lsn1,xfs_lsn_t lsn2)59 static inline xfs_lsn_t XFS_LSN_CMP(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
60 {
61 if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
62 return CYCLE_LSN(lsn1) < CYCLE_LSN(lsn2) ? -999 : 999;
63 if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
64 return BLOCK_LSN(lsn1) < BLOCK_LSN(lsn2) ? -999 : 999;
65 return 0;
66 }
67
68 /* this is used in a spot where we might otherwise double-endian-flip */
69 #define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0])
70
xlog_assign_lsn(uint cycle,uint block)71 static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block)
72 {
73 return ((xfs_lsn_t)cycle << 32) | block;
74 }
75
xlog_get_cycle(char * ptr)76 static inline uint xlog_get_cycle(char *ptr)
77 {
78 if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
79 return be32_to_cpu(*((__be32 *)ptr + 1));
80 else
81 return be32_to_cpu(*(__be32 *)ptr);
82 }
83
84 /* Log Clients */
85 #define XFS_TRANSACTION 0x69
86 #define XFS_LOG 0xaa
87
88 #define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */
89
90 /*
91 * Log item for unmount records.
92 *
93 * The unmount record used to have a string "Unmount filesystem--" in the
94 * data section where the "Un" was really a magic number (XLOG_UNMOUNT_TYPE).
95 * We just write the magic number now; see xfs_log_unmount_write.
96 */
97 struct xfs_unmount_log_format {
98 uint16_t magic; /* XLOG_UNMOUNT_TYPE */
99 uint16_t pad1;
100 uint32_t pad2; /* may as well make it 64 bits */
101 };
102
103 /*
104 * Flags to log operation header
105 *
106 * The first write of a new transaction will be preceded with a start
107 * record, XLOG_START_TRANS. Once a transaction is committed, a commit
108 * record is written, XLOG_COMMIT_TRANS. If a single region can not fit into
109 * the remainder of the current active in-core log, it is split up into
110 * multiple regions. Each partial region will be marked with a
111 * XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS.
112 *
113 */
114 #define XLOG_START_TRANS 0x01 /* Start a new transaction */
115 #define XLOG_COMMIT_TRANS 0x02 /* Commit this transaction */
116 #define XLOG_CONTINUE_TRANS 0x04 /* Cont this trans into new region */
117 #define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region */
118 #define XLOG_END_TRANS 0x10 /* End a continued transaction */
119 #define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */
120
121 struct xlog_op_header {
122 __be32 oh_tid; /* transaction id of operation : 4 b */
123 __be32 oh_len; /* bytes in data region : 4 b */
124 __u8 oh_clientid; /* who sent me this : 1 b */
125 __u8 oh_flags; /* : 1 b */
126 __u16 oh_res2; /* 32 bit align : 2 b */
127 };
128
129 /* valid values for h_fmt */
130 #define XLOG_FMT_UNKNOWN 0
131 #define XLOG_FMT_LINUX_LE 1
132 #define XLOG_FMT_LINUX_BE 2
133 #define XLOG_FMT_IRIX_BE 3
134
135 /* our fmt */
136 #ifdef XFS_NATIVE_HOST
137 #define XLOG_FMT XLOG_FMT_LINUX_BE
138 #else
139 #define XLOG_FMT XLOG_FMT_LINUX_LE
140 #endif
141
142 struct xlog_rec_ext_header {
143 __be32 xh_cycle; /* write cycle of log */
144 __be32 xh_cycle_data[XLOG_CYCLE_DATA_SIZE];
145 __u8 xh_reserved[252];
146 };
147
148 /* actual ext header payload size for checksumming */
149 #define XLOG_REC_EXT_SIZE \
150 offsetofend(struct xlog_rec_ext_header, xh_cycle_data)
151
152 struct xlog_rec_header {
153 __be32 h_magicno; /* log record (LR) identifier : 4 */
154 __be32 h_cycle; /* write cycle of log : 4 */
155 __be32 h_version; /* LR version : 4 */
156 __be32 h_len; /* len in bytes; should be 64-bit aligned: 4 */
157 __be64 h_lsn; /* lsn of this LR : 8 */
158 __be64 h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */
159 __le32 h_crc; /* crc of log record : 4 */
160 __be32 h_prev_block; /* block number to previous LR : 4 */
161 __be32 h_num_logops; /* number of log operations in this LR : 4 */
162 __be32 h_cycle_data[XLOG_CYCLE_DATA_SIZE];
163
164 /* fields added by the Linux port: */
165 __be32 h_fmt; /* format of log record : 4 */
166 uuid_t h_fs_uuid; /* uuid of FS : 16 */
167
168 /* fields added for log v2: */
169 __be32 h_size; /* iclog size : 4 */
170
171 /*
172 * When h_size added for log v2 support, it caused structure to have
173 * a different size on i386 vs all other architectures because the
174 * sum of the size ofthe member is not aligned by that of the largest
175 * __be64-sized member, and i386 has really odd struct alignment rules.
176 *
177 * Due to the way the log headers are placed out on-disk that alone is
178 * not a problem becaue the xlog_rec_header always sits alone in a
179 * BBSIZEs area, and the rest of that area is padded with zeroes.
180 * But xlog_cksum used to calculate the checksum based on the structure
181 * size, and thus gives different checksums for i386 vs the rest.
182 * We now do two checksum validation passes for both sizes to allow
183 * moving v5 file systems with unclean logs between i386 and other
184 * (little-endian) architectures.
185 */
186 __u32 h_pad0;
187
188 __u8 h_reserved[184];
189 struct xlog_rec_ext_header h_ext[];
190 };
191
192 #ifdef __i386__
193 #define XLOG_REC_SIZE offsetofend(struct xlog_rec_header, h_size)
194 #define XLOG_REC_SIZE_OTHER offsetofend(struct xlog_rec_header, h_pad0)
195 #else
196 #define XLOG_REC_SIZE offsetofend(struct xlog_rec_header, h_pad0)
197 #define XLOG_REC_SIZE_OTHER offsetofend(struct xlog_rec_header, h_size)
198 #endif /* __i386__ */
199
200 /*
201 * Transaction Header definitions.
202 *
203 * This is the structure written in the log at the head of every transaction. It
204 * identifies the type and id of the transaction, and contains the number of
205 * items logged by the transaction so we know how many to expect during
206 * recovery.
207 *
208 * Do not change the below structure without redoing the code in
209 * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans().
210 */
211 struct xfs_trans_header {
212 uint th_magic; /* magic number */
213 uint th_type; /* transaction type */
214 int32_t th_tid; /* transaction id (unused) */
215 uint th_num_items; /* num items logged by trans */
216 };
217
218 #define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */
219
220 /*
221 * The only type valid for th_type in CIL-enabled file system logs:
222 */
223 #define XFS_TRANS_CHECKPOINT 40
224
225 /*
226 * Log item types.
227 */
228 #define XFS_LI_EFI 0x1236
229 #define XFS_LI_EFD 0x1237
230 #define XFS_LI_IUNLINK 0x1238
231 #define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */
232 #define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */
233 #define XFS_LI_DQUOT 0x123d
234 #define XFS_LI_QUOTAOFF 0x123e
235 #define XFS_LI_ICREATE 0x123f
236 #define XFS_LI_RUI 0x1240 /* rmap update intent */
237 #define XFS_LI_RUD 0x1241
238 #define XFS_LI_CUI 0x1242 /* refcount update intent */
239 #define XFS_LI_CUD 0x1243
240 #define XFS_LI_BUI 0x1244 /* bmbt update intent */
241 #define XFS_LI_BUD 0x1245
242 #define XFS_LI_ATTRI 0x1246 /* attr set/remove intent*/
243 #define XFS_LI_ATTRD 0x1247 /* attr set/remove done */
244 #define XFS_LI_XMI 0x1248 /* mapping exchange intent */
245 #define XFS_LI_XMD 0x1249 /* mapping exchange done */
246 #define XFS_LI_EFI_RT 0x124a /* realtime extent free intent */
247 #define XFS_LI_EFD_RT 0x124b /* realtime extent free done */
248 #define XFS_LI_RUI_RT 0x124c /* realtime rmap update intent */
249 #define XFS_LI_RUD_RT 0x124d /* realtime rmap update done */
250 #define XFS_LI_CUI_RT 0x124e /* realtime refcount update intent */
251 #define XFS_LI_CUD_RT 0x124f /* realtime refcount update done */
252
253 #define XFS_LI_TYPE_DESC \
254 { XFS_LI_EFI, "XFS_LI_EFI" }, \
255 { XFS_LI_EFD, "XFS_LI_EFD" }, \
256 { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \
257 { XFS_LI_INODE, "XFS_LI_INODE" }, \
258 { XFS_LI_BUF, "XFS_LI_BUF" }, \
259 { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \
260 { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \
261 { XFS_LI_ICREATE, "XFS_LI_ICREATE" }, \
262 { XFS_LI_RUI, "XFS_LI_RUI" }, \
263 { XFS_LI_RUD, "XFS_LI_RUD" }, \
264 { XFS_LI_CUI, "XFS_LI_CUI" }, \
265 { XFS_LI_CUD, "XFS_LI_CUD" }, \
266 { XFS_LI_BUI, "XFS_LI_BUI" }, \
267 { XFS_LI_BUD, "XFS_LI_BUD" }, \
268 { XFS_LI_ATTRI, "XFS_LI_ATTRI" }, \
269 { XFS_LI_ATTRD, "XFS_LI_ATTRD" }, \
270 { XFS_LI_XMI, "XFS_LI_XMI" }, \
271 { XFS_LI_XMD, "XFS_LI_XMD" }, \
272 { XFS_LI_EFI_RT, "XFS_LI_EFI_RT" }, \
273 { XFS_LI_EFD_RT, "XFS_LI_EFD_RT" }, \
274 { XFS_LI_RUI_RT, "XFS_LI_RUI_RT" }, \
275 { XFS_LI_RUD_RT, "XFS_LI_RUD_RT" }, \
276 { XFS_LI_CUI_RT, "XFS_LI_CUI_RT" }, \
277 { XFS_LI_CUD_RT, "XFS_LI_CUD_RT" }
278
279 /*
280 * Inode Log Item Format definitions.
281 *
282 * This is the structure used to lay out an inode log item in the
283 * log. The size of the inline data/extents/b-tree root to be logged
284 * (if any) is indicated in the ilf_dsize field. Changes to this structure
285 * must be added on to the end.
286 */
287 struct xfs_inode_log_format {
288 uint16_t ilf_type; /* inode log item type */
289 uint16_t ilf_size; /* size of this item */
290 uint32_t ilf_fields; /* flags for fields logged */
291 uint16_t ilf_asize; /* size of attr d/ext/root */
292 uint16_t ilf_dsize; /* size of data/ext/root */
293 uint32_t ilf_pad; /* pad for 64 bit boundary */
294 uint64_t ilf_ino; /* inode number */
295 union {
296 uint32_t ilfu_rdev; /* rdev value for dev inode*/
297 uint8_t __pad[16]; /* unused */
298 } ilf_u;
299 int64_t ilf_blkno; /* blkno of inode buffer */
300 int32_t ilf_len; /* len of inode buffer */
301 int32_t ilf_boffset; /* off of inode in buffer */
302 };
303
304 /*
305 * Old 32 bit systems will log in this format without the 64 bit
306 * alignment padding. Recovery will detect this and convert it to the
307 * correct format.
308 */
309 struct xfs_inode_log_format_32 {
310 uint16_t ilf_type; /* inode log item type */
311 uint16_t ilf_size; /* size of this item */
312 uint32_t ilf_fields; /* flags for fields logged */
313 uint16_t ilf_asize; /* size of attr d/ext/root */
314 uint16_t ilf_dsize; /* size of data/ext/root */
315 uint64_t ilf_ino; /* inode number */
316 union {
317 uint32_t ilfu_rdev; /* rdev value for dev inode*/
318 uint8_t __pad[16]; /* unused */
319 } ilf_u;
320 int64_t ilf_blkno; /* blkno of inode buffer */
321 int32_t ilf_len; /* len of inode buffer */
322 int32_t ilf_boffset; /* off of inode in buffer */
323 } __attribute__((packed));
324
325
326 /*
327 * Flags for xfs_trans_log_inode flags field.
328 */
329 #define XFS_ILOG_CORE 0x001 /* log standard inode fields */
330 #define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
331 #define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
332 #define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
333 #define XFS_ILOG_DEV 0x010 /* log the dev field */
334 #define XFS_ILOG_UUID 0x020 /* added long ago, but never used */
335 #define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
336 #define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
337 #define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
338 #define XFS_ILOG_DOWNER 0x200 /* change the data fork owner on replay */
339 #define XFS_ILOG_AOWNER 0x400 /* change the attr fork owner on replay */
340
341 /*
342 * The timestamps are dirty, but not necessarily anything else in the inode
343 * core. Unlike the other fields above this one must never make it to disk
344 * in the ilf_fields of the inode_log_format, but is purely store in-memory in
345 * ili_fields in the inode_log_item.
346 */
347 #define XFS_ILOG_TIMESTAMP 0x4000
348
349 /*
350 * The version field has been changed, but not necessarily anything else of
351 * interest. This must never make it to disk - it is used purely to ensure that
352 * the inode item ->precommit operation can update the fsync flag triggers
353 * in the inode item correctly.
354 */
355 #define XFS_ILOG_IVERSION 0x8000
356
357 #define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
358 XFS_ILOG_DBROOT)
359
360 #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
361 XFS_ILOG_ABROOT)
362
363 #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
364 XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
365 XFS_ILOG_DEV | XFS_ILOG_ADATA | \
366 XFS_ILOG_AEXT | XFS_ILOG_ABROOT | \
367 XFS_ILOG_TIMESTAMP | XFS_ILOG_DOWNER | \
368 XFS_ILOG_AOWNER)
369
xfs_ilog_fbroot(int w)370 static inline int xfs_ilog_fbroot(int w)
371 {
372 return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
373 }
374
xfs_ilog_fext(int w)375 static inline int xfs_ilog_fext(int w)
376 {
377 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
378 }
379
xfs_ilog_fdata(int w)380 static inline int xfs_ilog_fdata(int w)
381 {
382 return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
383 }
384
385 /*
386 * Incore version of the on-disk inode core structures. We log this directly
387 * into the journal in host CPU format (for better or worse) and as such
388 * directly mirrors the xfs_dinode structure as it must contain all the same
389 * information.
390 */
391 typedef uint64_t xfs_log_timestamp_t;
392
393 /* Legacy timestamp encoding format. */
394 struct xfs_log_legacy_timestamp {
395 int32_t t_sec; /* timestamp seconds */
396 int32_t t_nsec; /* timestamp nanoseconds */
397 };
398
399 /*
400 * Define the format of the inode core that is logged. This structure must be
401 * kept identical to struct xfs_dinode except for the endianness annotations.
402 */
403 struct xfs_log_dinode {
404 uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
405 uint16_t di_mode; /* mode and type of file */
406 int8_t di_version; /* inode version */
407 int8_t di_format; /* format of di_c data */
408 uint16_t di_metatype; /* metadata type, if DIFLAG2_METADATA */
409 uint32_t di_uid; /* owner's user id */
410 uint32_t di_gid; /* owner's group id */
411 uint32_t di_nlink; /* number of links to file */
412 uint16_t di_projid_lo; /* lower part of owner's project id */
413 uint16_t di_projid_hi; /* higher part of owner's project id */
414 union {
415 /* Number of data fork extents if NREXT64 is set */
416 uint64_t di_big_nextents;
417
418 /* Padding for V3 inodes without NREXT64 set. */
419 uint64_t di_v3_pad;
420
421 /* Padding and inode flush counter for V2 inodes. */
422 struct {
423 uint8_t di_v2_pad[6]; /* V2 inode zeroed space */
424 uint16_t di_flushiter; /* V2 inode incremented on flush */
425 };
426 };
427 xfs_log_timestamp_t di_atime; /* time last accessed */
428 xfs_log_timestamp_t di_mtime; /* time last modified */
429 xfs_log_timestamp_t di_ctime; /* time created/inode modified */
430 xfs_fsize_t di_size; /* number of bytes in file */
431 xfs_rfsblock_t di_nblocks; /* # of direct & btree blocks used */
432 xfs_extlen_t di_extsize; /* basic/minimum extent size for file */
433 union {
434 /*
435 * For V2 inodes and V3 inodes without NREXT64 set, this
436 * is the number of data and attr fork extents.
437 */
438 struct {
439 uint32_t di_nextents;
440 uint16_t di_anextents;
441 } __packed;
442
443 /* Number of attr fork extents if NREXT64 is set. */
444 struct {
445 uint32_t di_big_anextents;
446 uint16_t di_nrext64_pad;
447 } __packed;
448 } __packed;
449 uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */
450 int8_t di_aformat; /* format of attr fork's data */
451 uint32_t di_dmevmask; /* DMIG event mask */
452 uint16_t di_dmstate; /* DMIG state info */
453 uint16_t di_flags; /* random flags, XFS_DIFLAG_... */
454 uint32_t di_gen; /* generation number */
455
456 /* di_next_unlinked is the only non-core field in the old dinode */
457 xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */
458
459 /* start of the extended dinode, writable fields */
460 uint32_t di_crc; /* CRC of the inode */
461 uint64_t di_changecount; /* number of attribute changes */
462
463 /*
464 * The LSN we write to this field during formatting is not a reflection
465 * of the current on-disk LSN. It should never be used for recovery
466 * sequencing, nor should it be recovered into the on-disk inode at all.
467 * See xlog_recover_inode_commit_pass2() and xfs_log_dinode_to_disk()
468 * for details.
469 */
470 xfs_lsn_t di_lsn;
471
472 uint64_t di_flags2; /* more random flags */
473 union {
474 /* basic cow extent size for (regular) file */
475 uint32_t di_cowextsize;
476 /* used blocks in RTG for (zoned) rtrmap inode */
477 uint32_t di_used_blocks;
478 };
479 uint8_t di_pad2[12]; /* more padding for future expansion */
480
481 /* fields only written to during inode creation */
482 xfs_log_timestamp_t di_crtime; /* time created */
483 xfs_ino_t di_ino; /* inode number */
484 uuid_t di_uuid; /* UUID of the filesystem */
485
486 /* structure must be padded to 64 bit alignment */
487 };
488
489 #define xfs_log_dinode_size(mp) \
490 (xfs_has_v3inodes((mp)) ? \
491 sizeof(struct xfs_log_dinode) : \
492 offsetof(struct xfs_log_dinode, di_next_unlinked))
493
494 /*
495 * Buffer Log Format definitions
496 *
497 * These are the physical dirty bitmap definitions for the log format structure.
498 */
499 #define XFS_BLF_CHUNK 128
500 #define XFS_BLF_SHIFT 7
501 #define BIT_TO_WORD_SHIFT 5
502 #define NBWORD (NBBY * sizeof(unsigned int))
503
504 /*
505 * This flag indicates that the buffer contains on disk inodes
506 * and requires special recovery handling.
507 */
508 #define XFS_BLF_INODE_BUF (1<<0)
509
510 /*
511 * This flag indicates that the buffer should not be replayed
512 * during recovery because its blocks are being freed.
513 */
514 #define XFS_BLF_CANCEL (1<<1)
515
516 /*
517 * This flag indicates that the buffer contains on disk
518 * user or group dquots and may require special recovery handling.
519 */
520 #define XFS_BLF_UDQUOT_BUF (1<<2)
521 #define XFS_BLF_PDQUOT_BUF (1<<3)
522 #define XFS_BLF_GDQUOT_BUF (1<<4)
523
524 /*
525 * This is the structure used to lay out a buf log item in the log. The data
526 * map describes which 128 byte chunks of the buffer have been logged.
527 *
528 * The placement of blf_map_size causes blf_data_map to start at an odd
529 * multiple of sizeof(unsigned int) offset within the struct. Because the data
530 * bitmap size will always be an even number, the end of the data_map (and
531 * therefore the structure) will also be at an odd multiple of sizeof(unsigned
532 * int). Some 64-bit compilers will insert padding at the end of the struct to
533 * ensure 64-bit alignment of blf_blkno, but 32-bit ones will not. Therefore,
534 * XFS_BLF_DATAMAP_SIZE must be an odd number to make the padding explicit and
535 * keep the structure size consistent between 32-bit and 64-bit platforms.
536 */
537 #define __XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD)
538 #define XFS_BLF_DATAMAP_SIZE (__XFS_BLF_DATAMAP_SIZE + 1)
539
540 struct xfs_buf_log_format {
541 unsigned short blf_type; /* buf log item type indicator */
542 unsigned short blf_size; /* size of this item */
543 unsigned short blf_flags; /* misc state */
544 unsigned short blf_len; /* number of blocks in this buf */
545 int64_t blf_blkno; /* starting blkno of this buf */
546 unsigned int blf_map_size; /* used size of data bitmap in words */
547 unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */
548 };
549
550 /*
551 * All buffers now need to tell recovery where the magic number
552 * is so that it can verify and calculate the CRCs on the buffer correctly
553 * once the changes have been replayed into the buffer.
554 *
555 * The type value is held in the upper 5 bits of the blf_flags field, which is
556 * an unsigned 16 bit field. Hence we need to shift it 11 bits up and down.
557 */
558 #define XFS_BLFT_BITS 5
559 #define XFS_BLFT_SHIFT 11
560 #define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT)
561
562 enum xfs_blft {
563 XFS_BLFT_UNKNOWN_BUF = 0,
564 XFS_BLFT_UDQUOT_BUF,
565 XFS_BLFT_PDQUOT_BUF,
566 XFS_BLFT_GDQUOT_BUF,
567 XFS_BLFT_BTREE_BUF,
568 XFS_BLFT_AGF_BUF,
569 XFS_BLFT_AGFL_BUF,
570 XFS_BLFT_AGI_BUF,
571 XFS_BLFT_DINO_BUF,
572 XFS_BLFT_SYMLINK_BUF,
573 XFS_BLFT_DIR_BLOCK_BUF,
574 XFS_BLFT_DIR_DATA_BUF,
575 XFS_BLFT_DIR_FREE_BUF,
576 XFS_BLFT_DIR_LEAF1_BUF,
577 XFS_BLFT_DIR_LEAFN_BUF,
578 XFS_BLFT_DA_NODE_BUF,
579 XFS_BLFT_ATTR_LEAF_BUF,
580 XFS_BLFT_ATTR_RMT_BUF,
581 XFS_BLFT_SB_BUF,
582 XFS_BLFT_RTBITMAP_BUF,
583 XFS_BLFT_RTSUMMARY_BUF,
584 XFS_BLFT_MAX_BUF = (1 << XFS_BLFT_BITS),
585 };
586
587 static inline void
xfs_blft_to_flags(struct xfs_buf_log_format * blf,enum xfs_blft type)588 xfs_blft_to_flags(struct xfs_buf_log_format *blf, enum xfs_blft type)
589 {
590 ASSERT(type > XFS_BLFT_UNKNOWN_BUF && type < XFS_BLFT_MAX_BUF);
591 blf->blf_flags &= ~XFS_BLFT_MASK;
592 blf->blf_flags |= ((type << XFS_BLFT_SHIFT) & XFS_BLFT_MASK);
593 }
594
595 static inline uint16_t
xfs_blft_from_flags(struct xfs_buf_log_format * blf)596 xfs_blft_from_flags(struct xfs_buf_log_format *blf)
597 {
598 return (blf->blf_flags & XFS_BLFT_MASK) >> XFS_BLFT_SHIFT;
599 }
600
601 /*
602 * EFI/EFD log format definitions
603 */
604 struct xfs_extent {
605 xfs_fsblock_t ext_start;
606 xfs_extlen_t ext_len;
607 };
608
609 /*
610 * Since the structures in struct xfs_extent add up to 96 bytes, it has
611 * different alignments on i386 vs all other architectures, because i386
612 * does not pad structures to their natural alignment.
613 *
614 * Provide the different variants for use by a conversion routine.
615 */
616 struct xfs_extent_32 {
617 uint64_t ext_start;
618 uint32_t ext_len;
619 } __attribute__((packed));
620
621 struct xfs_extent_64 {
622 uint64_t ext_start;
623 uint32_t ext_len;
624 uint32_t ext_pad;
625 };
626
627 /*
628 * This is the structure used to lay out an efi log item in the
629 * log. The efi_extents field is a variable size array whose
630 * size is given by efi_nextents.
631 */
632 struct xfs_efi_log_format {
633 uint16_t efi_type; /* efi log item type */
634 uint16_t efi_size; /* size of this item */
635 uint32_t efi_nextents; /* # extents to free */
636 uint64_t efi_id; /* efi identifier */
637 struct xfs_extent efi_extents[]; /* array of extents to free */
638 };
639
640 static inline size_t
xfs_efi_log_format_sizeof(unsigned int nr)641 xfs_efi_log_format_sizeof(
642 unsigned int nr)
643 {
644 return sizeof(struct xfs_efi_log_format) +
645 nr * sizeof(struct xfs_extent);
646 }
647
648 struct xfs_efi_log_format_32 {
649 uint16_t efi_type; /* efi log item type */
650 uint16_t efi_size; /* size of this item */
651 uint32_t efi_nextents; /* # extents to free */
652 uint64_t efi_id; /* efi identifier */
653 struct xfs_extent_32 efi_extents[]; /* array of extents to free */
654 } __attribute__((packed));
655
656 static inline size_t
xfs_efi_log_format32_sizeof(unsigned int nr)657 xfs_efi_log_format32_sizeof(
658 unsigned int nr)
659 {
660 return sizeof(struct xfs_efi_log_format_32) +
661 nr * sizeof(struct xfs_extent_32);
662 }
663
664 struct xfs_efi_log_format_64 {
665 uint16_t efi_type; /* efi log item type */
666 uint16_t efi_size; /* size of this item */
667 uint32_t efi_nextents; /* # extents to free */
668 uint64_t efi_id; /* efi identifier */
669 struct xfs_extent_64 efi_extents[]; /* array of extents to free */
670 };
671
672 static inline size_t
xfs_efi_log_format64_sizeof(unsigned int nr)673 xfs_efi_log_format64_sizeof(
674 unsigned int nr)
675 {
676 return sizeof(struct xfs_efi_log_format_64) +
677 nr * sizeof(struct xfs_extent_64);
678 }
679
680 /*
681 * This is the structure used to lay out an efd log item in the
682 * log. The efd_extents array is a variable size array whose
683 * size is given by efd_nextents;
684 */
685 struct xfs_efd_log_format {
686 uint16_t efd_type; /* efd log item type */
687 uint16_t efd_size; /* size of this item */
688 uint32_t efd_nextents; /* # of extents freed */
689 uint64_t efd_efi_id; /* id of corresponding efi */
690 struct xfs_extent efd_extents[]; /* array of extents freed */
691 };
692
693 static inline size_t
xfs_efd_log_format_sizeof(unsigned int nr)694 xfs_efd_log_format_sizeof(
695 unsigned int nr)
696 {
697 return sizeof(struct xfs_efd_log_format) +
698 nr * sizeof(struct xfs_extent);
699 }
700
701 struct xfs_efd_log_format_32 {
702 uint16_t efd_type; /* efd log item type */
703 uint16_t efd_size; /* size of this item */
704 uint32_t efd_nextents; /* # of extents freed */
705 uint64_t efd_efi_id; /* id of corresponding efi */
706 struct xfs_extent_32 efd_extents[]; /* array of extents freed */
707 } __attribute__((packed));
708
709 static inline size_t
xfs_efd_log_format32_sizeof(unsigned int nr)710 xfs_efd_log_format32_sizeof(
711 unsigned int nr)
712 {
713 return sizeof(struct xfs_efd_log_format_32) +
714 nr * sizeof(struct xfs_extent_32);
715 }
716
717 struct xfs_efd_log_format_64 {
718 uint16_t efd_type; /* efd log item type */
719 uint16_t efd_size; /* size of this item */
720 uint32_t efd_nextents; /* # of extents freed */
721 uint64_t efd_efi_id; /* id of corresponding efi */
722 struct xfs_extent_64 efd_extents[]; /* array of extents freed */
723 };
724
725 static inline size_t
xfs_efd_log_format64_sizeof(unsigned int nr)726 xfs_efd_log_format64_sizeof(
727 unsigned int nr)
728 {
729 return sizeof(struct xfs_efd_log_format_64) +
730 nr * sizeof(struct xfs_extent_64);
731 }
732
733 /*
734 * RUI/RUD (reverse mapping) log format definitions
735 */
736 struct xfs_map_extent {
737 uint64_t me_owner;
738 uint64_t me_startblock;
739 uint64_t me_startoff;
740 uint32_t me_len;
741 uint32_t me_flags;
742 };
743
744 /* rmap me_flags: upper bits are flags, lower byte is type code */
745 #define XFS_RMAP_EXTENT_MAP 1
746 #define XFS_RMAP_EXTENT_MAP_SHARED 2
747 #define XFS_RMAP_EXTENT_UNMAP 3
748 #define XFS_RMAP_EXTENT_UNMAP_SHARED 4
749 #define XFS_RMAP_EXTENT_CONVERT 5
750 #define XFS_RMAP_EXTENT_CONVERT_SHARED 6
751 #define XFS_RMAP_EXTENT_ALLOC 7
752 #define XFS_RMAP_EXTENT_FREE 8
753 #define XFS_RMAP_EXTENT_TYPE_MASK 0xFF
754
755 #define XFS_RMAP_EXTENT_ATTR_FORK (1U << 31)
756 #define XFS_RMAP_EXTENT_BMBT_BLOCK (1U << 30)
757 #define XFS_RMAP_EXTENT_UNWRITTEN (1U << 29)
758
759 #define XFS_RMAP_EXTENT_FLAGS (XFS_RMAP_EXTENT_TYPE_MASK | \
760 XFS_RMAP_EXTENT_ATTR_FORK | \
761 XFS_RMAP_EXTENT_BMBT_BLOCK | \
762 XFS_RMAP_EXTENT_UNWRITTEN)
763
764 /*
765 * This is the structure used to lay out an rui log item in the
766 * log. The rui_extents field is a variable size array whose
767 * size is given by rui_nextents.
768 */
769 struct xfs_rui_log_format {
770 uint16_t rui_type; /* rui log item type */
771 uint16_t rui_size; /* size of this item */
772 uint32_t rui_nextents; /* # extents to free */
773 uint64_t rui_id; /* rui identifier */
774 struct xfs_map_extent rui_extents[]; /* array of extents to rmap */
775 };
776
777 static inline size_t
xfs_rui_log_format_sizeof(unsigned int nr)778 xfs_rui_log_format_sizeof(
779 unsigned int nr)
780 {
781 return sizeof(struct xfs_rui_log_format) +
782 nr * sizeof(struct xfs_map_extent);
783 }
784
785 /*
786 * This is the structure used to lay out an rud log item in the
787 * log. The rud_extents array is a variable size array whose
788 * size is given by rud_nextents;
789 */
790 struct xfs_rud_log_format {
791 uint16_t rud_type; /* rud log item type */
792 uint16_t rud_size; /* size of this item */
793 uint32_t __pad;
794 uint64_t rud_rui_id; /* id of corresponding rui */
795 };
796
797 /*
798 * CUI/CUD (refcount update) log format definitions
799 */
800 struct xfs_phys_extent {
801 uint64_t pe_startblock;
802 uint32_t pe_len;
803 uint32_t pe_flags;
804 };
805
806 /* refcount pe_flags: upper bits are flags, lower byte is type code */
807 /* Type codes are taken directly from enum xfs_refcount_intent_type. */
808 #define XFS_REFCOUNT_EXTENT_TYPE_MASK 0xFF
809
810 #define XFS_REFCOUNT_EXTENT_FLAGS (XFS_REFCOUNT_EXTENT_TYPE_MASK)
811
812 /*
813 * This is the structure used to lay out a cui log item in the
814 * log. The cui_extents field is a variable size array whose
815 * size is given by cui_nextents.
816 */
817 struct xfs_cui_log_format {
818 uint16_t cui_type; /* cui log item type */
819 uint16_t cui_size; /* size of this item */
820 uint32_t cui_nextents; /* # extents to free */
821 uint64_t cui_id; /* cui identifier */
822 struct xfs_phys_extent cui_extents[]; /* array of extents */
823 };
824
825 static inline size_t
xfs_cui_log_format_sizeof(unsigned int nr)826 xfs_cui_log_format_sizeof(
827 unsigned int nr)
828 {
829 return sizeof(struct xfs_cui_log_format) +
830 nr * sizeof(struct xfs_phys_extent);
831 }
832
833 /*
834 * This is the structure used to lay out a cud log item in the
835 * log. The cud_extents array is a variable size array whose
836 * size is given by cud_nextents;
837 */
838 struct xfs_cud_log_format {
839 uint16_t cud_type; /* cud log item type */
840 uint16_t cud_size; /* size of this item */
841 uint32_t __pad;
842 uint64_t cud_cui_id; /* id of corresponding cui */
843 };
844
845 /*
846 * BUI/BUD (inode block mapping) log format definitions
847 */
848
849 /* bmbt me_flags: upper bits are flags, lower byte is type code */
850 /* Type codes are taken directly from enum xfs_bmap_intent_type. */
851 #define XFS_BMAP_EXTENT_TYPE_MASK 0xFF
852
853 #define XFS_BMAP_EXTENT_ATTR_FORK (1U << 31)
854 #define XFS_BMAP_EXTENT_UNWRITTEN (1U << 30)
855 #define XFS_BMAP_EXTENT_REALTIME (1U << 29)
856
857 #define XFS_BMAP_EXTENT_FLAGS (XFS_BMAP_EXTENT_TYPE_MASK | \
858 XFS_BMAP_EXTENT_ATTR_FORK | \
859 XFS_BMAP_EXTENT_UNWRITTEN | \
860 XFS_BMAP_EXTENT_REALTIME)
861
862 /*
863 * This is the structure used to lay out an bui log item in the
864 * log. The bui_extents field is a variable size array whose
865 * size is given by bui_nextents.
866 */
867 struct xfs_bui_log_format {
868 uint16_t bui_type; /* bui log item type */
869 uint16_t bui_size; /* size of this item */
870 uint32_t bui_nextents; /* # extents to free */
871 uint64_t bui_id; /* bui identifier */
872 struct xfs_map_extent bui_extents[]; /* array of extents to bmap */
873 };
874
875 static inline size_t
xfs_bui_log_format_sizeof(unsigned int nr)876 xfs_bui_log_format_sizeof(
877 unsigned int nr)
878 {
879 return sizeof(struct xfs_bui_log_format) +
880 nr * sizeof(struct xfs_map_extent);
881 }
882
883 /*
884 * This is the structure used to lay out an bud log item in the
885 * log. The bud_extents array is a variable size array whose
886 * size is given by bud_nextents;
887 */
888 struct xfs_bud_log_format {
889 uint16_t bud_type; /* bud log item type */
890 uint16_t bud_size; /* size of this item */
891 uint32_t __pad;
892 uint64_t bud_bui_id; /* id of corresponding bui */
893 };
894
895 /*
896 * XMI/XMD (file mapping exchange) log format definitions
897 */
898
899 /* This is the structure used to lay out an mapping exchange log item. */
900 struct xfs_xmi_log_format {
901 uint16_t xmi_type; /* xmi log item type */
902 uint16_t xmi_size; /* size of this item */
903 uint32_t __pad; /* must be zero */
904 uint64_t xmi_id; /* xmi identifier */
905
906 uint64_t xmi_inode1; /* inumber of first file */
907 uint64_t xmi_inode2; /* inumber of second file */
908 uint32_t xmi_igen1; /* generation of first file */
909 uint32_t xmi_igen2; /* generation of second file */
910 uint64_t xmi_startoff1; /* block offset into file1 */
911 uint64_t xmi_startoff2; /* block offset into file2 */
912 uint64_t xmi_blockcount; /* number of blocks */
913 uint64_t xmi_flags; /* XFS_EXCHMAPS_* */
914 uint64_t xmi_isize1; /* intended file1 size */
915 uint64_t xmi_isize2; /* intended file2 size */
916 };
917
918 /* Exchange mappings between extended attribute forks instead of data forks. */
919 #define XFS_EXCHMAPS_ATTR_FORK (1ULL << 0)
920
921 /* Set the file sizes when finished. */
922 #define XFS_EXCHMAPS_SET_SIZES (1ULL << 1)
923
924 /*
925 * Exchange the mappings of the two files only if the file allocation units
926 * mapped to file1's range have been written.
927 */
928 #define XFS_EXCHMAPS_INO1_WRITTEN (1ULL << 2)
929
930 /* No longer set, but older intents may carry them; keep them valid. */
931 #define XFS_EXCHMAPS_CLEAR_INO1_REFLINK (1ULL << 3)
932 #define XFS_EXCHMAPS_CLEAR_INO2_REFLINK (1ULL << 4)
933
934 #define XFS_EXCHMAPS_LOGGED_FLAGS (XFS_EXCHMAPS_ATTR_FORK | \
935 XFS_EXCHMAPS_SET_SIZES | \
936 XFS_EXCHMAPS_INO1_WRITTEN | \
937 XFS_EXCHMAPS_CLEAR_INO1_REFLINK | \
938 XFS_EXCHMAPS_CLEAR_INO2_REFLINK)
939
940 /* This is the structure used to lay out an mapping exchange done log item. */
941 struct xfs_xmd_log_format {
942 uint16_t xmd_type; /* xmd log item type */
943 uint16_t xmd_size; /* size of this item */
944 uint32_t __pad;
945 uint64_t xmd_xmi_id; /* id of corresponding xmi */
946 };
947
948 /*
949 * Dquot Log format definitions.
950 *
951 * The first two fields must be the type and size fitting into
952 * 32 bits : log_recovery code assumes that.
953 */
954 struct xfs_dq_logformat {
955 uint16_t qlf_type; /* dquot log item type */
956 uint16_t qlf_size; /* size of this item */
957 xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */
958 int64_t qlf_blkno; /* blkno of dquot buffer */
959 int32_t qlf_len; /* len of dquot buffer */
960 uint32_t qlf_boffset; /* off of dquot in buffer */
961 };
962
963 /*
964 * log format struct for QUOTAOFF records.
965 * The first two fields must be the type and size fitting into
966 * 32 bits : log_recovery code assumes that.
967 * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
968 * to the first and ensures that the first logitem is taken out of the AIL
969 * only when the last one is securely committed.
970 */
971 struct xfs_qoff_logformat {
972 unsigned short qf_type; /* quotaoff log item type */
973 unsigned short qf_size; /* size of this item */
974 unsigned int qf_flags; /* USR and/or GRP */
975 char qf_pad[12]; /* padding for future */
976 };
977
978 /*
979 * Disk quotas status in m_qflags, and also sb_qflags. 16 bits.
980 */
981 #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */
982 #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */
983 #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */
984 #define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */
985 #define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */
986 #define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */
987 #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
988
989 /*
990 * Conversion to and from the combined OQUOTA flag (if necessary)
991 * is done only in xfs_sb_qflags_to_disk() and xfs_sb_qflags_from_disk()
992 */
993 #define XFS_GQUOTA_ENFD 0x0080 /* group quota limits enforced */
994 #define XFS_GQUOTA_CHKD 0x0100 /* quotacheck run on group quotas */
995 #define XFS_PQUOTA_ENFD 0x0200 /* project quota limits enforced */
996 #define XFS_PQUOTA_CHKD 0x0400 /* quotacheck run on project quotas */
997
998 #define XFS_ALL_QUOTA_ACCT \
999 (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
1000 #define XFS_ALL_QUOTA_ENFD \
1001 (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_ENFD)
1002 #define XFS_ALL_QUOTA_CHKD \
1003 (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD)
1004
1005 #define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
1006 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\
1007 XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD|\
1008 XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|\
1009 XFS_PQUOTA_CHKD)
1010
1011 /*
1012 * Inode create log item structure
1013 *
1014 * Log recovery assumes the first two entries are the type and size and they fit
1015 * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so
1016 * decoding can be done correctly.
1017 */
1018 struct xfs_icreate_log {
1019 uint16_t icl_type; /* type of log format structure */
1020 uint16_t icl_size; /* size of log format structure */
1021 __be32 icl_ag; /* ag being allocated in */
1022 __be32 icl_agbno; /* start block of inode range */
1023 __be32 icl_count; /* number of inodes to initialise */
1024 __be32 icl_isize; /* size of inodes */
1025 __be32 icl_length; /* length of extent to initialise */
1026 __be32 icl_gen; /* inode generation number to use */
1027 };
1028
1029 /*
1030 * Flags for deferred attribute operations.
1031 * Upper bits are flags, lower byte is type code
1032 */
1033 #define XFS_ATTRI_OP_FLAGS_SET 1 /* Set the attribute */
1034 #define XFS_ATTRI_OP_FLAGS_REMOVE 2 /* Remove the attribute */
1035 #define XFS_ATTRI_OP_FLAGS_REPLACE 3 /* Replace the attribute */
1036 #define XFS_ATTRI_OP_FLAGS_PPTR_SET 4 /* Set parent pointer */
1037 #define XFS_ATTRI_OP_FLAGS_PPTR_REMOVE 5 /* Remove parent pointer */
1038 #define XFS_ATTRI_OP_FLAGS_PPTR_REPLACE 6 /* Replace parent pointer */
1039 #define XFS_ATTRI_OP_FLAGS_TYPE_MASK 0xFF /* Flags type mask */
1040
1041 /*
1042 * alfi_attr_filter captures the state of xfs_da_args.attr_filter, so it should
1043 * never have any other bits set.
1044 */
1045 #define XFS_ATTRI_FILTER_MASK (XFS_ATTR_ROOT | \
1046 XFS_ATTR_SECURE | \
1047 XFS_ATTR_PARENT | \
1048 XFS_ATTR_INCOMPLETE)
1049
1050 /*
1051 * This is the structure used to lay out an attr log item in the
1052 * log.
1053 */
1054 struct xfs_attri_log_format {
1055 uint16_t alfi_type; /* attri log item type */
1056 uint16_t alfi_size; /* size of this item */
1057 uint32_t alfi_igen; /* generation of alfi_ino for pptr ops */
1058 uint64_t alfi_id; /* attri identifier */
1059 uint64_t alfi_ino; /* the inode for this attr operation */
1060 uint32_t alfi_op_flags; /* marks the op as a set or remove */
1061 union {
1062 uint32_t alfi_name_len; /* attr name length */
1063 struct {
1064 /*
1065 * For PPTR_REPLACE, these are the lengths of the old
1066 * and new attr names. The new and old values must
1067 * have the same length.
1068 */
1069 uint16_t alfi_old_name_len;
1070 uint16_t alfi_new_name_len;
1071 };
1072 };
1073 uint32_t alfi_value_len; /* attr value length */
1074 uint32_t alfi_attr_filter;/* attr filter flags */
1075 };
1076
1077 struct xfs_attrd_log_format {
1078 uint16_t alfd_type; /* attrd log item type */
1079 uint16_t alfd_size; /* size of this item */
1080 uint32_t __pad; /* pad to 64 bit aligned */
1081 uint64_t alfd_alf_id; /* id of corresponding attri */
1082 };
1083
1084 #endif /* __XFS_LOG_FORMAT_H__ */
1085