diff options
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index ed0684cc50ee..6f3f5fa37acf 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -24,15 +24,11 @@ | |||
24 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
25 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
26 | #include "xfs_ag.h" | 26 | #include "xfs_ag.h" |
27 | #include "xfs_dir2.h" | ||
28 | #include "xfs_dmapi.h" | ||
29 | #include "xfs_mount.h" | 27 | #include "xfs_mount.h" |
30 | #include "xfs_error.h" | 28 | #include "xfs_error.h" |
31 | #include "xfs_bmap_btree.h" | 29 | #include "xfs_bmap_btree.h" |
32 | #include "xfs_alloc_btree.h" | 30 | #include "xfs_alloc_btree.h" |
33 | #include "xfs_ialloc_btree.h" | 31 | #include "xfs_ialloc_btree.h" |
34 | #include "xfs_dir2_sf.h" | ||
35 | #include "xfs_attr_sf.h" | ||
36 | #include "xfs_dinode.h" | 32 | #include "xfs_dinode.h" |
37 | #include "xfs_inode.h" | 33 | #include "xfs_inode.h" |
38 | #include "xfs_inode_item.h" | 34 | #include "xfs_inode_item.h" |
@@ -1565,9 +1561,7 @@ xlog_recover_reorder_trans( | |||
1565 | 1561 | ||
1566 | list_splice_init(&trans->r_itemq, &sort_list); | 1562 | list_splice_init(&trans->r_itemq, &sort_list); |
1567 | list_for_each_entry_safe(item, n, &sort_list, ri_list) { | 1563 | list_for_each_entry_safe(item, n, &sort_list, ri_list) { |
1568 | xfs_buf_log_format_t *buf_f; | 1564 | xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; |
1569 | |||
1570 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | ||
1571 | 1565 | ||
1572 | switch (ITEM_TYPE(item)) { | 1566 | switch (ITEM_TYPE(item)) { |
1573 | case XFS_LI_BUF: | 1567 | case XFS_LI_BUF: |
@@ -1892,9 +1886,8 @@ xlog_recover_do_inode_buffer( | |||
1892 | * current di_next_unlinked field. Extract its value | 1886 | * current di_next_unlinked field. Extract its value |
1893 | * and copy it to the buffer copy. | 1887 | * and copy it to the buffer copy. |
1894 | */ | 1888 | */ |
1895 | logged_nextp = (xfs_agino_t *) | 1889 | logged_nextp = item->ri_buf[item_index].i_addr + |
1896 | ((char *)(item->ri_buf[item_index].i_addr) + | 1890 | next_unlinked_offset - reg_buf_offset; |
1897 | (next_unlinked_offset - reg_buf_offset)); | ||
1898 | if (unlikely(*logged_nextp == 0)) { | 1891 | if (unlikely(*logged_nextp == 0)) { |
1899 | xfs_fs_cmn_err(CE_ALERT, mp, | 1892 | xfs_fs_cmn_err(CE_ALERT, mp, |
1900 | "bad inode buffer log record (ptr = 0x%p, bp = 0x%p). XFS trying to replay bad (0) inode di_next_unlinked field", | 1893 | "bad inode buffer log record (ptr = 0x%p, bp = 0x%p). XFS trying to replay bad (0) inode di_next_unlinked field", |
@@ -1973,8 +1966,7 @@ xlog_recover_do_reg_buffer( | |||
1973 | item->ri_buf[i].i_len, __func__); | 1966 | item->ri_buf[i].i_len, __func__); |
1974 | goto next; | 1967 | goto next; |
1975 | } | 1968 | } |
1976 | error = xfs_qm_dqcheck((xfs_disk_dquot_t *) | 1969 | error = xfs_qm_dqcheck(item->ri_buf[i].i_addr, |
1977 | item->ri_buf[i].i_addr, | ||
1978 | -1, 0, XFS_QMOPT_DOWARN, | 1970 | -1, 0, XFS_QMOPT_DOWARN, |
1979 | "dquot_buf_recover"); | 1971 | "dquot_buf_recover"); |
1980 | if (error) | 1972 | if (error) |
@@ -2187,7 +2179,7 @@ xlog_recover_do_buffer_trans( | |||
2187 | xlog_recover_item_t *item, | 2179 | xlog_recover_item_t *item, |
2188 | int pass) | 2180 | int pass) |
2189 | { | 2181 | { |
2190 | xfs_buf_log_format_t *buf_f; | 2182 | xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; |
2191 | xfs_mount_t *mp; | 2183 | xfs_mount_t *mp; |
2192 | xfs_buf_t *bp; | 2184 | xfs_buf_t *bp; |
2193 | int error; | 2185 | int error; |
@@ -2197,8 +2189,6 @@ xlog_recover_do_buffer_trans( | |||
2197 | ushort flags; | 2189 | ushort flags; |
2198 | uint buf_flags; | 2190 | uint buf_flags; |
2199 | 2191 | ||
2200 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | ||
2201 | |||
2202 | if (pass == XLOG_RECOVER_PASS1) { | 2192 | if (pass == XLOG_RECOVER_PASS1) { |
2203 | /* | 2193 | /* |
2204 | * In this pass we're only looking for buf items | 2194 | * In this pass we're only looking for buf items |
@@ -2319,10 +2309,9 @@ xlog_recover_do_inode_trans( | |||
2319 | } | 2309 | } |
2320 | 2310 | ||
2321 | if (item->ri_buf[0].i_len == sizeof(xfs_inode_log_format_t)) { | 2311 | if (item->ri_buf[0].i_len == sizeof(xfs_inode_log_format_t)) { |
2322 | in_f = (xfs_inode_log_format_t *)item->ri_buf[0].i_addr; | 2312 | in_f = item->ri_buf[0].i_addr; |
2323 | } else { | 2313 | } else { |
2324 | in_f = (xfs_inode_log_format_t *)kmem_alloc( | 2314 | in_f = kmem_alloc(sizeof(xfs_inode_log_format_t), KM_SLEEP); |
2325 | sizeof(xfs_inode_log_format_t), KM_SLEEP); | ||
2326 | need_free = 1; | 2315 | need_free = 1; |
2327 | error = xfs_inode_item_format_convert(&item->ri_buf[0], in_f); | 2316 | error = xfs_inode_item_format_convert(&item->ri_buf[0], in_f); |
2328 | if (error) | 2317 | if (error) |
@@ -2370,7 +2359,7 @@ xlog_recover_do_inode_trans( | |||
2370 | error = EFSCORRUPTED; | 2359 | error = EFSCORRUPTED; |
2371 | goto error; | 2360 | goto error; |
2372 | } | 2361 | } |
2373 | dicp = (xfs_icdinode_t *)(item->ri_buf[1].i_addr); | 2362 | dicp = item->ri_buf[1].i_addr; |
2374 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { | 2363 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { |
2375 | xfs_buf_relse(bp); | 2364 | xfs_buf_relse(bp); |
2376 | xfs_fs_cmn_err(CE_ALERT, mp, | 2365 | xfs_fs_cmn_err(CE_ALERT, mp, |
@@ -2461,7 +2450,7 @@ xlog_recover_do_inode_trans( | |||
2461 | } | 2450 | } |
2462 | 2451 | ||
2463 | /* The core is in in-core format */ | 2452 | /* The core is in in-core format */ |
2464 | xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr); | 2453 | xfs_dinode_to_disk(dip, item->ri_buf[1].i_addr); |
2465 | 2454 | ||
2466 | /* the rest is in on-disk format */ | 2455 | /* the rest is in on-disk format */ |
2467 | if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) { | 2456 | if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) { |
@@ -2578,7 +2567,7 @@ xlog_recover_do_quotaoff_trans( | |||
2578 | return (0); | 2567 | return (0); |
2579 | } | 2568 | } |
2580 | 2569 | ||
2581 | qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr; | 2570 | qoff_f = item->ri_buf[0].i_addr; |
2582 | ASSERT(qoff_f); | 2571 | ASSERT(qoff_f); |
2583 | 2572 | ||
2584 | /* | 2573 | /* |
@@ -2622,9 +2611,8 @@ xlog_recover_do_dquot_trans( | |||
2622 | if (mp->m_qflags == 0) | 2611 | if (mp->m_qflags == 0) |
2623 | return (0); | 2612 | return (0); |
2624 | 2613 | ||
2625 | recddq = (xfs_disk_dquot_t *)item->ri_buf[1].i_addr; | 2614 | recddq = item->ri_buf[1].i_addr; |
2626 | 2615 | if (recddq == NULL) { | |
2627 | if (item->ri_buf[1].i_addr == NULL) { | ||
2628 | cmn_err(CE_ALERT, | 2616 | cmn_err(CE_ALERT, |
2629 | "XFS: NULL dquot in %s.", __func__); | 2617 | "XFS: NULL dquot in %s.", __func__); |
2630 | return XFS_ERROR(EIO); | 2618 | return XFS_ERROR(EIO); |
@@ -2654,7 +2642,7 @@ xlog_recover_do_dquot_trans( | |||
2654 | * The other possibility, of course, is that the quota subsystem was | 2642 | * The other possibility, of course, is that the quota subsystem was |
2655 | * removed since the last mount - ENOSYS. | 2643 | * removed since the last mount - ENOSYS. |
2656 | */ | 2644 | */ |
2657 | dq_f = (xfs_dq_logformat_t *)item->ri_buf[0].i_addr; | 2645 | dq_f = item->ri_buf[0].i_addr; |
2658 | ASSERT(dq_f); | 2646 | ASSERT(dq_f); |
2659 | if ((error = xfs_qm_dqcheck(recddq, | 2647 | if ((error = xfs_qm_dqcheck(recddq, |
2660 | dq_f->qlf_id, | 2648 | dq_f->qlf_id, |
@@ -2721,7 +2709,7 @@ xlog_recover_do_efi_trans( | |||
2721 | return 0; | 2709 | return 0; |
2722 | } | 2710 | } |
2723 | 2711 | ||
2724 | efi_formatp = (xfs_efi_log_format_t *)item->ri_buf[0].i_addr; | 2712 | efi_formatp = item->ri_buf[0].i_addr; |
2725 | 2713 | ||
2726 | mp = log->l_mp; | 2714 | mp = log->l_mp; |
2727 | efip = xfs_efi_init(mp, efi_formatp->efi_nextents); | 2715 | efip = xfs_efi_init(mp, efi_formatp->efi_nextents); |
@@ -2767,7 +2755,7 @@ xlog_recover_do_efd_trans( | |||
2767 | return; | 2755 | return; |
2768 | } | 2756 | } |
2769 | 2757 | ||
2770 | efd_formatp = (xfs_efd_log_format_t *)item->ri_buf[0].i_addr; | 2758 | efd_formatp = item->ri_buf[0].i_addr; |
2771 | ASSERT((item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_32_t) + | 2759 | ASSERT((item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_32_t) + |
2772 | ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) || | 2760 | ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) || |
2773 | (item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_64_t) + | 2761 | (item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_64_t) + |
@@ -3198,7 +3186,7 @@ xlog_recover_process_one_iunlink( | |||
3198 | int error; | 3186 | int error; |
3199 | 3187 | ||
3200 | ino = XFS_AGINO_TO_INO(mp, agno, agino); | 3188 | ino = XFS_AGINO_TO_INO(mp, agno, agino); |
3201 | error = xfs_iget(mp, NULL, ino, 0, 0, &ip, 0); | 3189 | error = xfs_iget(mp, NULL, ino, 0, 0, &ip); |
3202 | if (error) | 3190 | if (error) |
3203 | goto fail; | 3191 | goto fail; |
3204 | 3192 | ||