diff options
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r-- | fs/xfs/xfs_dinode.h | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index 6b5bd1745dbe..f7a0e95d197a 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define __XFS_DINODE_H__ | 19 | #define __XFS_DINODE_H__ |
20 | 20 | ||
21 | #define XFS_DINODE_MAGIC 0x494e /* 'IN' */ | 21 | #define XFS_DINODE_MAGIC 0x494e /* 'IN' */ |
22 | #define XFS_DINODE_GOOD_VERSION(v) (((v) == 1 || (v) == 2)) | 22 | #define XFS_DINODE_GOOD_VERSION(v) ((v) >= 1 && (v) <= 3) |
23 | 23 | ||
24 | typedef struct xfs_timestamp { | 24 | typedef struct xfs_timestamp { |
25 | __be32 t_sec; /* timestamp seconds */ | 25 | __be32 t_sec; /* timestamp seconds */ |
@@ -70,11 +70,36 @@ typedef struct xfs_dinode { | |||
70 | 70 | ||
71 | /* di_next_unlinked is the only non-core field in the old dinode */ | 71 | /* di_next_unlinked is the only non-core field in the old dinode */ |
72 | __be32 di_next_unlinked;/* agi unlinked list ptr */ | 72 | __be32 di_next_unlinked;/* agi unlinked list ptr */ |
73 | } __attribute__((packed)) xfs_dinode_t; | 73 | |
74 | /* start of the extended dinode, writable fields */ | ||
75 | __le32 di_crc; /* CRC of the inode */ | ||
76 | __be64 di_changecount; /* number of attribute changes */ | ||
77 | __be64 di_lsn; /* flush sequence */ | ||
78 | __be64 di_flags2; /* more random flags */ | ||
79 | __u8 di_pad2[16]; /* more padding for future expansion */ | ||
80 | |||
81 | /* fields only written to during inode creation */ | ||
82 | xfs_timestamp_t di_crtime; /* time created */ | ||
83 | __be64 di_ino; /* inode number */ | ||
84 | uuid_t di_uuid; /* UUID of the filesystem */ | ||
85 | |||
86 | /* structure must be padded to 64 bit alignment */ | ||
87 | } xfs_dinode_t; | ||
74 | 88 | ||
75 | #define DI_MAX_FLUSH 0xffff | 89 | #define DI_MAX_FLUSH 0xffff |
76 | 90 | ||
77 | /* | 91 | /* |
92 | * Size of the core inode on disk. Version 1 and 2 inodes have | ||
93 | * the same size, but version 3 has grown a few additional fields. | ||
94 | */ | ||
95 | static inline uint xfs_dinode_size(int version) | ||
96 | { | ||
97 | if (version == 3) | ||
98 | return sizeof(struct xfs_dinode); | ||
99 | return offsetof(struct xfs_dinode, di_crc); | ||
100 | } | ||
101 | |||
102 | /* | ||
78 | * The 32 bit link count in the inode theoretically maxes out at UINT_MAX. | 103 | * The 32 bit link count in the inode theoretically maxes out at UINT_MAX. |
79 | * Since the pathconf interface is signed, we use 2^31 - 1 instead. | 104 | * Since the pathconf interface is signed, we use 2^31 - 1 instead. |
80 | * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX. | 105 | * The old inode format had a 16 bit link count, so its maximum is USHRT_MAX. |
@@ -105,7 +130,7 @@ typedef enum xfs_dinode_fmt { | |||
105 | * Inode size for given fs. | 130 | * Inode size for given fs. |
106 | */ | 131 | */ |
107 | #define XFS_LITINO(mp, version) \ | 132 | #define XFS_LITINO(mp, version) \ |
108 | ((int)(((mp)->m_sb.sb_inodesize) - sizeof(struct xfs_dinode))) | 133 | ((int)(((mp)->m_sb.sb_inodesize) - xfs_dinode_size(version))) |
109 | 134 | ||
110 | #define XFS_BROOT_SIZE_ADJ(ip) \ | 135 | #define XFS_BROOT_SIZE_ADJ(ip) \ |
111 | (XFS_BMBT_BLOCK_LEN((ip)->i_mount) - sizeof(xfs_bmdr_block_t)) | 136 | (XFS_BMBT_BLOCK_LEN((ip)->i_mount) - sizeof(xfs_bmdr_block_t)) |
@@ -133,7 +158,7 @@ typedef enum xfs_dinode_fmt { | |||
133 | * Return pointers to the data or attribute forks. | 158 | * Return pointers to the data or attribute forks. |
134 | */ | 159 | */ |
135 | #define XFS_DFORK_DPTR(dip) \ | 160 | #define XFS_DFORK_DPTR(dip) \ |
136 | ((char *)(dip) + sizeof(struct xfs_dinode)) | 161 | ((char *)dip + xfs_dinode_size(dip->di_version)) |
137 | #define XFS_DFORK_APTR(dip) \ | 162 | #define XFS_DFORK_APTR(dip) \ |
138 | (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip)) | 163 | (XFS_DFORK_DPTR(dip) + XFS_DFORK_BOFF(dip)) |
139 | #define XFS_DFORK_PTR(dip,w) \ | 164 | #define XFS_DFORK_PTR(dip,w) \ |