diff options
Diffstat (limited to 'fs/xfs/xfs_dinode.h')
-rw-r--r-- | fs/xfs/xfs_dinode.h | 76 |
1 files changed, 21 insertions, 55 deletions
diff --git a/fs/xfs/xfs_dinode.h b/fs/xfs/xfs_dinode.h index 85030cbcdd87..c9065eaf2a4d 100644 --- a/fs/xfs/xfs_dinode.h +++ b/fs/xfs/xfs_dinode.h | |||
@@ -171,69 +171,35 @@ typedef enum xfs_dinode_fmt | |||
171 | /* | 171 | /* |
172 | * Inode data & attribute fork sizes, per inode. | 172 | * Inode data & attribute fork sizes, per inode. |
173 | */ | 173 | */ |
174 | #define XFS_CFORK_Q(dcp) ((dcp)->di_forkoff != 0) | 174 | #define XFS_DFORK_Q(dip) ((dip)->di_core.di_forkoff != 0) |
175 | #define XFS_CFORK_Q_DISK(dcp) ((dcp)->di_forkoff != 0) | 175 | #define XFS_DFORK_BOFF(dip) ((int)((dip)->di_core.di_forkoff << 3)) |
176 | |||
177 | #define XFS_CFORK_BOFF(dcp) ((int)((dcp)->di_forkoff << 3)) | ||
178 | #define XFS_CFORK_BOFF_DISK(dcp) ((int)((dcp)->di_forkoff << 3)) | ||
179 | |||
180 | #define XFS_CFORK_DSIZE_DISK(dcp,mp) \ | ||
181 | (XFS_CFORK_Q_DISK(dcp) ? XFS_CFORK_BOFF_DISK(dcp) : XFS_LITINO(mp)) | ||
182 | #define XFS_CFORK_DSIZE(dcp,mp) \ | ||
183 | (XFS_CFORK_Q(dcp) ? XFS_CFORK_BOFF(dcp) : XFS_LITINO(mp)) | ||
184 | |||
185 | #define XFS_CFORK_ASIZE_DISK(dcp,mp) \ | ||
186 | (XFS_CFORK_Q_DISK(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF_DISK(dcp) : 0) | ||
187 | #define XFS_CFORK_ASIZE(dcp,mp) \ | ||
188 | (XFS_CFORK_Q(dcp) ? XFS_LITINO(mp) - XFS_CFORK_BOFF(dcp) : 0) | ||
189 | |||
190 | #define XFS_CFORK_SIZE_DISK(dcp,mp,w) \ | ||
191 | ((w) == XFS_DATA_FORK ? \ | ||
192 | XFS_CFORK_DSIZE_DISK(dcp, mp) : \ | ||
193 | XFS_CFORK_ASIZE_DISK(dcp, mp)) | ||
194 | #define XFS_CFORK_SIZE(dcp,mp,w) \ | ||
195 | ((w) == XFS_DATA_FORK ? \ | ||
196 | XFS_CFORK_DSIZE(dcp, mp) : XFS_CFORK_ASIZE(dcp, mp)) | ||
197 | 176 | ||
198 | #define XFS_DFORK_DSIZE(dip,mp) \ | 177 | #define XFS_DFORK_DSIZE(dip,mp) \ |
199 | XFS_CFORK_DSIZE_DISK(&(dip)->di_core, mp) | 178 | (XFS_DFORK_Q(dip) ? \ |
200 | #define XFS_DFORK_DSIZE_HOST(dip,mp) \ | 179 | XFS_DFORK_BOFF(dip) : \ |
201 | XFS_CFORK_DSIZE(&(dip)->di_core, mp) | 180 | XFS_LITINO(mp)) |
202 | #define XFS_DFORK_ASIZE(dip,mp) \ | 181 | #define XFS_DFORK_ASIZE(dip,mp) \ |
203 | XFS_CFORK_ASIZE_DISK(&(dip)->di_core, mp) | 182 | (XFS_DFORK_Q(dip) ? \ |
204 | #define XFS_DFORK_ASIZE_HOST(dip,mp) \ | 183 | XFS_LITINO(mp) - XFS_DFORK_BOFF(dip) : \ |
205 | XFS_CFORK_ASIZE(&(dip)->di_core, mp) | 184 | 0) |
206 | #define XFS_DFORK_SIZE(dip,mp,w) \ | 185 | #define XFS_DFORK_SIZE(dip,mp,w) \ |
207 | XFS_CFORK_SIZE_DISK(&(dip)->di_core, mp, w) | 186 | ((w) == XFS_DATA_FORK ? \ |
208 | #define XFS_DFORK_SIZE_HOST(dip,mp,w) \ | 187 | XFS_DFORK_DSIZE(dip, mp) : \ |
209 | XFS_CFORK_SIZE(&(dip)->di_core, mp, w) | 188 | XFS_DFORK_ASIZE(dip, mp)) |
210 | 189 | ||
211 | #define XFS_DFORK_Q(dip) XFS_CFORK_Q_DISK(&(dip)->di_core) | 190 | #define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) |
212 | #define XFS_DFORK_BOFF(dip) XFS_CFORK_BOFF_DISK(&(dip)->di_core) | 191 | #define XFS_DFORK_APTR(dip) \ |
213 | #define XFS_DFORK_DPTR(dip) ((dip)->di_u.di_c) | ||
214 | #define XFS_DFORK_APTR(dip) \ | ||
215 | ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) | 192 | ((dip)->di_u.di_c + XFS_DFORK_BOFF(dip)) |
216 | #define XFS_DFORK_PTR(dip,w) \ | 193 | #define XFS_DFORK_PTR(dip,w) \ |
217 | ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) | 194 | ((w) == XFS_DATA_FORK ? XFS_DFORK_DPTR(dip) : XFS_DFORK_APTR(dip)) |
218 | #define XFS_CFORK_FORMAT(dcp,w) \ | 195 | #define XFS_DFORK_FORMAT(dip,w) \ |
219 | ((w) == XFS_DATA_FORK ? (dcp)->di_format : (dcp)->di_aformat) | ||
220 | #define XFS_CFORK_FMT_SET(dcp,w,n) \ | ||
221 | ((w) == XFS_DATA_FORK ? \ | 196 | ((w) == XFS_DATA_FORK ? \ |
222 | ((dcp)->di_format = (n)) : ((dcp)->di_aformat = (n))) | 197 | (dip)->di_core.di_format : \ |
223 | #define XFS_DFORK_FORMAT(dip,w) XFS_CFORK_FORMAT(&(dip)->di_core, w) | 198 | (dip)->di_core.di_aformat) |
224 | 199 | #define XFS_DFORK_NEXTENTS(dip,w) \ | |
225 | #define XFS_CFORK_NEXTENTS_DISK(dcp,w) \ | ||
226 | ((w) == XFS_DATA_FORK ? \ | ||
227 | be32_to_cpu((dcp)->di_nextents) : \ | ||
228 | be16_to_cpu((dcp)->di_anextents)) | ||
229 | #define XFS_CFORK_NEXTENTS(dcp,w) \ | ||
230 | ((w) == XFS_DATA_FORK ? (dcp)->di_nextents : (dcp)->di_anextents) | ||
231 | #define XFS_DFORK_NEXTENTS(dip,w) XFS_CFORK_NEXTENTS_DISK(&(dip)->di_core, w) | ||
232 | #define XFS_DFORK_NEXTENTS_HOST(dip,w) XFS_CFORK_NEXTENTS(&(dip)->di_core, w) | ||
233 | |||
234 | #define XFS_CFORK_NEXT_SET(dcp,w,n) \ | ||
235 | ((w) == XFS_DATA_FORK ? \ | 200 | ((w) == XFS_DATA_FORK ? \ |
236 | ((dcp)->di_nextents = (n)) : ((dcp)->di_anextents = (n))) | 201 | be32_to_cpu((dip)->di_core.di_nextents) : \ |
202 | be16_to_cpu((dip)->di_core.di_anextents)) | ||
237 | 203 | ||
238 | #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) | 204 | #define XFS_BUF_TO_DINODE(bp) ((xfs_dinode_t *)XFS_BUF_PTR(bp)) |
239 | 205 | ||