Commit | Line | Data |
---|---|---|
fc06c6d0 DC |
1 | /* |
2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. | |
3 | * All Rights Reserved. | |
4 | * | |
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. | |
8 | * | |
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. | |
13 | * | |
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 | |
17 | */ | |
18 | #ifndef __XFS_LOG_FORMAT_H__ | |
19 | #define __XFS_LOG_FORMAT_H__ | |
20 | ||
e773fc93 | 21 | struct xfs_mount; |
5a96a945 | 22 | struct xfs_trans_res; |
e773fc93 | 23 | |
69432832 DC |
24 | /* |
25 | * On-disk Log Format definitions. | |
26 | * | |
27 | * This file contains all the on-disk format definitions used within the log. It | |
28 | * includes the physical log structure itself, as well as all the log item | |
29 | * format structures that are written into the log and intepreted by log | |
30 | * recovery. We start with the physical log format definitions, and then work | |
31 | * through all the log items definitions and everything they encode into the | |
32 | * log. | |
33 | */ | |
fc06c6d0 DC |
34 | typedef __uint32_t xlog_tid_t; |
35 | ||
36 | #define XLOG_MIN_ICLOGS 2 | |
37 | #define XLOG_MAX_ICLOGS 8 | |
38 | #define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe /* Invalid cycle number */ | |
39 | #define XLOG_VERSION_1 1 | |
40 | #define XLOG_VERSION_2 2 /* Large IClogs, Log sunit */ | |
41 | #define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2) | |
42 | #define XLOG_MIN_RECORD_BSIZE (16*1024) /* eventually 32k */ | |
43 | #define XLOG_BIG_RECORD_BSIZE (32*1024) /* 32k buffers */ | |
44 | #define XLOG_MAX_RECORD_BSIZE (256*1024) | |
45 | #define XLOG_HEADER_CYCLE_SIZE (32*1024) /* cycle data in header */ | |
46 | #define XLOG_MIN_RECORD_BSHIFT 14 /* 16384 == 1 << 14 */ | |
47 | #define XLOG_BIG_RECORD_BSHIFT 15 /* 32k == 1 << 15 */ | |
48 | #define XLOG_MAX_RECORD_BSHIFT 18 /* 256k == 1 << 18 */ | |
49 | #define XLOG_BTOLSUNIT(log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \ | |
50 | (log)->l_mp->m_sb.sb_logsunit) | |
51 | #define XLOG_LSUNITTOB(log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit) | |
52 | ||
53 | #define XLOG_HEADER_SIZE 512 | |
54 | ||
5a96a945 JL |
55 | /* Minimum number of transactions that must fit in the log (defined by mkfs) */ |
56 | #define XFS_MIN_LOG_FACTOR 3 | |
57 | ||
fc06c6d0 DC |
58 | #define XLOG_REC_SHIFT(log) \ |
59 | BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ | |
60 | XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) | |
61 | #define XLOG_TOTAL_REC_SHIFT(log) \ | |
62 | BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ | |
63 | XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) | |
64 | ||
65 | /* get lsn fields */ | |
66 | #define CYCLE_LSN(lsn) ((uint)((lsn)>>32)) | |
67 | #define BLOCK_LSN(lsn) ((uint)(lsn)) | |
68 | ||
69 | /* this is used in a spot where we might otherwise double-endian-flip */ | |
70 | #define CYCLE_LSN_DISK(lsn) (((__be32 *)&(lsn))[0]) | |
71 | ||
72 | static inline xfs_lsn_t xlog_assign_lsn(uint cycle, uint block) | |
73 | { | |
74 | return ((xfs_lsn_t)cycle << 32) | block; | |
75 | } | |
76 | ||
77 | static inline uint xlog_get_cycle(char *ptr) | |
78 | { | |
79 | if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM) | |
80 | return be32_to_cpu(*((__be32 *)ptr + 1)); | |
81 | else | |
82 | return be32_to_cpu(*(__be32 *)ptr); | |
83 | } | |
84 | ||
85 | /* Log Clients */ | |
86 | #define XFS_TRANSACTION 0x69 | |
87 | #define XFS_VOLUME 0x2 | |
88 | #define XFS_LOG 0xaa | |
89 | ||
90 | #define XLOG_UNMOUNT_TYPE 0x556e /* Un for Unmount */ | |
91 | ||
92 | /* Region types for iovec's i_type */ | |
93 | #define XLOG_REG_TYPE_BFORMAT 1 | |
94 | #define XLOG_REG_TYPE_BCHUNK 2 | |
95 | #define XLOG_REG_TYPE_EFI_FORMAT 3 | |
96 | #define XLOG_REG_TYPE_EFD_FORMAT 4 | |
97 | #define XLOG_REG_TYPE_IFORMAT 5 | |
98 | #define XLOG_REG_TYPE_ICORE 6 | |
99 | #define XLOG_REG_TYPE_IEXT 7 | |
100 | #define XLOG_REG_TYPE_IBROOT 8 | |
101 | #define XLOG_REG_TYPE_ILOCAL 9 | |
102 | #define XLOG_REG_TYPE_IATTR_EXT 10 | |
103 | #define XLOG_REG_TYPE_IATTR_BROOT 11 | |
104 | #define XLOG_REG_TYPE_IATTR_LOCAL 12 | |
105 | #define XLOG_REG_TYPE_QFORMAT 13 | |
106 | #define XLOG_REG_TYPE_DQUOT 14 | |
107 | #define XLOG_REG_TYPE_QUOTAOFF 15 | |
108 | #define XLOG_REG_TYPE_LRHEADER 16 | |
109 | #define XLOG_REG_TYPE_UNMOUNT 17 | |
110 | #define XLOG_REG_TYPE_COMMIT 18 | |
111 | #define XLOG_REG_TYPE_TRANSHDR 19 | |
112 | #define XLOG_REG_TYPE_ICREATE 20 | |
113 | #define XLOG_REG_TYPE_MAX 20 | |
114 | ||
115 | /* | |
116 | * Flags to log operation header | |
117 | * | |
118 | * The first write of a new transaction will be preceded with a start | |
119 | * record, XLOG_START_TRANS. Once a transaction is committed, a commit | |
120 | * record is written, XLOG_COMMIT_TRANS. If a single region can not fit into | |
121 | * the remainder of the current active in-core log, it is split up into | |
122 | * multiple regions. Each partial region will be marked with a | |
123 | * XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS. | |
124 | * | |
125 | */ | |
126 | #define XLOG_START_TRANS 0x01 /* Start a new transaction */ | |
127 | #define XLOG_COMMIT_TRANS 0x02 /* Commit this transaction */ | |
128 | #define XLOG_CONTINUE_TRANS 0x04 /* Cont this trans into new region */ | |
129 | #define XLOG_WAS_CONT_TRANS 0x08 /* Cont this trans into new region */ | |
130 | #define XLOG_END_TRANS 0x10 /* End a continued transaction */ | |
131 | #define XLOG_UNMOUNT_TRANS 0x20 /* Unmount a filesystem transaction */ | |
132 | ||
133 | ||
134 | typedef struct xlog_op_header { | |
135 | __be32 oh_tid; /* transaction id of operation : 4 b */ | |
136 | __be32 oh_len; /* bytes in data region : 4 b */ | |
137 | __u8 oh_clientid; /* who sent me this : 1 b */ | |
138 | __u8 oh_flags; /* : 1 b */ | |
139 | __u16 oh_res2; /* 32 bit align : 2 b */ | |
140 | } xlog_op_header_t; | |
141 | ||
fc06c6d0 DC |
142 | /* valid values for h_fmt */ |
143 | #define XLOG_FMT_UNKNOWN 0 | |
144 | #define XLOG_FMT_LINUX_LE 1 | |
145 | #define XLOG_FMT_LINUX_BE 2 | |
146 | #define XLOG_FMT_IRIX_BE 3 | |
147 | ||
148 | /* our fmt */ | |
149 | #ifdef XFS_NATIVE_HOST | |
150 | #define XLOG_FMT XLOG_FMT_LINUX_BE | |
151 | #else | |
152 | #define XLOG_FMT XLOG_FMT_LINUX_LE | |
153 | #endif | |
154 | ||
155 | typedef struct xlog_rec_header { | |
156 | __be32 h_magicno; /* log record (LR) identifier : 4 */ | |
157 | __be32 h_cycle; /* write cycle of log : 4 */ | |
158 | __be32 h_version; /* LR version : 4 */ | |
159 | __be32 h_len; /* len in bytes; should be 64-bit aligned: 4 */ | |
160 | __be64 h_lsn; /* lsn of this LR : 8 */ | |
161 | __be64 h_tail_lsn; /* lsn of 1st LR w/ buffers not committed: 8 */ | |
162 | __le32 h_crc; /* crc of log record : 4 */ | |
163 | __be32 h_prev_block; /* block number to previous LR : 4 */ | |
164 | __be32 h_num_logops; /* number of log operations in this LR : 4 */ | |
165 | __be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; | |
166 | /* new fields */ | |
167 | __be32 h_fmt; /* format of log record : 4 */ | |
168 | uuid_t h_fs_uuid; /* uuid of FS : 16 */ | |
169 | __be32 h_size; /* iclog size : 4 */ | |
170 | } xlog_rec_header_t; | |
171 | ||
172 | typedef struct xlog_rec_ext_header { | |
173 | __be32 xh_cycle; /* write cycle of log : 4 */ | |
174 | __be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE / BBSIZE]; /* : 256 */ | |
175 | } xlog_rec_ext_header_t; | |
176 | ||
177 | /* | |
178 | * Quite misnamed, because this union lays out the actual on-disk log buffer. | |
179 | */ | |
180 | typedef union xlog_in_core2 { | |
181 | xlog_rec_header_t hic_header; | |
182 | xlog_rec_ext_header_t hic_xheader; | |
183 | char hic_sector[XLOG_HEADER_SIZE]; | |
184 | } xlog_in_core_2_t; | |
185 | ||
186 | /* not an on-disk structure, but needed by log recovery in userspace */ | |
187 | typedef struct xfs_log_iovec { | |
188 | void *i_addr; /* beginning address of region */ | |
189 | int i_len; /* length in bytes of region */ | |
190 | uint i_type; /* type of region */ | |
191 | } xfs_log_iovec_t; | |
192 | ||
69432832 | 193 | |
2a3c0acc DC |
194 | /* |
195 | * Transaction Header definitions. | |
196 | * | |
197 | * This is the structure written in the log at the head of every transaction. It | |
198 | * identifies the type and id of the transaction, and contains the number of | |
199 | * items logged by the transaction so we know how many to expect during | |
200 | * recovery. | |
201 | * | |
202 | * Do not change the below structure without redoing the code in | |
203 | * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). | |
204 | */ | |
205 | typedef struct xfs_trans_header { | |
206 | uint th_magic; /* magic number */ | |
207 | uint th_type; /* transaction type */ | |
208 | __int32_t th_tid; /* transaction id (unused) */ | |
209 | uint th_num_items; /* num items logged by trans */ | |
210 | } xfs_trans_header_t; | |
211 | ||
212 | #define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */ | |
213 | ||
214 | /* | |
215 | * Log item types. | |
216 | */ | |
217 | #define XFS_LI_EFI 0x1236 | |
218 | #define XFS_LI_EFD 0x1237 | |
219 | #define XFS_LI_IUNLINK 0x1238 | |
220 | #define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */ | |
221 | #define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */ | |
222 | #define XFS_LI_DQUOT 0x123d | |
223 | #define XFS_LI_QUOTAOFF 0x123e | |
224 | #define XFS_LI_ICREATE 0x123f | |
225 | ||
226 | #define XFS_LI_TYPE_DESC \ | |
227 | { XFS_LI_EFI, "XFS_LI_EFI" }, \ | |
228 | { XFS_LI_EFD, "XFS_LI_EFD" }, \ | |
229 | { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ | |
230 | { XFS_LI_INODE, "XFS_LI_INODE" }, \ | |
231 | { XFS_LI_BUF, "XFS_LI_BUF" }, \ | |
232 | { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ | |
233 | { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ | |
234 | { XFS_LI_ICREATE, "XFS_LI_ICREATE" } | |
235 | ||
236 | /* | |
237 | * Transaction types. Used to distinguish types of buffers. | |
238 | */ | |
239 | #define XFS_TRANS_SETATTR_NOT_SIZE 1 | |
240 | #define XFS_TRANS_SETATTR_SIZE 2 | |
241 | #define XFS_TRANS_INACTIVE 3 | |
242 | #define XFS_TRANS_CREATE 4 | |
243 | #define XFS_TRANS_CREATE_TRUNC 5 | |
244 | #define XFS_TRANS_TRUNCATE_FILE 6 | |
245 | #define XFS_TRANS_REMOVE 7 | |
246 | #define XFS_TRANS_LINK 8 | |
247 | #define XFS_TRANS_RENAME 9 | |
248 | #define XFS_TRANS_MKDIR 10 | |
249 | #define XFS_TRANS_RMDIR 11 | |
250 | #define XFS_TRANS_SYMLINK 12 | |
251 | #define XFS_TRANS_SET_DMATTRS 13 | |
252 | #define XFS_TRANS_GROWFS 14 | |
253 | #define XFS_TRANS_STRAT_WRITE 15 | |
254 | #define XFS_TRANS_DIOSTRAT 16 | |
255 | /* 17 was XFS_TRANS_WRITE_SYNC */ | |
256 | #define XFS_TRANS_WRITEID 18 | |
257 | #define XFS_TRANS_ADDAFORK 19 | |
258 | #define XFS_TRANS_ATTRINVAL 20 | |
259 | #define XFS_TRANS_ATRUNCATE 21 | |
260 | #define XFS_TRANS_ATTR_SET 22 | |
261 | #define XFS_TRANS_ATTR_RM 23 | |
262 | #define XFS_TRANS_ATTR_FLAG 24 | |
263 | #define XFS_TRANS_CLEAR_AGI_BUCKET 25 | |
264 | #define XFS_TRANS_QM_SBCHANGE 26 | |
265 | /* | |
266 | * Dummy entries since we use the transaction type to index into the | |
267 | * trans_type[] in xlog_recover_print_trans_head() | |
268 | */ | |
269 | #define XFS_TRANS_DUMMY1 27 | |
270 | #define XFS_TRANS_DUMMY2 28 | |
271 | #define XFS_TRANS_QM_QUOTAOFF 29 | |
272 | #define XFS_TRANS_QM_DQALLOC 30 | |
273 | #define XFS_TRANS_QM_SETQLIM 31 | |
274 | #define XFS_TRANS_QM_DQCLUSTER 32 | |
275 | #define XFS_TRANS_QM_QINOCREATE 33 | |
276 | #define XFS_TRANS_QM_QUOTAOFF_END 34 | |
277 | #define XFS_TRANS_SB_UNIT 35 | |
278 | #define XFS_TRANS_FSYNC_TS 36 | |
279 | #define XFS_TRANS_GROWFSRT_ALLOC 37 | |
280 | #define XFS_TRANS_GROWFSRT_ZERO 38 | |
281 | #define XFS_TRANS_GROWFSRT_FREE 39 | |
282 | #define XFS_TRANS_SWAPEXT 40 | |
283 | #define XFS_TRANS_SB_COUNT 41 | |
284 | #define XFS_TRANS_CHECKPOINT 42 | |
285 | #define XFS_TRANS_ICREATE 43 | |
286 | #define XFS_TRANS_TYPE_MAX 43 | |
287 | /* new transaction types need to be reflected in xfs_logprint(8) */ | |
288 | ||
289 | #define XFS_TRANS_TYPES \ | |
290 | { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ | |
291 | { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ | |
292 | { XFS_TRANS_INACTIVE, "INACTIVE" }, \ | |
293 | { XFS_TRANS_CREATE, "CREATE" }, \ | |
294 | { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ | |
295 | { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ | |
296 | { XFS_TRANS_REMOVE, "REMOVE" }, \ | |
297 | { XFS_TRANS_LINK, "LINK" }, \ | |
298 | { XFS_TRANS_RENAME, "RENAME" }, \ | |
299 | { XFS_TRANS_MKDIR, "MKDIR" }, \ | |
300 | { XFS_TRANS_RMDIR, "RMDIR" }, \ | |
301 | { XFS_TRANS_SYMLINK, "SYMLINK" }, \ | |
302 | { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ | |
303 | { XFS_TRANS_GROWFS, "GROWFS" }, \ | |
304 | { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ | |
305 | { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ | |
306 | { XFS_TRANS_WRITEID, "WRITEID" }, \ | |
307 | { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ | |
308 | { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ | |
309 | { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ | |
310 | { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ | |
311 | { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ | |
312 | { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ | |
313 | { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ | |
314 | { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ | |
315 | { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ | |
316 | { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ | |
317 | { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ | |
318 | { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ | |
319 | { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ | |
320 | { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ | |
321 | { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ | |
322 | { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ | |
323 | { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ | |
324 | { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ | |
325 | { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ | |
326 | { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ | |
327 | { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ | |
328 | { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ | |
329 | { XFS_TRANS_DUMMY1, "DUMMY1" }, \ | |
330 | { XFS_TRANS_DUMMY2, "DUMMY2" }, \ | |
331 | { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } | |
332 | ||
333 | /* | |
334 | * This structure is used to track log items associated with | |
335 | * a transaction. It points to the log item and keeps some | |
336 | * flags to track the state of the log item. It also tracks | |
337 | * the amount of space needed to log the item it describes | |
338 | * once we get to commit processing (see xfs_trans_commit()). | |
339 | */ | |
340 | struct xfs_log_item_desc { | |
341 | struct xfs_log_item *lid_item; | |
342 | struct list_head lid_trans; | |
343 | unsigned char lid_flags; | |
344 | }; | |
345 | ||
346 | #define XFS_LID_DIRTY 0x1 | |
347 | ||
348 | /* | |
349 | * Values for t_flags. | |
350 | */ | |
351 | #define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */ | |
352 | #define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ | |
353 | #define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ | |
354 | #define XFS_TRANS_SYNC 0x08 /* make commit synchronous */ | |
355 | #define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */ | |
356 | #define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ | |
357 | #define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer | |
358 | count in superblock */ | |
359 | ||
360 | /* | |
361 | * Values for call flags parameter. | |
362 | */ | |
363 | #define XFS_TRANS_RELEASE_LOG_RES 0x4 | |
364 | #define XFS_TRANS_ABORT 0x8 | |
365 | ||
366 | /* | |
367 | * Field values for xfs_trans_mod_sb. | |
368 | */ | |
369 | #define XFS_TRANS_SB_ICOUNT 0x00000001 | |
370 | #define XFS_TRANS_SB_IFREE 0x00000002 | |
371 | #define XFS_TRANS_SB_FDBLOCKS 0x00000004 | |
372 | #define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 | |
373 | #define XFS_TRANS_SB_FREXTENTS 0x00000010 | |
374 | #define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 | |
375 | #define XFS_TRANS_SB_DBLOCKS 0x00000040 | |
376 | #define XFS_TRANS_SB_AGCOUNT 0x00000080 | |
377 | #define XFS_TRANS_SB_IMAXPCT 0x00000100 | |
378 | #define XFS_TRANS_SB_REXTSIZE 0x00000200 | |
379 | #define XFS_TRANS_SB_RBMBLOCKS 0x00000400 | |
380 | #define XFS_TRANS_SB_RBLOCKS 0x00000800 | |
381 | #define XFS_TRANS_SB_REXTENTS 0x00001000 | |
382 | #define XFS_TRANS_SB_REXTSLOG 0x00002000 | |
383 | ||
384 | /* | |
385 | * Here we centralize the specification of XFS meta-data buffer | |
386 | * reference count values. This determine how hard the buffer | |
387 | * cache tries to hold onto the buffer. | |
388 | */ | |
389 | #define XFS_AGF_REF 4 | |
390 | #define XFS_AGI_REF 4 | |
391 | #define XFS_AGFL_REF 3 | |
392 | #define XFS_INO_BTREE_REF 3 | |
393 | #define XFS_ALLOC_BTREE_REF 2 | |
394 | #define XFS_BMAP_BTREE_REF 2 | |
395 | #define XFS_DIR_BTREE_REF 2 | |
396 | #define XFS_INO_REF 2 | |
397 | #define XFS_ATTR_BTREE_REF 1 | |
398 | #define XFS_DQUOT_REF 1 | |
399 | ||
7bb85ef3 DC |
400 | /* |
401 | * Flags for xfs_trans_ichgtime(). | |
402 | */ | |
403 | #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ | |
404 | #define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ | |
405 | #define XFS_ICHGTIME_CREATE 0x4 /* inode create timestamp */ | |
406 | ||
407 | ||
69432832 DC |
408 | /* |
409 | * Inode Log Item Format definitions. | |
410 | * | |
411 | * This is the structure used to lay out an inode log item in the | |
412 | * log. The size of the inline data/extents/b-tree root to be logged | |
413 | * (if any) is indicated in the ilf_dsize field. Changes to this structure | |
414 | * must be added on to the end. | |
415 | */ | |
416 | typedef struct xfs_inode_log_format { | |
417 | __uint16_t ilf_type; /* inode log item type */ | |
418 | __uint16_t ilf_size; /* size of this item */ | |
419 | __uint32_t ilf_fields; /* flags for fields logged */ | |
420 | __uint16_t ilf_asize; /* size of attr d/ext/root */ | |
421 | __uint16_t ilf_dsize; /* size of data/ext/root */ | |
422 | __uint64_t ilf_ino; /* inode number */ | |
423 | union { | |
424 | __uint32_t ilfu_rdev; /* rdev value for dev inode*/ | |
425 | uuid_t ilfu_uuid; /* mount point value */ | |
426 | } ilf_u; | |
427 | __int64_t ilf_blkno; /* blkno of inode buffer */ | |
428 | __int32_t ilf_len; /* len of inode buffer */ | |
429 | __int32_t ilf_boffset; /* off of inode in buffer */ | |
430 | } xfs_inode_log_format_t; | |
431 | ||
432 | typedef struct xfs_inode_log_format_32 { | |
433 | __uint16_t ilf_type; /* inode log item type */ | |
434 | __uint16_t ilf_size; /* size of this item */ | |
435 | __uint32_t ilf_fields; /* flags for fields logged */ | |
436 | __uint16_t ilf_asize; /* size of attr d/ext/root */ | |
437 | __uint16_t ilf_dsize; /* size of data/ext/root */ | |
438 | __uint64_t ilf_ino; /* inode number */ | |
439 | union { | |
440 | __uint32_t ilfu_rdev; /* rdev value for dev inode*/ | |
441 | uuid_t ilfu_uuid; /* mount point value */ | |
442 | } ilf_u; | |
443 | __int64_t ilf_blkno; /* blkno of inode buffer */ | |
444 | __int32_t ilf_len; /* len of inode buffer */ | |
445 | __int32_t ilf_boffset; /* off of inode in buffer */ | |
446 | } __attribute__((packed)) xfs_inode_log_format_32_t; | |
447 | ||
448 | typedef struct xfs_inode_log_format_64 { | |
449 | __uint16_t ilf_type; /* inode log item type */ | |
450 | __uint16_t ilf_size; /* size of this item */ | |
451 | __uint32_t ilf_fields; /* flags for fields logged */ | |
452 | __uint16_t ilf_asize; /* size of attr d/ext/root */ | |
453 | __uint16_t ilf_dsize; /* size of data/ext/root */ | |
454 | __uint32_t ilf_pad; /* pad for 64 bit boundary */ | |
455 | __uint64_t ilf_ino; /* inode number */ | |
456 | union { | |
457 | __uint32_t ilfu_rdev; /* rdev value for dev inode*/ | |
458 | uuid_t ilfu_uuid; /* mount point value */ | |
459 | } ilf_u; | |
460 | __int64_t ilf_blkno; /* blkno of inode buffer */ | |
461 | __int32_t ilf_len; /* len of inode buffer */ | |
462 | __int32_t ilf_boffset; /* off of inode in buffer */ | |
463 | } xfs_inode_log_format_64_t; | |
464 | ||
465 | /* | |
466 | * Flags for xfs_trans_log_inode flags field. | |
467 | */ | |
468 | #define XFS_ILOG_CORE 0x001 /* log standard inode fields */ | |
469 | #define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */ | |
470 | #define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */ | |
471 | #define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */ | |
472 | #define XFS_ILOG_DEV 0x010 /* log the dev field */ | |
473 | #define XFS_ILOG_UUID 0x020 /* log the uuid field */ | |
474 | #define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */ | |
475 | #define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */ | |
476 | #define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */ | |
21b5c978 | 477 | #define XFS_ILOG_OWNER 0x200 /* change the extent tree owner on replay */ |
69432832 DC |
478 | |
479 | ||
480 | /* | |
481 | * The timestamps are dirty, but not necessarily anything else in the inode | |
482 | * core. Unlike the other fields above this one must never make it to disk | |
483 | * in the ilf_fields of the inode_log_format, but is purely store in-memory in | |
484 | * ili_fields in the inode_log_item. | |
485 | */ | |
486 | #define XFS_ILOG_TIMESTAMP 0x4000 | |
487 | ||
488 | #define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ | |
489 | XFS_ILOG_DBROOT | XFS_ILOG_DEV | \ | |
490 | XFS_ILOG_UUID | XFS_ILOG_ADATA | \ | |
491 | XFS_ILOG_AEXT | XFS_ILOG_ABROOT) | |
492 | ||
493 | #define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ | |
494 | XFS_ILOG_DBROOT) | |
495 | ||
496 | #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ | |
497 | XFS_ILOG_ABROOT) | |
498 | ||
499 | #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ | |
500 | XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \ | |
501 | XFS_ILOG_DEV | XFS_ILOG_UUID | \ | |
502 | XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ | |
503 | XFS_ILOG_ABROOT | XFS_ILOG_TIMESTAMP) | |
504 | ||
505 | static inline int xfs_ilog_fbroot(int w) | |
506 | { | |
507 | return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT); | |
508 | } | |
509 | ||
510 | static inline int xfs_ilog_fext(int w) | |
511 | { | |
512 | return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); | |
513 | } | |
514 | ||
515 | static inline int xfs_ilog_fdata(int w) | |
516 | { | |
517 | return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA); | |
518 | } | |
519 | ||
520 | /* | |
521 | * Incore version of the on-disk inode core structures. We log this directly | |
522 | * into the journal in host CPU format (for better or worse) and as such | |
523 | * directly mirrors the xfs_dinode structure as it must contain all the same | |
524 | * information. | |
525 | */ | |
526 | typedef struct xfs_ictimestamp { | |
527 | __int32_t t_sec; /* timestamp seconds */ | |
528 | __int32_t t_nsec; /* timestamp nanoseconds */ | |
529 | } xfs_ictimestamp_t; | |
530 | ||
531 | /* | |
532 | * NOTE: This structure must be kept identical to struct xfs_dinode | |
533 | * in xfs_dinode.h except for the endianness annotations. | |
534 | */ | |
535 | typedef struct xfs_icdinode { | |
536 | __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ | |
537 | __uint16_t di_mode; /* mode and type of file */ | |
538 | __int8_t di_version; /* inode version */ | |
539 | __int8_t di_format; /* format of di_c data */ | |
540 | __uint16_t di_onlink; /* old number of links to file */ | |
541 | __uint32_t di_uid; /* owner's user id */ | |
542 | __uint32_t di_gid; /* owner's group id */ | |
543 | __uint32_t di_nlink; /* number of links to file */ | |
544 | __uint16_t di_projid_lo; /* lower part of owner's project id */ | |
545 | __uint16_t di_projid_hi; /* higher part of owner's project id */ | |
546 | __uint8_t di_pad[6]; /* unused, zeroed space */ | |
547 | __uint16_t di_flushiter; /* incremented on flush */ | |
548 | xfs_ictimestamp_t di_atime; /* time last accessed */ | |
549 | xfs_ictimestamp_t di_mtime; /* time last modified */ | |
550 | xfs_ictimestamp_t di_ctime; /* time created/inode modified */ | |
551 | xfs_fsize_t di_size; /* number of bytes in file */ | |
552 | xfs_drfsbno_t di_nblocks; /* # of direct & btree blocks used */ | |
553 | xfs_extlen_t di_extsize; /* basic/minimum extent size for file */ | |
554 | xfs_extnum_t di_nextents; /* number of extents in data fork */ | |
555 | xfs_aextnum_t di_anextents; /* number of extents in attribute fork*/ | |
556 | __uint8_t di_forkoff; /* attr fork offs, <<3 for 64b align */ | |
557 | __int8_t di_aformat; /* format of attr fork's data */ | |
558 | __uint32_t di_dmevmask; /* DMIG event mask */ | |
559 | __uint16_t di_dmstate; /* DMIG state info */ | |
560 | __uint16_t di_flags; /* random flags, XFS_DIFLAG_... */ | |
561 | __uint32_t di_gen; /* generation number */ | |
562 | ||
563 | /* di_next_unlinked is the only non-core field in the old dinode */ | |
564 | xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ | |
565 | ||
566 | /* start of the extended dinode, writable fields */ | |
567 | __uint32_t di_crc; /* CRC of the inode */ | |
568 | __uint64_t di_changecount; /* number of attribute changes */ | |
569 | xfs_lsn_t di_lsn; /* flush sequence */ | |
570 | __uint64_t di_flags2; /* more random flags */ | |
571 | __uint8_t di_pad2[16]; /* more padding for future expansion */ | |
572 | ||
573 | /* fields only written to during inode creation */ | |
574 | xfs_ictimestamp_t di_crtime; /* time created */ | |
575 | xfs_ino_t di_ino; /* inode number */ | |
576 | uuid_t di_uuid; /* UUID of the filesystem */ | |
577 | ||
578 | /* structure must be padded to 64 bit alignment */ | |
579 | } xfs_icdinode_t; | |
580 | ||
581 | static inline uint xfs_icdinode_size(int version) | |
582 | { | |
583 | if (version == 3) | |
584 | return sizeof(struct xfs_icdinode); | |
585 | return offsetof(struct xfs_icdinode, di_next_unlinked); | |
586 | } | |
a8da0da2 DC |
587 | |
588 | /* | |
589 | * Buffer Log Format defintions | |
590 | * | |
591 | * These are the physical dirty bitmap defintions for the log format structure. | |
592 | */ | |
593 | #define XFS_BLF_CHUNK 128 | |
594 | #define XFS_BLF_SHIFT 7 | |
595 | #define BIT_TO_WORD_SHIFT 5 | |
596 | #define NBWORD (NBBY * sizeof(unsigned int)) | |
597 | ||
598 | /* | |
599 | * This flag indicates that the buffer contains on disk inodes | |
600 | * and requires special recovery handling. | |
601 | */ | |
602 | #define XFS_BLF_INODE_BUF (1<<0) | |
603 | ||
604 | /* | |
605 | * This flag indicates that the buffer should not be replayed | |
606 | * during recovery because its blocks are being freed. | |
607 | */ | |
608 | #define XFS_BLF_CANCEL (1<<1) | |
609 | ||
610 | /* | |
611 | * This flag indicates that the buffer contains on disk | |
612 | * user or group dquots and may require special recovery handling. | |
613 | */ | |
614 | #define XFS_BLF_UDQUOT_BUF (1<<2) | |
615 | #define XFS_BLF_PDQUOT_BUF (1<<3) | |
616 | #define XFS_BLF_GDQUOT_BUF (1<<4) | |
617 | ||
618 | /* | |
619 | * This is the structure used to lay out a buf log item in the | |
620 | * log. The data map describes which 128 byte chunks of the buffer | |
621 | * have been logged. | |
622 | */ | |
623 | #define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) | |
624 | ||
625 | typedef struct xfs_buf_log_format { | |
626 | unsigned short blf_type; /* buf log item type indicator */ | |
627 | unsigned short blf_size; /* size of this item */ | |
628 | ushort blf_flags; /* misc state */ | |
629 | ushort blf_len; /* number of blocks in this buf */ | |
630 | __int64_t blf_blkno; /* starting blkno of this buf */ | |
631 | unsigned int blf_map_size; /* used size of data bitmap in words */ | |
632 | unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */ | |
633 | } xfs_buf_log_format_t; | |
634 | ||
635 | /* | |
636 | * All buffers now need to tell recovery where the magic number | |
637 | * is so that it can verify and calculate the CRCs on the buffer correctly | |
638 | * once the changes have been replayed into the buffer. | |
639 | * | |
640 | * The type value is held in the upper 5 bits of the blf_flags field, which is | |
641 | * an unsigned 16 bit field. Hence we need to shift it 11 bits up and down. | |
642 | */ | |
643 | #define XFS_BLFT_BITS 5 | |
644 | #define XFS_BLFT_SHIFT 11 | |
645 | #define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT) | |
646 | ||
647 | enum xfs_blft { | |
648 | XFS_BLFT_UNKNOWN_BUF = 0, | |
649 | XFS_BLFT_UDQUOT_BUF, | |
650 | XFS_BLFT_PDQUOT_BUF, | |
651 | XFS_BLFT_GDQUOT_BUF, | |
652 | XFS_BLFT_BTREE_BUF, | |
653 | XFS_BLFT_AGF_BUF, | |
654 | XFS_BLFT_AGFL_BUF, | |
655 | XFS_BLFT_AGI_BUF, | |
656 | XFS_BLFT_DINO_BUF, | |
657 | XFS_BLFT_SYMLINK_BUF, | |
658 | XFS_BLFT_DIR_BLOCK_BUF, | |
659 | XFS_BLFT_DIR_DATA_BUF, | |
660 | XFS_BLFT_DIR_FREE_BUF, | |
661 | XFS_BLFT_DIR_LEAF1_BUF, | |
662 | XFS_BLFT_DIR_LEAFN_BUF, | |
663 | XFS_BLFT_DA_NODE_BUF, | |
664 | XFS_BLFT_ATTR_LEAF_BUF, | |
665 | XFS_BLFT_ATTR_RMT_BUF, | |
666 | XFS_BLFT_SB_BUF, | |
667 | XFS_BLFT_MAX_BUF = (1 << XFS_BLFT_BITS), | |
668 | }; | |
669 | ||
670 | static inline void | |
671 | xfs_blft_to_flags(struct xfs_buf_log_format *blf, enum xfs_blft type) | |
672 | { | |
673 | ASSERT(type > XFS_BLFT_UNKNOWN_BUF && type < XFS_BLFT_MAX_BUF); | |
674 | blf->blf_flags &= ~XFS_BLFT_MASK; | |
675 | blf->blf_flags |= ((type << XFS_BLFT_SHIFT) & XFS_BLFT_MASK); | |
676 | } | |
677 | ||
678 | static inline __uint16_t | |
679 | xfs_blft_from_flags(struct xfs_buf_log_format *blf) | |
680 | { | |
681 | return (blf->blf_flags & XFS_BLFT_MASK) >> XFS_BLFT_SHIFT; | |
682 | } | |
683 | ||
9fbe24d9 DC |
684 | /* |
685 | * EFI/EFD log format definitions | |
686 | */ | |
687 | typedef struct xfs_extent { | |
688 | xfs_dfsbno_t ext_start; | |
689 | xfs_extlen_t ext_len; | |
690 | } xfs_extent_t; | |
691 | ||
692 | /* | |
693 | * Since an xfs_extent_t has types (start:64, len: 32) | |
694 | * there are different alignments on 32 bit and 64 bit kernels. | |
695 | * So we provide the different variants for use by a | |
696 | * conversion routine. | |
697 | */ | |
698 | typedef struct xfs_extent_32 { | |
699 | __uint64_t ext_start; | |
700 | __uint32_t ext_len; | |
701 | } __attribute__((packed)) xfs_extent_32_t; | |
702 | ||
703 | typedef struct xfs_extent_64 { | |
704 | __uint64_t ext_start; | |
705 | __uint32_t ext_len; | |
706 | __uint32_t ext_pad; | |
707 | } xfs_extent_64_t; | |
708 | ||
709 | /* | |
710 | * This is the structure used to lay out an efi log item in the | |
711 | * log. The efi_extents field is a variable size array whose | |
712 | * size is given by efi_nextents. | |
713 | */ | |
714 | typedef struct xfs_efi_log_format { | |
715 | __uint16_t efi_type; /* efi log item type */ | |
716 | __uint16_t efi_size; /* size of this item */ | |
717 | __uint32_t efi_nextents; /* # extents to free */ | |
718 | __uint64_t efi_id; /* efi identifier */ | |
719 | xfs_extent_t efi_extents[1]; /* array of extents to free */ | |
720 | } xfs_efi_log_format_t; | |
721 | ||
722 | typedef struct xfs_efi_log_format_32 { | |
723 | __uint16_t efi_type; /* efi log item type */ | |
724 | __uint16_t efi_size; /* size of this item */ | |
725 | __uint32_t efi_nextents; /* # extents to free */ | |
726 | __uint64_t efi_id; /* efi identifier */ | |
727 | xfs_extent_32_t efi_extents[1]; /* array of extents to free */ | |
728 | } __attribute__((packed)) xfs_efi_log_format_32_t; | |
729 | ||
730 | typedef struct xfs_efi_log_format_64 { | |
731 | __uint16_t efi_type; /* efi log item type */ | |
732 | __uint16_t efi_size; /* size of this item */ | |
733 | __uint32_t efi_nextents; /* # extents to free */ | |
734 | __uint64_t efi_id; /* efi identifier */ | |
735 | xfs_extent_64_t efi_extents[1]; /* array of extents to free */ | |
736 | } xfs_efi_log_format_64_t; | |
737 | ||
738 | /* | |
739 | * This is the structure used to lay out an efd log item in the | |
740 | * log. The efd_extents array is a variable size array whose | |
741 | * size is given by efd_nextents; | |
742 | */ | |
743 | typedef struct xfs_efd_log_format { | |
744 | __uint16_t efd_type; /* efd log item type */ | |
745 | __uint16_t efd_size; /* size of this item */ | |
746 | __uint32_t efd_nextents; /* # of extents freed */ | |
747 | __uint64_t efd_efi_id; /* id of corresponding efi */ | |
748 | xfs_extent_t efd_extents[1]; /* array of extents freed */ | |
749 | } xfs_efd_log_format_t; | |
750 | ||
751 | typedef struct xfs_efd_log_format_32 { | |
752 | __uint16_t efd_type; /* efd log item type */ | |
753 | __uint16_t efd_size; /* size of this item */ | |
754 | __uint32_t efd_nextents; /* # of extents freed */ | |
755 | __uint64_t efd_efi_id; /* id of corresponding efi */ | |
756 | xfs_extent_32_t efd_extents[1]; /* array of extents freed */ | |
757 | } __attribute__((packed)) xfs_efd_log_format_32_t; | |
758 | ||
759 | typedef struct xfs_efd_log_format_64 { | |
760 | __uint16_t efd_type; /* efd log item type */ | |
761 | __uint16_t efd_size; /* size of this item */ | |
762 | __uint32_t efd_nextents; /* # of extents freed */ | |
763 | __uint64_t efd_efi_id; /* id of corresponding efi */ | |
764 | xfs_extent_64_t efd_extents[1]; /* array of extents freed */ | |
765 | } xfs_efd_log_format_64_t; | |
766 | ||
6ca1c906 DC |
767 | /* |
768 | * Dquot Log format definitions. | |
769 | * | |
770 | * The first two fields must be the type and size fitting into | |
771 | * 32 bits : log_recovery code assumes that. | |
772 | */ | |
773 | typedef struct xfs_dq_logformat { | |
774 | __uint16_t qlf_type; /* dquot log item type */ | |
775 | __uint16_t qlf_size; /* size of this item */ | |
776 | xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */ | |
777 | __int64_t qlf_blkno; /* blkno of dquot buffer */ | |
778 | __int32_t qlf_len; /* len of dquot buffer */ | |
779 | __uint32_t qlf_boffset; /* off of dquot in buffer */ | |
780 | } xfs_dq_logformat_t; | |
781 | ||
782 | /* | |
783 | * log format struct for QUOTAOFF records. | |
784 | * The first two fields must be the type and size fitting into | |
785 | * 32 bits : log_recovery code assumes that. | |
786 | * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer | |
787 | * to the first and ensures that the first logitem is taken out of the AIL | |
788 | * only when the last one is securely committed. | |
789 | */ | |
790 | typedef struct xfs_qoff_logformat { | |
791 | unsigned short qf_type; /* quotaoff log item type */ | |
792 | unsigned short qf_size; /* size of this item */ | |
793 | unsigned int qf_flags; /* USR and/or GRP */ | |
794 | char qf_pad[12]; /* padding for future */ | |
795 | } xfs_qoff_logformat_t; | |
796 | ||
797 | ||
798 | /* | |
799 | * Disk quotas status in m_qflags, and also sb_qflags. 16 bits. | |
800 | */ | |
801 | #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ | |
802 | #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ | |
803 | #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ | |
804 | #define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */ | |
805 | #define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */ | |
806 | #define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */ | |
807 | #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ | |
808 | ||
809 | /* | |
810 | * Conversion to and from the combined OQUOTA flag (if necessary) | |
811 | * is done only in xfs_sb_qflags_to_disk() and xfs_sb_qflags_from_disk() | |
812 | */ | |
813 | #define XFS_GQUOTA_ENFD 0x0080 /* group quota limits enforced */ | |
814 | #define XFS_GQUOTA_CHKD 0x0100 /* quotacheck run on group quotas */ | |
815 | #define XFS_PQUOTA_ENFD 0x0200 /* project quota limits enforced */ | |
816 | #define XFS_PQUOTA_CHKD 0x0400 /* quotacheck run on project quotas */ | |
817 | ||
818 | #define XFS_ALL_QUOTA_ACCT \ | |
819 | (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) | |
820 | #define XFS_ALL_QUOTA_ENFD \ | |
821 | (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_ENFD) | |
822 | #define XFS_ALL_QUOTA_CHKD \ | |
823 | (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD) | |
824 | ||
1d03c6fa DC |
825 | #define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ |
826 | XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ | |
827 | XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD|\ | |
828 | XFS_PQUOTA_ACCT|XFS_PQUOTA_ENFD|\ | |
829 | XFS_PQUOTA_CHKD) | |
830 | ||
9cd047f3 DC |
831 | /* |
832 | * Inode create log item structure | |
833 | * | |
834 | * Log recovery assumes the first two entries are the type and size and they fit | |
835 | * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so | |
836 | * decoding can be done correctly. | |
837 | */ | |
838 | struct xfs_icreate_log { | |
839 | __uint16_t icl_type; /* type of log format structure */ | |
840 | __uint16_t icl_size; /* size of log format structure */ | |
841 | __be32 icl_ag; /* ag being allocated in */ | |
842 | __be32 icl_agbno; /* start block of inode range */ | |
843 | __be32 icl_count; /* number of inodes to initialise */ | |
844 | __be32 icl_isize; /* size of inodes */ | |
845 | __be32 icl_length; /* length of extent to initialise */ | |
846 | __be32 icl_gen; /* inode generation number to use */ | |
847 | }; | |
848 | ||
e773fc93 | 849 | int xfs_log_calc_unit_res(struct xfs_mount *mp, int unit_bytes); |
5a96a945 JL |
850 | int xfs_log_calc_minimum_size(struct xfs_mount *); |
851 | ||
e773fc93 | 852 | |
fc06c6d0 | 853 | #endif /* __XFS_LOG_FORMAT_H__ */ |