diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-27 23:57:51 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:48:30 -0400 |
commit | 347d1c01956d567c18afef0cc253eb235cafacd8 (patch) | |
tree | 55c61ae9390e013978cef21099a65965b2bb0ab5 /fs/xfs/xfs_log_recover.c | |
parent | ddc6d3b32a8a732c343dc225048fae06c129e48a (diff) |
[XFS] dinode endianess annotations
Biggest bit is duplicating the dinode structure so we have one annotated for
native endianess and one for disk endianess. The other significant change
is that xfs_xlate_dinode_core is split into one helper per direction to
allow for proper annotations, everything else is trivial.
As a sidenode splitting out the incore dinode means we can move it into
xfs_inode.h in a later patch and severely improving on the include hell in
xfs.
SGI-PV: 968563
SGI-Modid: xfs-linux-melb:xfs-kern:29476a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8ae6e8e5f3db..758543443b66 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2245,7 +2245,7 @@ xlog_recover_do_inode_trans( | |||
2245 | int error; | 2245 | int error; |
2246 | int attr_index; | 2246 | int attr_index; |
2247 | uint fields; | 2247 | uint fields; |
2248 | xfs_dinode_core_t *dicp; | 2248 | xfs_icdinode_t *dicp; |
2249 | int need_free = 0; | 2249 | int need_free = 0; |
2250 | 2250 | ||
2251 | if (pass == XLOG_RECOVER_PASS1) { | 2251 | if (pass == XLOG_RECOVER_PASS1) { |
@@ -2309,7 +2309,7 @@ xlog_recover_do_inode_trans( | |||
2309 | * Make sure the place we're flushing out to really looks | 2309 | * Make sure the place we're flushing out to really looks |
2310 | * like an inode! | 2310 | * like an inode! |
2311 | */ | 2311 | */ |
2312 | if (unlikely(INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC)) { | 2312 | if (unlikely(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC)) { |
2313 | xfs_buf_relse(bp); | 2313 | xfs_buf_relse(bp); |
2314 | xfs_fs_cmn_err(CE_ALERT, mp, | 2314 | xfs_fs_cmn_err(CE_ALERT, mp, |
2315 | "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", | 2315 | "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", |
@@ -2319,7 +2319,7 @@ xlog_recover_do_inode_trans( | |||
2319 | error = EFSCORRUPTED; | 2319 | error = EFSCORRUPTED; |
2320 | goto error; | 2320 | goto error; |
2321 | } | 2321 | } |
2322 | dicp = (xfs_dinode_core_t*)(item->ri_buf[1].i_addr); | 2322 | dicp = (xfs_icdinode_t *)(item->ri_buf[1].i_addr); |
2323 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { | 2323 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { |
2324 | xfs_buf_relse(bp); | 2324 | xfs_buf_relse(bp); |
2325 | xfs_fs_cmn_err(CE_ALERT, mp, | 2325 | xfs_fs_cmn_err(CE_ALERT, mp, |
@@ -2332,15 +2332,13 @@ xlog_recover_do_inode_trans( | |||
2332 | } | 2332 | } |
2333 | 2333 | ||
2334 | /* Skip replay when the on disk inode is newer than the log one */ | 2334 | /* Skip replay when the on disk inode is newer than the log one */ |
2335 | if (dicp->di_flushiter < | 2335 | if (dicp->di_flushiter < be16_to_cpu(dip->di_core.di_flushiter)) { |
2336 | INT_GET(dip->di_core.di_flushiter, ARCH_CONVERT)) { | ||
2337 | /* | 2336 | /* |
2338 | * Deal with the wrap case, DI_MAX_FLUSH is less | 2337 | * Deal with the wrap case, DI_MAX_FLUSH is less |
2339 | * than smaller numbers | 2338 | * than smaller numbers |
2340 | */ | 2339 | */ |
2341 | if ((INT_GET(dip->di_core.di_flushiter, ARCH_CONVERT) | 2340 | if (be16_to_cpu(dip->di_core.di_flushiter) == DI_MAX_FLUSH && |
2342 | == DI_MAX_FLUSH) && | 2341 | dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) { |
2343 | (dicp->di_flushiter < (DI_MAX_FLUSH>>1))) { | ||
2344 | /* do nothing */ | 2342 | /* do nothing */ |
2345 | } else { | 2343 | } else { |
2346 | xfs_buf_relse(bp); | 2344 | xfs_buf_relse(bp); |
@@ -2411,8 +2409,8 @@ xlog_recover_do_inode_trans( | |||
2411 | } | 2409 | } |
2412 | 2410 | ||
2413 | /* The core is in in-core format */ | 2411 | /* The core is in in-core format */ |
2414 | xfs_xlate_dinode_core((xfs_caddr_t)&dip->di_core, | 2412 | xfs_dinode_to_disk(&dip->di_core, |
2415 | (xfs_dinode_core_t*)item->ri_buf[1].i_addr, -1); | 2413 | (xfs_icdinode_t *)item->ri_buf[1].i_addr); |
2416 | 2414 | ||
2417 | /* the rest is in on-disk format */ | 2415 | /* the rest is in on-disk format */ |
2418 | if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { | 2416 | if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { |
@@ -2424,8 +2422,7 @@ xlog_recover_do_inode_trans( | |||
2424 | fields = in_f->ilf_fields; | 2422 | fields = in_f->ilf_fields; |
2425 | switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { | 2423 | switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { |
2426 | case XFS_ILOG_DEV: | 2424 | case XFS_ILOG_DEV: |
2427 | INT_SET(dip->di_u.di_dev, ARCH_CONVERT, in_f->ilf_u.ilfu_rdev); | 2425 | dip->di_u.di_dev = cpu_to_be32(in_f->ilf_u.ilfu_rdev); |
2428 | |||
2429 | break; | 2426 | break; |
2430 | case XFS_ILOG_UUID: | 2427 | case XFS_ILOG_UUID: |
2431 | dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid; | 2428 | dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid; |
@@ -3234,8 +3231,8 @@ xlog_recover_process_iunlinks( | |||
3234 | ASSERT(ip->i_d.di_nlink == 0); | 3231 | ASSERT(ip->i_d.di_nlink == 0); |
3235 | 3232 | ||
3236 | /* setup for the next pass */ | 3233 | /* setup for the next pass */ |
3237 | agino = INT_GET(dip->di_next_unlinked, | 3234 | agino = be32_to_cpu( |
3238 | ARCH_CONVERT); | 3235 | dip->di_next_unlinked); |
3239 | xfs_buf_relse(ibp); | 3236 | xfs_buf_relse(ibp); |
3240 | /* | 3237 | /* |
3241 | * Prevent any DMAPI event from | 3238 | * Prevent any DMAPI event from |