| .. | .. |
|---|
| 368 | 368 | * directly mirrors the xfs_dinode structure as it must contain all the same |
|---|
| 369 | 369 | * information. |
|---|
| 370 | 370 | */ |
|---|
| 371 | | -typedef struct xfs_ictimestamp { |
|---|
| 371 | +typedef uint64_t xfs_ictimestamp_t; |
|---|
| 372 | + |
|---|
| 373 | +/* Legacy timestamp encoding format. */ |
|---|
| 374 | +struct xfs_legacy_ictimestamp { |
|---|
| 372 | 375 | int32_t t_sec; /* timestamp seconds */ |
|---|
| 373 | 376 | int32_t t_nsec; /* timestamp nanoseconds */ |
|---|
| 374 | | -} xfs_ictimestamp_t; |
|---|
| 377 | +}; |
|---|
| 375 | 378 | |
|---|
| 376 | 379 | /* |
|---|
| 377 | 380 | * Define the format of the inode core that is logged. This structure must be |
|---|
| .. | .. |
|---|
| 411 | 414 | /* start of the extended dinode, writable fields */ |
|---|
| 412 | 415 | uint32_t di_crc; /* CRC of the inode */ |
|---|
| 413 | 416 | uint64_t di_changecount; /* number of attribute changes */ |
|---|
| 414 | | - xfs_lsn_t di_lsn; /* flush sequence */ |
|---|
| 417 | + |
|---|
| 418 | + /* |
|---|
| 419 | + * The LSN we write to this field during formatting is not a reflection |
|---|
| 420 | + * of the current on-disk LSN. It should never be used for recovery |
|---|
| 421 | + * sequencing, nor should it be recovered into the on-disk inode at all. |
|---|
| 422 | + * See xlog_recover_inode_commit_pass2() and xfs_log_dinode_to_disk() |
|---|
| 423 | + * for details. |
|---|
| 424 | + */ |
|---|
| 425 | + xfs_lsn_t di_lsn; |
|---|
| 426 | + |
|---|
| 415 | 427 | uint64_t di_flags2; /* more random flags */ |
|---|
| 416 | 428 | uint32_t di_cowextsize; /* basic cow extent size for file */ |
|---|
| 417 | 429 | uint8_t di_pad2[12]; /* more padding for future expansion */ |
|---|
| .. | .. |
|---|
| 424 | 436 | /* structure must be padded to 64 bit alignment */ |
|---|
| 425 | 437 | }; |
|---|
| 426 | 438 | |
|---|
| 427 | | -static inline uint xfs_log_dinode_size(int version) |
|---|
| 428 | | -{ |
|---|
| 429 | | - if (version == 3) |
|---|
| 430 | | - return sizeof(struct xfs_log_dinode); |
|---|
| 431 | | - return offsetof(struct xfs_log_dinode, di_next_unlinked); |
|---|
| 432 | | -} |
|---|
| 439 | +#define xfs_log_dinode_size(mp) \ |
|---|
| 440 | + (xfs_sb_version_has_v3inode(&(mp)->m_sb) ? \ |
|---|
| 441 | + sizeof(struct xfs_log_dinode) : \ |
|---|
| 442 | + offsetof(struct xfs_log_dinode, di_next_unlinked)) |
|---|
| 433 | 443 | |
|---|
| 434 | 444 | /* |
|---|
| 435 | | - * Buffer Log Format defintions |
|---|
| 445 | + * Buffer Log Format definitions |
|---|
| 436 | 446 | * |
|---|
| 437 | | - * These are the physical dirty bitmap defintions for the log format structure. |
|---|
| 447 | + * These are the physical dirty bitmap definitions for the log format structure. |
|---|
| 438 | 448 | */ |
|---|
| 439 | 449 | #define XFS_BLF_CHUNK 128 |
|---|
| 440 | 450 | #define XFS_BLF_SHIFT 7 |
|---|
| .. | .. |
|---|
| 462 | 472 | #define XFS_BLF_GDQUOT_BUF (1<<4) |
|---|
| 463 | 473 | |
|---|
| 464 | 474 | /* |
|---|
| 465 | | - * This is the structure used to lay out a buf log item in the |
|---|
| 466 | | - * log. The data map describes which 128 byte chunks of the buffer |
|---|
| 467 | | - * have been logged. |
|---|
| 475 | + * This is the structure used to lay out a buf log item in the log. The data |
|---|
| 476 | + * map describes which 128 byte chunks of the buffer have been logged. |
|---|
| 477 | + * |
|---|
| 478 | + * The placement of blf_map_size causes blf_data_map to start at an odd |
|---|
| 479 | + * multiple of sizeof(unsigned int) offset within the struct. Because the data |
|---|
| 480 | + * bitmap size will always be an even number, the end of the data_map (and |
|---|
| 481 | + * therefore the structure) will also be at an odd multiple of sizeof(unsigned |
|---|
| 482 | + * int). Some 64-bit compilers will insert padding at the end of the struct to |
|---|
| 483 | + * ensure 64-bit alignment of blf_blkno, but 32-bit ones will not. Therefore, |
|---|
| 484 | + * XFS_BLF_DATAMAP_SIZE must be an odd number to make the padding explicit and |
|---|
| 485 | + * keep the structure size consistent between 32-bit and 64-bit platforms. |
|---|
| 468 | 486 | */ |
|---|
| 469 | | -#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) |
|---|
| 487 | +#define __XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) |
|---|
| 488 | +#define XFS_BLF_DATAMAP_SIZE (__XFS_BLF_DATAMAP_SIZE + 1) |
|---|
| 470 | 489 | |
|---|
| 471 | 490 | typedef struct xfs_buf_log_format { |
|---|
| 472 | 491 | unsigned short blf_type; /* buf log item type indicator */ |
|---|