diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-06-23 04:11:15 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:36 -0400 |
commit | 4e0d5f926b80b06234a4ed664d6ae8c54fb08c4b (patch) | |
tree | 6e8412c8e0dec25e5e895acb3e73fc25855800dd /fs/xfs/xfs_log_recover.c | |
parent | 898621d5a72c6799a9a13fce20443b4b6699899c (diff) |
xfs: fix the xfs_log_iovec i_addr type
By making this member a void pointer we can get rid of a lot of pointless
casts.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 0fa18a88febc..6f3f5fa37acf 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -1561,9 +1561,7 @@ xlog_recover_reorder_trans( | |||
1561 | 1561 | ||
1562 | list_splice_init(&trans->r_itemq, &sort_list); | 1562 | list_splice_init(&trans->r_itemq, &sort_list); |
1563 | list_for_each_entry_safe(item, n, &sort_list, ri_list) { | 1563 | list_for_each_entry_safe(item, n, &sort_list, ri_list) { |
1564 | xfs_buf_log_format_t *buf_f; | 1564 | xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; |
1565 | |||
1566 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | ||
1567 | 1565 | ||
1568 | switch (ITEM_TYPE(item)) { | 1566 | switch (ITEM_TYPE(item)) { |
1569 | case XFS_LI_BUF: | 1567 | case XFS_LI_BUF: |
@@ -1888,9 +1886,8 @@ xlog_recover_do_inode_buffer( | |||
1888 | * current di_next_unlinked field. Extract its value | 1886 | * current di_next_unlinked field. Extract its value |
1889 | * and copy it to the buffer copy. | 1887 | * and copy it to the buffer copy. |
1890 | */ | 1888 | */ |
1891 | logged_nextp = (xfs_agino_t *) | 1889 | logged_nextp = item->ri_buf[item_index].i_addr + |
1892 | ((char *)(item->ri_buf[item_index].i_addr) + | 1890 | next_unlinked_offset - reg_buf_offset; |
1893 | (next_unlinked_offset - reg_buf_offset)); | ||
1894 | if (unlikely(*logged_nextp == 0)) { | 1891 | if (unlikely(*logged_nextp == 0)) { |
1895 | xfs_fs_cmn_err(CE_ALERT, mp, | 1892 | xfs_fs_cmn_err(CE_ALERT, mp, |
1896 | "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", |
@@ -1969,8 +1966,7 @@ xlog_recover_do_reg_buffer( | |||
1969 | item->ri_buf[i].i_len, __func__); | 1966 | item->ri_buf[i].i_len, __func__); |
1970 | goto next; | 1967 | goto next; |
1971 | } | 1968 | } |
1972 | error = xfs_qm_dqcheck((xfs_disk_dquot_t *) | 1969 | error = xfs_qm_dqcheck(item->ri_buf[i].i_addr, |
1973 | item->ri_buf[i].i_addr, | ||
1974 | -1, 0, XFS_QMOPT_DOWARN, | 1970 | -1, 0, XFS_QMOPT_DOWARN, |
1975 | "dquot_buf_recover"); | 1971 | "dquot_buf_recover"); |
1976 | if (error) | 1972 | if (error) |
@@ -2183,7 +2179,7 @@ xlog_recover_do_buffer_trans( | |||
2183 | xlog_recover_item_t *item, | 2179 | xlog_recover_item_t *item, |
2184 | int pass) | 2180 | int pass) |
2185 | { | 2181 | { |
2186 | xfs_buf_log_format_t *buf_f; | 2182 | xfs_buf_log_format_t *buf_f = item->ri_buf[0].i_addr; |
2187 | xfs_mount_t *mp; | 2183 | xfs_mount_t *mp; |
2188 | xfs_buf_t *bp; | 2184 | xfs_buf_t *bp; |
2189 | int error; | 2185 | int error; |
@@ -2193,8 +2189,6 @@ xlog_recover_do_buffer_trans( | |||
2193 | ushort flags; | 2189 | ushort flags; |
2194 | uint buf_flags; | 2190 | uint buf_flags; |
2195 | 2191 | ||
2196 | buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr; | ||
2197 | |||
2198 | if (pass == XLOG_RECOVER_PASS1) { | 2192 | if (pass == XLOG_RECOVER_PASS1) { |
2199 | /* | 2193 | /* |
2200 | * In this pass we're only looking for buf items | 2194 | * In this pass we're only looking for buf items |
@@ -2315,10 +2309,9 @@ xlog_recover_do_inode_trans( | |||
2315 | } | 2309 | } |
2316 | 2310 | ||
2317 | 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)) { |
2318 | in_f = (xfs_inode_log_format_t *)item->ri_buf[0].i_addr; | 2312 | in_f = item->ri_buf[0].i_addr; |
2319 | } else { | 2313 | } else { |
2320 | in_f = (xfs_inode_log_format_t *)kmem_alloc( | 2314 | in_f = kmem_alloc(sizeof(xfs_inode_log_format_t), KM_SLEEP); |
2321 | sizeof(xfs_inode_log_format_t), KM_SLEEP); | ||
2322 | need_free = 1; | 2315 | need_free = 1; |
2323 | 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); |
2324 | if (error) | 2317 | if (error) |
@@ -2366,7 +2359,7 @@ xlog_recover_do_inode_trans( | |||
2366 | error = EFSCORRUPTED; | 2359 | error = EFSCORRUPTED; |
2367 | goto error; | 2360 | goto error; |
2368 | } | 2361 | } |
2369 | dicp = (xfs_icdinode_t *)(item->ri_buf[1].i_addr); | 2362 | dicp = item->ri_buf[1].i_addr; |
2370 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { | 2363 | if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) { |
2371 | xfs_buf_relse(bp); | 2364 | xfs_buf_relse(bp); |
2372 | xfs_fs_cmn_err(CE_ALERT, mp, | 2365 | xfs_fs_cmn_err(CE_ALERT, mp, |
@@ -2457,7 +2450,7 @@ xlog_recover_do_inode_trans( | |||
2457 | } | 2450 | } |
2458 | 2451 | ||
2459 | /* The core is in in-core format */ | 2452 | /* The core is in in-core format */ |
2460 | 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); |
2461 | 2454 | ||
2462 | /* the rest is in on-disk format */ | 2455 | /* the rest is in on-disk format */ |
2463 | if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) { | 2456 | if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) { |
@@ -2574,7 +2567,7 @@ xlog_recover_do_quotaoff_trans( | |||
2574 | return (0); | 2567 | return (0); |
2575 | } | 2568 | } |
2576 | 2569 | ||
2577 | qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr; | 2570 | qoff_f = item->ri_buf[0].i_addr; |
2578 | ASSERT(qoff_f); | 2571 | ASSERT(qoff_f); |
2579 | 2572 | ||
2580 | /* | 2573 | /* |
@@ -2618,9 +2611,8 @@ xlog_recover_do_dquot_trans( | |||
2618 | if (mp->m_qflags == 0) | 2611 | if (mp->m_qflags == 0) |
2619 | return (0); | 2612 | return (0); |
2620 | 2613 | ||
2621 | recddq = (xfs_disk_dquot_t *)item->ri_buf[1].i_addr; | 2614 | recddq = item->ri_buf[1].i_addr; |
2622 | 2615 | if (recddq == NULL) { | |
2623 | if (item->ri_buf[1].i_addr == NULL) { | ||
2624 | cmn_err(CE_ALERT, | 2616 | cmn_err(CE_ALERT, |
2625 | "XFS: NULL dquot in %s.", __func__); | 2617 | "XFS: NULL dquot in %s.", __func__); |
2626 | return XFS_ERROR(EIO); | 2618 | return XFS_ERROR(EIO); |
@@ -2650,7 +2642,7 @@ xlog_recover_do_dquot_trans( | |||
2650 | * The other possibility, of course, is that the quota subsystem was | 2642 | * The other possibility, of course, is that the quota subsystem was |
2651 | * removed since the last mount - ENOSYS. | 2643 | * removed since the last mount - ENOSYS. |
2652 | */ | 2644 | */ |
2653 | dq_f = (xfs_dq_logformat_t *)item->ri_buf[0].i_addr; | 2645 | dq_f = item->ri_buf[0].i_addr; |
2654 | ASSERT(dq_f); | 2646 | ASSERT(dq_f); |
2655 | if ((error = xfs_qm_dqcheck(recddq, | 2647 | if ((error = xfs_qm_dqcheck(recddq, |
2656 | dq_f->qlf_id, | 2648 | dq_f->qlf_id, |
@@ -2717,7 +2709,7 @@ xlog_recover_do_efi_trans( | |||
2717 | return 0; | 2709 | return 0; |
2718 | } | 2710 | } |
2719 | 2711 | ||
2720 | efi_formatp = (xfs_efi_log_format_t *)item->ri_buf[0].i_addr; | 2712 | efi_formatp = item->ri_buf[0].i_addr; |
2721 | 2713 | ||
2722 | mp = log->l_mp; | 2714 | mp = log->l_mp; |
2723 | efip = xfs_efi_init(mp, efi_formatp->efi_nextents); | 2715 | efip = xfs_efi_init(mp, efi_formatp->efi_nextents); |
@@ -2763,7 +2755,7 @@ xlog_recover_do_efd_trans( | |||
2763 | return; | 2755 | return; |
2764 | } | 2756 | } |
2765 | 2757 | ||
2766 | efd_formatp = (xfs_efd_log_format_t *)item->ri_buf[0].i_addr; | 2758 | efd_formatp = item->ri_buf[0].i_addr; |
2767 | 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) + |
2768 | ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) || | 2760 | ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) || |
2769 | (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) + |