diff options
author | Dave Chinner <dchinner@redhat.com> | 2013-08-12 06:49:28 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 17:11:57 -0400 |
commit | 2a3c0acc351baf1e5e584d8d0692f41d5067582c (patch) | |
tree | e1170f7009b10b864fc67984f3ae45280b8aff8c /fs/xfs/xfs_log_format.h | |
parent | 9cd047f3a3c38f5abf998b781296ff0c834e509f (diff) |
xfs: split out on-disk transaction definitions
There's a bunch of definitions in xfs_trans.h that define on-disk
formats - transaction headers that get written into the log, log
item type definitions, etc. Split out everything into a separate
file so that all which remains in xfs_trans.h are kernel only
definitions.
Also, remove the duplicate magic number definitions for
XFS_TRANS_MAGIC...
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.h | 206 |
1 files changed, 206 insertions, 0 deletions
diff --git a/fs/xfs/xfs_log_format.h b/fs/xfs/xfs_log_format.h index 02639c7ea404..faf3f4349a75 100644 --- a/fs/xfs/xfs_log_format.h +++ b/fs/xfs/xfs_log_format.h | |||
@@ -187,6 +187,212 @@ typedef struct xfs_log_iovec { | |||
187 | 187 | ||
188 | 188 | ||
189 | /* | 189 | /* |
190 | * Transaction Header definitions. | ||
191 | * | ||
192 | * This is the structure written in the log at the head of every transaction. It | ||
193 | * identifies the type and id of the transaction, and contains the number of | ||
194 | * items logged by the transaction so we know how many to expect during | ||
195 | * recovery. | ||
196 | * | ||
197 | * Do not change the below structure without redoing the code in | ||
198 | * xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). | ||
199 | */ | ||
200 | typedef struct xfs_trans_header { | ||
201 | uint th_magic; /* magic number */ | ||
202 | uint th_type; /* transaction type */ | ||
203 | __int32_t th_tid; /* transaction id (unused) */ | ||
204 | uint th_num_items; /* num items logged by trans */ | ||
205 | } xfs_trans_header_t; | ||
206 | |||
207 | #define XFS_TRANS_HEADER_MAGIC 0x5452414e /* TRAN */ | ||
208 | |||
209 | /* | ||
210 | * Log item types. | ||
211 | */ | ||
212 | #define XFS_LI_EFI 0x1236 | ||
213 | #define XFS_LI_EFD 0x1237 | ||
214 | #define XFS_LI_IUNLINK 0x1238 | ||
215 | #define XFS_LI_INODE 0x123b /* aligned ino chunks, var-size ibufs */ | ||
216 | #define XFS_LI_BUF 0x123c /* v2 bufs, variable sized inode bufs */ | ||
217 | #define XFS_LI_DQUOT 0x123d | ||
218 | #define XFS_LI_QUOTAOFF 0x123e | ||
219 | #define XFS_LI_ICREATE 0x123f | ||
220 | |||
221 | #define XFS_LI_TYPE_DESC \ | ||
222 | { XFS_LI_EFI, "XFS_LI_EFI" }, \ | ||
223 | { XFS_LI_EFD, "XFS_LI_EFD" }, \ | ||
224 | { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ | ||
225 | { XFS_LI_INODE, "XFS_LI_INODE" }, \ | ||
226 | { XFS_LI_BUF, "XFS_LI_BUF" }, \ | ||
227 | { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ | ||
228 | { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ | ||
229 | { XFS_LI_ICREATE, "XFS_LI_ICREATE" } | ||
230 | |||
231 | /* | ||
232 | * Transaction types. Used to distinguish types of buffers. | ||
233 | */ | ||
234 | #define XFS_TRANS_SETATTR_NOT_SIZE 1 | ||
235 | #define XFS_TRANS_SETATTR_SIZE 2 | ||
236 | #define XFS_TRANS_INACTIVE 3 | ||
237 | #define XFS_TRANS_CREATE 4 | ||
238 | #define XFS_TRANS_CREATE_TRUNC 5 | ||
239 | #define XFS_TRANS_TRUNCATE_FILE 6 | ||
240 | #define XFS_TRANS_REMOVE 7 | ||
241 | #define XFS_TRANS_LINK 8 | ||
242 | #define XFS_TRANS_RENAME 9 | ||
243 | #define XFS_TRANS_MKDIR 10 | ||
244 | #define XFS_TRANS_RMDIR 11 | ||
245 | #define XFS_TRANS_SYMLINK 12 | ||
246 | #define XFS_TRANS_SET_DMATTRS 13 | ||
247 | #define XFS_TRANS_GROWFS 14 | ||
248 | #define XFS_TRANS_STRAT_WRITE 15 | ||
249 | #define XFS_TRANS_DIOSTRAT 16 | ||
250 | /* 17 was XFS_TRANS_WRITE_SYNC */ | ||
251 | #define XFS_TRANS_WRITEID 18 | ||
252 | #define XFS_TRANS_ADDAFORK 19 | ||
253 | #define XFS_TRANS_ATTRINVAL 20 | ||
254 | #define XFS_TRANS_ATRUNCATE 21 | ||
255 | #define XFS_TRANS_ATTR_SET 22 | ||
256 | #define XFS_TRANS_ATTR_RM 23 | ||
257 | #define XFS_TRANS_ATTR_FLAG 24 | ||
258 | #define XFS_TRANS_CLEAR_AGI_BUCKET 25 | ||
259 | #define XFS_TRANS_QM_SBCHANGE 26 | ||
260 | /* | ||
261 | * Dummy entries since we use the transaction type to index into the | ||
262 | * trans_type[] in xlog_recover_print_trans_head() | ||
263 | */ | ||
264 | #define XFS_TRANS_DUMMY1 27 | ||
265 | #define XFS_TRANS_DUMMY2 28 | ||
266 | #define XFS_TRANS_QM_QUOTAOFF 29 | ||
267 | #define XFS_TRANS_QM_DQALLOC 30 | ||
268 | #define XFS_TRANS_QM_SETQLIM 31 | ||
269 | #define XFS_TRANS_QM_DQCLUSTER 32 | ||
270 | #define XFS_TRANS_QM_QINOCREATE 33 | ||
271 | #define XFS_TRANS_QM_QUOTAOFF_END 34 | ||
272 | #define XFS_TRANS_SB_UNIT 35 | ||
273 | #define XFS_TRANS_FSYNC_TS 36 | ||
274 | #define XFS_TRANS_GROWFSRT_ALLOC 37 | ||
275 | #define XFS_TRANS_GROWFSRT_ZERO 38 | ||
276 | #define XFS_TRANS_GROWFSRT_FREE 39 | ||
277 | #define XFS_TRANS_SWAPEXT 40 | ||
278 | #define XFS_TRANS_SB_COUNT 41 | ||
279 | #define XFS_TRANS_CHECKPOINT 42 | ||
280 | #define XFS_TRANS_ICREATE 43 | ||
281 | #define XFS_TRANS_TYPE_MAX 43 | ||
282 | /* new transaction types need to be reflected in xfs_logprint(8) */ | ||
283 | |||
284 | #define XFS_TRANS_TYPES \ | ||
285 | { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ | ||
286 | { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ | ||
287 | { XFS_TRANS_INACTIVE, "INACTIVE" }, \ | ||
288 | { XFS_TRANS_CREATE, "CREATE" }, \ | ||
289 | { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ | ||
290 | { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ | ||
291 | { XFS_TRANS_REMOVE, "REMOVE" }, \ | ||
292 | { XFS_TRANS_LINK, "LINK" }, \ | ||
293 | { XFS_TRANS_RENAME, "RENAME" }, \ | ||
294 | { XFS_TRANS_MKDIR, "MKDIR" }, \ | ||
295 | { XFS_TRANS_RMDIR, "RMDIR" }, \ | ||
296 | { XFS_TRANS_SYMLINK, "SYMLINK" }, \ | ||
297 | { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ | ||
298 | { XFS_TRANS_GROWFS, "GROWFS" }, \ | ||
299 | { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ | ||
300 | { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ | ||
301 | { XFS_TRANS_WRITEID, "WRITEID" }, \ | ||
302 | { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ | ||
303 | { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ | ||
304 | { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ | ||
305 | { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ | ||
306 | { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ | ||
307 | { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ | ||
308 | { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ | ||
309 | { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ | ||
310 | { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ | ||
311 | { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ | ||
312 | { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ | ||
313 | { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ | ||
314 | { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ | ||
315 | { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ | ||
316 | { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ | ||
317 | { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ | ||
318 | { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ | ||
319 | { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ | ||
320 | { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ | ||
321 | { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ | ||
322 | { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ | ||
323 | { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ | ||
324 | { XFS_TRANS_DUMMY1, "DUMMY1" }, \ | ||
325 | { XFS_TRANS_DUMMY2, "DUMMY2" }, \ | ||
326 | { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } | ||
327 | |||
328 | /* | ||
329 | * This structure is used to track log items associated with | ||
330 | * a transaction. It points to the log item and keeps some | ||
331 | * flags to track the state of the log item. It also tracks | ||
332 | * the amount of space needed to log the item it describes | ||
333 | * once we get to commit processing (see xfs_trans_commit()). | ||
334 | */ | ||
335 | struct xfs_log_item_desc { | ||
336 | struct xfs_log_item *lid_item; | ||
337 | struct list_head lid_trans; | ||
338 | unsigned char lid_flags; | ||
339 | }; | ||
340 | |||
341 | #define XFS_LID_DIRTY 0x1 | ||
342 | |||
343 | /* | ||
344 | * Values for t_flags. | ||
345 | */ | ||
346 | #define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */ | ||
347 | #define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ | ||
348 | #define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ | ||
349 | #define XFS_TRANS_SYNC 0x08 /* make commit synchronous */ | ||
350 | #define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */ | ||
351 | #define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ | ||
352 | #define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer | ||
353 | count in superblock */ | ||
354 | |||
355 | /* | ||
356 | * Values for call flags parameter. | ||
357 | */ | ||
358 | #define XFS_TRANS_RELEASE_LOG_RES 0x4 | ||
359 | #define XFS_TRANS_ABORT 0x8 | ||
360 | |||
361 | /* | ||
362 | * Field values for xfs_trans_mod_sb. | ||
363 | */ | ||
364 | #define XFS_TRANS_SB_ICOUNT 0x00000001 | ||
365 | #define XFS_TRANS_SB_IFREE 0x00000002 | ||
366 | #define XFS_TRANS_SB_FDBLOCKS 0x00000004 | ||
367 | #define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 | ||
368 | #define XFS_TRANS_SB_FREXTENTS 0x00000010 | ||
369 | #define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 | ||
370 | #define XFS_TRANS_SB_DBLOCKS 0x00000040 | ||
371 | #define XFS_TRANS_SB_AGCOUNT 0x00000080 | ||
372 | #define XFS_TRANS_SB_IMAXPCT 0x00000100 | ||
373 | #define XFS_TRANS_SB_REXTSIZE 0x00000200 | ||
374 | #define XFS_TRANS_SB_RBMBLOCKS 0x00000400 | ||
375 | #define XFS_TRANS_SB_RBLOCKS 0x00000800 | ||
376 | #define XFS_TRANS_SB_REXTENTS 0x00001000 | ||
377 | #define XFS_TRANS_SB_REXTSLOG 0x00002000 | ||
378 | |||
379 | /* | ||
380 | * Here we centralize the specification of XFS meta-data buffer | ||
381 | * reference count values. This determine how hard the buffer | ||
382 | * cache tries to hold onto the buffer. | ||
383 | */ | ||
384 | #define XFS_AGF_REF 4 | ||
385 | #define XFS_AGI_REF 4 | ||
386 | #define XFS_AGFL_REF 3 | ||
387 | #define XFS_INO_BTREE_REF 3 | ||
388 | #define XFS_ALLOC_BTREE_REF 2 | ||
389 | #define XFS_BMAP_BTREE_REF 2 | ||
390 | #define XFS_DIR_BTREE_REF 2 | ||
391 | #define XFS_INO_REF 2 | ||
392 | #define XFS_ATTR_BTREE_REF 1 | ||
393 | #define XFS_DQUOT_REF 1 | ||
394 | |||
395 | /* | ||
190 | * Inode Log Item Format definitions. | 396 | * Inode Log Item Format definitions. |
191 | * | 397 | * |
192 | * This is the structure used to lay out an inode log item in the | 398 | * This is the structure used to lay out an inode log item in the |