diff options
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index fb17f8226b09..69ac2e5ef20c 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "xfs_quota.h" | 46 | #include "xfs_quota.h" |
47 | #include "xfs_rw.h" | 47 | #include "xfs_rw.h" |
48 | #include "xfs_utils.h" | 48 | #include "xfs_utils.h" |
49 | #include "xfs_trace.h" | ||
49 | 50 | ||
50 | STATIC int xlog_find_zeroed(xlog_t *, xfs_daddr_t *); | 51 | STATIC int xlog_find_zeroed(xlog_t *, xfs_daddr_t *); |
51 | STATIC int xlog_clear_stale_blocks(xlog_t *, xfs_lsn_t); | 52 | STATIC int xlog_clear_stale_blocks(xlog_t *, xfs_lsn_t); |
@@ -225,16 +226,10 @@ xlog_header_check_dump( | |||
225 | xfs_mount_t *mp, | 226 | xfs_mount_t *mp, |
226 | xlog_rec_header_t *head) | 227 | xlog_rec_header_t *head) |
227 | { | 228 | { |
228 | int b; | 229 | cmn_err(CE_DEBUG, "%s: SB : uuid = %pU, fmt = %d\n", |
229 | 230 | __func__, &mp->m_sb.sb_uuid, XLOG_FMT); | |
230 | cmn_err(CE_DEBUG, "%s: SB : uuid = ", __func__); | 231 | cmn_err(CE_DEBUG, " log : uuid = %pU, fmt = %d\n", |
231 | for (b = 0; b < 16; b++) | 232 | &head->h_fs_uuid, be32_to_cpu(head->h_fmt)); |
232 | cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&mp->m_sb.sb_uuid)[b]); | ||
233 | cmn_err(CE_DEBUG, ", fmt = %d\n", XLOG_FMT); | ||
234 | cmn_err(CE_DEBUG, " log : uuid = "); | ||
235 | for (b = 0; b < 16; b++) | ||
236 | cmn_err(CE_DEBUG, "%02x", ((__uint8_t *)&head->h_fs_uuid)[b]); | ||
237 | cmn_err(CE_DEBUG, ", fmt = %d\n", be32_to_cpu(head->h_fmt)); | ||
238 | } | 233 | } |
239 | #else | 234 | #else |
240 | #define xlog_header_check_dump(mp, head) | 235 | #define xlog_header_check_dump(mp, head) |
@@ -2206,6 +2201,7 @@ xlog_recover_do_buffer_trans( | |||
2206 | xfs_daddr_t blkno; | 2201 | xfs_daddr_t blkno; |
2207 | int len; | 2202 | int len; |
2208 | ushort flags; | 2203 | ushort flags; |
2204 | uint buf_flags; | ||
2209 | 2205 | ||
2210 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | 2206 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; |
2211 | 2207 | ||
@@ -2246,12 +2242,11 @@ xlog_recover_do_buffer_trans( | |||
2246 | } | 2242 | } |
2247 | 2243 | ||
2248 | mp = log->l_mp; | 2244 | mp = log->l_mp; |
2249 | if (flags & XFS_BLI_INODE_BUF) { | 2245 | buf_flags = XFS_BUF_LOCK; |
2250 | bp = xfs_buf_read_flags(mp->m_ddev_targp, blkno, len, | 2246 | if (!(flags & XFS_BLI_INODE_BUF)) |
2251 | XFS_BUF_LOCK); | 2247 | buf_flags |= XFS_BUF_MAPPED; |
2252 | } else { | 2248 | |
2253 | bp = xfs_buf_read(mp->m_ddev_targp, blkno, len, 0); | 2249 | bp = xfs_buf_read(mp->m_ddev_targp, blkno, len, buf_flags); |
2254 | } | ||
2255 | if (XFS_BUF_ISERROR(bp)) { | 2250 | if (XFS_BUF_ISERROR(bp)) { |
2256 | xfs_ioerror_alert("xlog_recover_do..(read#1)", log->l_mp, | 2251 | xfs_ioerror_alert("xlog_recover_do..(read#1)", log->l_mp, |
2257 | bp, blkno); | 2252 | bp, blkno); |
@@ -2350,8 +2345,8 @@ xlog_recover_do_inode_trans( | |||
2350 | goto error; | 2345 | goto error; |
2351 | } | 2346 | } |
2352 | 2347 | ||
2353 | bp = xfs_buf_read_flags(mp->m_ddev_targp, in_f->ilf_blkno, | 2348 | bp = xfs_buf_read(mp->m_ddev_targp, in_f->ilf_blkno, in_f->ilf_len, |
2354 | in_f->ilf_len, XFS_BUF_LOCK); | 2349 | XFS_BUF_LOCK); |
2355 | if (XFS_BUF_ISERROR(bp)) { | 2350 | if (XFS_BUF_ISERROR(bp)) { |
2356 | xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, | 2351 | xfs_ioerror_alert("xlog_recover_do..(read#2)", mp, |
2357 | bp, in_f->ilf_blkno); | 2352 | bp, in_f->ilf_blkno); |
@@ -3517,7 +3512,7 @@ xlog_do_recovery_pass( | |||
3517 | { | 3512 | { |
3518 | xlog_rec_header_t *rhead; | 3513 | xlog_rec_header_t *rhead; |
3519 | xfs_daddr_t blk_no; | 3514 | xfs_daddr_t blk_no; |
3520 | xfs_caddr_t bufaddr, offset; | 3515 | xfs_caddr_t offset; |
3521 | xfs_buf_t *hbp, *dbp; | 3516 | xfs_buf_t *hbp, *dbp; |
3522 | int error = 0, h_size; | 3517 | int error = 0, h_size; |
3523 | int bblks, split_bblks; | 3518 | int bblks, split_bblks; |
@@ -3610,7 +3605,7 @@ xlog_do_recovery_pass( | |||
3610 | /* | 3605 | /* |
3611 | * Check for header wrapping around physical end-of-log | 3606 | * Check for header wrapping around physical end-of-log |
3612 | */ | 3607 | */ |
3613 | offset = NULL; | 3608 | offset = XFS_BUF_PTR(hbp); |
3614 | split_hblks = 0; | 3609 | split_hblks = 0; |
3615 | wrapped_hblks = 0; | 3610 | wrapped_hblks = 0; |
3616 | if (blk_no + hblks <= log->l_logBBsize) { | 3611 | if (blk_no + hblks <= log->l_logBBsize) { |
@@ -3646,9 +3641,8 @@ xlog_do_recovery_pass( | |||
3646 | * - order is important. | 3641 | * - order is important. |
3647 | */ | 3642 | */ |
3648 | wrapped_hblks = hblks - split_hblks; | 3643 | wrapped_hblks = hblks - split_hblks; |
3649 | bufaddr = XFS_BUF_PTR(hbp); | ||
3650 | error = XFS_BUF_SET_PTR(hbp, | 3644 | error = XFS_BUF_SET_PTR(hbp, |
3651 | bufaddr + BBTOB(split_hblks), | 3645 | offset + BBTOB(split_hblks), |
3652 | BBTOB(hblks - split_hblks)); | 3646 | BBTOB(hblks - split_hblks)); |
3653 | if (error) | 3647 | if (error) |
3654 | goto bread_err2; | 3648 | goto bread_err2; |
@@ -3658,14 +3652,10 @@ xlog_do_recovery_pass( | |||
3658 | if (error) | 3652 | if (error) |
3659 | goto bread_err2; | 3653 | goto bread_err2; |
3660 | 3654 | ||
3661 | error = XFS_BUF_SET_PTR(hbp, bufaddr, | 3655 | error = XFS_BUF_SET_PTR(hbp, offset, |
3662 | BBTOB(hblks)); | 3656 | BBTOB(hblks)); |
3663 | if (error) | 3657 | if (error) |
3664 | goto bread_err2; | 3658 | goto bread_err2; |
3665 | |||
3666 | if (!offset) | ||
3667 | offset = xlog_align(log, 0, | ||
3668 | wrapped_hblks, hbp); | ||
3669 | } | 3659 | } |
3670 | rhead = (xlog_rec_header_t *)offset; | 3660 | rhead = (xlog_rec_header_t *)offset; |
3671 | error = xlog_valid_rec_header(log, rhead, | 3661 | error = xlog_valid_rec_header(log, rhead, |
@@ -3685,7 +3675,7 @@ xlog_do_recovery_pass( | |||
3685 | } else { | 3675 | } else { |
3686 | /* This log record is split across the | 3676 | /* This log record is split across the |
3687 | * physical end of log */ | 3677 | * physical end of log */ |
3688 | offset = NULL; | 3678 | offset = XFS_BUF_PTR(dbp); |
3689 | split_bblks = 0; | 3679 | split_bblks = 0; |
3690 | if (blk_no != log->l_logBBsize) { | 3680 | if (blk_no != log->l_logBBsize) { |
3691 | /* some data is before the physical | 3681 | /* some data is before the physical |
@@ -3714,9 +3704,8 @@ xlog_do_recovery_pass( | |||
3714 | * _first_, then the log start (LR header end) | 3704 | * _first_, then the log start (LR header end) |
3715 | * - order is important. | 3705 | * - order is important. |
3716 | */ | 3706 | */ |
3717 | bufaddr = XFS_BUF_PTR(dbp); | ||
3718 | error = XFS_BUF_SET_PTR(dbp, | 3707 | error = XFS_BUF_SET_PTR(dbp, |
3719 | bufaddr + BBTOB(split_bblks), | 3708 | offset + BBTOB(split_bblks), |
3720 | BBTOB(bblks - split_bblks)); | 3709 | BBTOB(bblks - split_bblks)); |
3721 | if (error) | 3710 | if (error) |
3722 | goto bread_err2; | 3711 | goto bread_err2; |
@@ -3727,13 +3716,9 @@ xlog_do_recovery_pass( | |||
3727 | if (error) | 3716 | if (error) |
3728 | goto bread_err2; | 3717 | goto bread_err2; |
3729 | 3718 | ||
3730 | error = XFS_BUF_SET_PTR(dbp, bufaddr, h_size); | 3719 | error = XFS_BUF_SET_PTR(dbp, offset, h_size); |
3731 | if (error) | 3720 | if (error) |
3732 | goto bread_err2; | 3721 | goto bread_err2; |
3733 | |||
3734 | if (!offset) | ||
3735 | offset = xlog_align(log, wrapped_hblks, | ||
3736 | bblks - split_bblks, dbp); | ||
3737 | } | 3722 | } |
3738 | xlog_unpack_data(rhead, offset, log); | 3723 | xlog_unpack_data(rhead, offset, log); |
3739 | if ((error = xlog_recover_process_data(log, rhash, | 3724 | if ((error = xlog_recover_process_data(log, rhash, |