aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 9abb96a7674d..4099618f5fa0 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2320,7 +2320,7 @@ xlog_recover_do_inode_trans(
2320 * Make sure the place we're flushing out to really looks 2320 * Make sure the place we're flushing out to really looks
2321 * like an inode! 2321 * like an inode!
2322 */ 2322 */
2323 if (unlikely(be16_to_cpu(dip->di_core.di_magic) != XFS_DINODE_MAGIC)) { 2323 if (unlikely(be16_to_cpu(dip->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,
2326 "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld", 2326 "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld",
@@ -2343,12 +2343,12 @@ xlog_recover_do_inode_trans(
2343 } 2343 }
2344 2344
2345 /* Skip replay when the on disk inode is newer than the log one */ 2345 /* Skip replay when the on disk inode is newer than the log one */
2346 if (dicp->di_flushiter < be16_to_cpu(dip->di_core.di_flushiter)) { 2346 if (dicp->di_flushiter < be16_to_cpu(dip->di_flushiter)) {
2347 /* 2347 /*
2348 * Deal with the wrap case, DI_MAX_FLUSH is less 2348 * Deal with the wrap case, DI_MAX_FLUSH is less
2349 * than smaller numbers 2349 * than smaller numbers
2350 */ 2350 */
2351 if (be16_to_cpu(dip->di_core.di_flushiter) == DI_MAX_FLUSH && 2351 if (be16_to_cpu(dip->di_flushiter) == DI_MAX_FLUSH &&
2352 dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) { 2352 dicp->di_flushiter < (DI_MAX_FLUSH >> 1)) {
2353 /* do nothing */ 2353 /* do nothing */
2354 } else { 2354 } else {
@@ -2408,7 +2408,7 @@ xlog_recover_do_inode_trans(
2408 error = EFSCORRUPTED; 2408 error = EFSCORRUPTED;
2409 goto error; 2409 goto error;
2410 } 2410 }
2411 if (unlikely(item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t))) { 2411 if (unlikely(item->ri_buf[1].i_len > sizeof(struct xfs_icdinode))) {
2412 XFS_CORRUPTION_ERROR("xlog_recover_do_inode_trans(7)", 2412 XFS_CORRUPTION_ERROR("xlog_recover_do_inode_trans(7)",
2413 XFS_ERRLEVEL_LOW, mp, dicp); 2413 XFS_ERRLEVEL_LOW, mp, dicp);
2414 xfs_buf_relse(bp); 2414 xfs_buf_relse(bp);
@@ -2420,23 +2420,24 @@ xlog_recover_do_inode_trans(
2420 } 2420 }
2421 2421
2422 /* The core is in in-core format */ 2422 /* The core is in in-core format */
2423 xfs_dinode_to_disk(&dip->di_core, 2423 xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
2424 (xfs_icdinode_t *)item->ri_buf[1].i_addr);
2425 2424
2426 /* the rest is in on-disk format */ 2425 /* the rest is in on-disk format */
2427 if (item->ri_buf[1].i_len > sizeof(xfs_dinode_core_t)) { 2426 if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
2428 memcpy((xfs_caddr_t) dip + sizeof(xfs_dinode_core_t), 2427 memcpy((xfs_caddr_t) dip + sizeof(struct xfs_icdinode),
2429 item->ri_buf[1].i_addr + sizeof(xfs_dinode_core_t), 2428 item->ri_buf[1].i_addr + sizeof(struct xfs_icdinode),
2430 item->ri_buf[1].i_len - sizeof(xfs_dinode_core_t)); 2429 item->ri_buf[1].i_len - sizeof(struct xfs_icdinode));
2431 } 2430 }
2432 2431
2433 fields = in_f->ilf_fields; 2432 fields = in_f->ilf_fields;
2434 switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) { 2433 switch (fields & (XFS_ILOG_DEV | XFS_ILOG_UUID)) {
2435 case XFS_ILOG_DEV: 2434 case XFS_ILOG_DEV:
2436 dip->di_u.di_dev = cpu_to_be32(in_f->ilf_u.ilfu_rdev); 2435 xfs_dinode_put_rdev(dip, in_f->ilf_u.ilfu_rdev);
2437 break; 2436 break;
2438 case XFS_ILOG_UUID: 2437 case XFS_ILOG_UUID:
2439 dip->di_u.di_muuid = in_f->ilf_u.ilfu_uuid; 2438 memcpy(XFS_DFORK_DPTR(dip),
2439 &in_f->ilf_u.ilfu_uuid,
2440 sizeof(uuid_t));
2440 break; 2441 break;
2441 } 2442 }
2442 2443
@@ -2452,12 +2453,12 @@ xlog_recover_do_inode_trans(
2452 switch (fields & XFS_ILOG_DFORK) { 2453 switch (fields & XFS_ILOG_DFORK) {
2453 case XFS_ILOG_DDATA: 2454 case XFS_ILOG_DDATA:
2454 case XFS_ILOG_DEXT: 2455 case XFS_ILOG_DEXT:
2455 memcpy(&dip->di_u, src, len); 2456 memcpy(XFS_DFORK_DPTR(dip), src, len);
2456 break; 2457 break;
2457 2458
2458 case XFS_ILOG_DBROOT: 2459 case XFS_ILOG_DBROOT:
2459 xfs_bmbt_to_bmdr(mp, (struct xfs_btree_block *)src, len, 2460 xfs_bmbt_to_bmdr(mp, (struct xfs_btree_block *)src, len,
2460 &dip->di_u.di_bmbt, 2461 (xfs_bmdr_block_t *)XFS_DFORK_DPTR(dip),
2461 XFS_DFORK_DSIZE(dip, mp)); 2462 XFS_DFORK_DSIZE(dip, mp));
2462 break; 2463 break;
2463 2464