xfs: fix the xfs_log_iovec i_addr type
authorChristoph Hellwig <hch@infradead.org>
Wed, 23 Jun 2010 08:11:15 +0000 (18:11 +1000)
committerAlex Elder <aelder@sgi.com>
Mon, 26 Jul 2010 18:16:36 +0000 (13:16 -0500)
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>
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log.h
fs/xfs/xfs_log_cil.c
fs/xfs/xfs_log_recover.c

index cd86bc317d593b140fd4f63f08f997ba3c1fe784..2a1f3dc10a02dba4f401a326fd72f07bd40212af 100644 (file)
@@ -65,11 +65,11 @@ xfs_qm_dquot_logitem_format(
 {
        struct xfs_dq_logitem   *qlip = DQUOT_ITEM(lip);
 
-       logvec->i_addr = (xfs_caddr_t)&qlip->qli_format;
+       logvec->i_addr = &qlip->qli_format;
        logvec->i_len  = sizeof(xfs_dq_logformat_t);
        logvec->i_type = XLOG_REG_TYPE_QFORMAT;
        logvec++;
-       logvec->i_addr = (xfs_caddr_t)&qlip->qli_dquot->q_core;
+       logvec->i_addr = &qlip->qli_dquot->q_core;
        logvec->i_len  = sizeof(xfs_disk_dquot_t);
        logvec->i_type = XLOG_REG_TYPE_DQUOT;
 
@@ -369,7 +369,7 @@ xfs_qm_qoff_logitem_format(
 
        ASSERT(qflip->qql_format.qf_type == XFS_LI_QUOTAOFF);
 
-       log_vector->i_addr = (xfs_caddr_t)&(qflip->qql_format);
+       log_vector->i_addr = &qflip->qql_format;
        log_vector->i_len = sizeof(xfs_qoff_logitem_t);
        log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF;
        qflip->qql_format.qf_size = 1;
index f53327a19e0db7f1a682cabc082d2ab7ed3aada3..2a9e4ef12110658b9b1e72990b03fb9bd2315afd 100644 (file)
@@ -251,7 +251,7 @@ xfs_buf_item_format(
        base_size =
                (uint)(sizeof(xfs_buf_log_format_t) +
                       ((bip->bli_format.blf_map_size - 1) * sizeof(uint)));
-       vecp->i_addr = (xfs_caddr_t)&bip->bli_format;
+       vecp->i_addr = &bip->bli_format;
        vecp->i_len = base_size;
        vecp->i_type = XLOG_REG_TYPE_BFORMAT;
        vecp++;
index 61d83c64ed329ac65ea1fb5887fdc00877f45552..a55e687bf562f1174e37e0764e9dab1405333a7a 100644 (file)
@@ -82,7 +82,7 @@ xfs_efi_item_format(
        size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t);
        efip->efi_format.efi_size = 1;
 
-       log_vector->i_addr = (xfs_caddr_t)&efip->efi_format;
+       log_vector->i_addr = &efip->efi_format;
        log_vector->i_len = size;
        log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT;
        ASSERT(size >= sizeof(xfs_efi_log_format_t));
@@ -244,7 +244,7 @@ xfs_efi_init(
 int
 xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
 {
-       xfs_efi_log_format_t *src_efi_fmt = (xfs_efi_log_format_t *)buf->i_addr;
+       xfs_efi_log_format_t *src_efi_fmt = buf->i_addr;
        uint i;
        uint len = sizeof(xfs_efi_log_format_t) + 
                (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_t);  
@@ -257,8 +257,7 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
                memcpy((char *)dst_efi_fmt, (char*)src_efi_fmt, len);
                return 0;
        } else if (buf->i_len == len32) {
-               xfs_efi_log_format_32_t *src_efi_fmt_32 =
-                       (xfs_efi_log_format_32_t *)buf->i_addr;
+               xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr;
 
                dst_efi_fmt->efi_type     = src_efi_fmt_32->efi_type;
                dst_efi_fmt->efi_size     = src_efi_fmt_32->efi_size;
@@ -272,8 +271,7 @@ xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt)
                }
                return 0;
        } else if (buf->i_len == len64) {
-               xfs_efi_log_format_64_t *src_efi_fmt_64 =
-                       (xfs_efi_log_format_64_t *)buf->i_addr;
+               xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr;
 
                dst_efi_fmt->efi_type     = src_efi_fmt_64->efi_type;
                dst_efi_fmt->efi_size     = src_efi_fmt_64->efi_size;
@@ -373,7 +371,7 @@ xfs_efd_item_format(
        size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t);
        efdp->efd_format.efd_size = 1;
 
-       log_vector->i_addr = (xfs_caddr_t)&efdp->efd_format;
+       log_vector->i_addr = &efdp->efd_format;
        log_vector->i_len = size;
        log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT;
        ASSERT(size >= sizeof(xfs_efd_log_format_t));
index ad050c618e62b93cb2fab68e075056fc197fb561..2998b2cb746615b0d7b198d2fc35930384bcc04d 100644 (file)
@@ -217,7 +217,7 @@ xfs_inode_item_format(
        int                     nrecs;
        xfs_mount_t             *mp;
 
-       vecp->i_addr = (xfs_caddr_t)&iip->ili_format;
+       vecp->i_addr = &iip->ili_format;
        vecp->i_len  = sizeof(xfs_inode_log_format_t);
        vecp->i_type = XLOG_REG_TYPE_IFORMAT;
        vecp++;
@@ -268,7 +268,7 @@ xfs_inode_item_format(
         */
        xfs_synchronize_times(ip);
 
-       vecp->i_addr = (xfs_caddr_t)&ip->i_d;
+       vecp->i_addr = &ip->i_d;
        vecp->i_len  = sizeof(struct xfs_icdinode);
        vecp->i_type = XLOG_REG_TYPE_ICORE;
        vecp++;
@@ -324,8 +324,7 @@ xfs_inode_item_format(
                                 * extents, so just point to the
                                 * real extents array.
                                 */
-                               vecp->i_addr =
-                                       (char *)(ip->i_df.if_u1.if_extents);
+                               vecp->i_addr = ip->i_df.if_u1.if_extents;
                                vecp->i_len = ip->i_df.if_bytes;
                                vecp->i_type = XLOG_REG_TYPE_IEXT;
                        } else
@@ -343,7 +342,7 @@ xfs_inode_item_format(
                                ext_buffer = kmem_alloc(ip->i_df.if_bytes,
                                        KM_SLEEP);
                                iip->ili_extents_buf = ext_buffer;
-                               vecp->i_addr = (xfs_caddr_t)ext_buffer;
+                               vecp->i_addr = ext_buffer;
                                vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
                                                XFS_DATA_FORK);
                                vecp->i_type = XLOG_REG_TYPE_IEXT;
@@ -362,7 +361,7 @@ xfs_inode_item_format(
                if (iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) {
                        ASSERT(ip->i_df.if_broot_bytes > 0);
                        ASSERT(ip->i_df.if_broot != NULL);
-                       vecp->i_addr = (xfs_caddr_t)ip->i_df.if_broot;
+                       vecp->i_addr = ip->i_df.if_broot;
                        vecp->i_len = ip->i_df.if_broot_bytes;
                        vecp->i_type = XLOG_REG_TYPE_IBROOT;
                        vecp++;
@@ -380,7 +379,7 @@ xfs_inode_item_format(
                        ASSERT(ip->i_df.if_u1.if_data != NULL);
                        ASSERT(ip->i_d.di_size > 0);
 
-                       vecp->i_addr = (xfs_caddr_t)ip->i_df.if_u1.if_data;
+                       vecp->i_addr = ip->i_df.if_u1.if_data;
                        /*
                         * Round i_bytes up to a word boundary.
                         * The underlying memory is guaranteed to
@@ -454,7 +453,7 @@ xfs_inode_item_format(
                         * There are not delayed allocation extents
                         * for attributes, so just point at the array.
                         */
-                       vecp->i_addr = (char *)(ip->i_afp->if_u1.if_extents);
+                       vecp->i_addr = ip->i_afp->if_u1.if_extents;
                        vecp->i_len = ip->i_afp->if_bytes;
 #else
                        ASSERT(iip->ili_aextents_buf == NULL);
@@ -464,7 +463,7 @@ xfs_inode_item_format(
                        ext_buffer = kmem_alloc(ip->i_afp->if_bytes,
                                KM_SLEEP);
                        iip->ili_aextents_buf = ext_buffer;
-                       vecp->i_addr = (xfs_caddr_t)ext_buffer;
+                       vecp->i_addr = ext_buffer;
                        vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
                                        XFS_ATTR_FORK);
 #endif
@@ -481,7 +480,7 @@ xfs_inode_item_format(
                if (iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) {
                        ASSERT(ip->i_afp->if_broot_bytes > 0);
                        ASSERT(ip->i_afp->if_broot != NULL);
-                       vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_broot;
+                       vecp->i_addr = ip->i_afp->if_broot;
                        vecp->i_len = ip->i_afp->if_broot_bytes;
                        vecp->i_type = XLOG_REG_TYPE_IATTR_BROOT;
                        vecp++;
@@ -497,7 +496,7 @@ xfs_inode_item_format(
                        ASSERT(ip->i_afp->if_bytes > 0);
                        ASSERT(ip->i_afp->if_u1.if_data != NULL);
 
-                       vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_u1.if_data;
+                       vecp->i_addr = ip->i_afp->if_u1.if_data;
                        /*
                         * Round i_bytes up to a word boundary.
                         * The underlying memory is guaranteed to
@@ -938,9 +937,8 @@ xfs_inode_item_format_convert(
        xfs_inode_log_format_t  *in_f)
 {
        if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) {
-               xfs_inode_log_format_32_t *in_f32;
+               xfs_inode_log_format_32_t *in_f32 = buf->i_addr;
 
-               in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr;
                in_f->ilf_type = in_f32->ilf_type;
                in_f->ilf_size = in_f32->ilf_size;
                in_f->ilf_fields = in_f32->ilf_fields;
@@ -956,9 +954,8 @@ xfs_inode_item_format_convert(
                in_f->ilf_boffset = in_f32->ilf_boffset;
                return 0;
        } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){
-               xfs_inode_log_format_64_t *in_f64;
+               xfs_inode_log_format_64_t *in_f64 = buf->i_addr;
 
-               in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr;
                in_f->ilf_type = in_f64->ilf_type;
                in_f->ilf_size = in_f64->ilf_size;
                in_f->ilf_fields = in_f64->ilf_fields;
index 1857c412d8399c8c74b617e9ce8dac7b993430b7..f461760c5b7618047e62c19353145846e086a375 100644 (file)
@@ -548,7 +548,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
                                .magic = XLOG_UNMOUNT_TYPE,
                        };
                        struct xfs_log_iovec reg = {
-                               .i_addr = (void *)&magic,
+                               .i_addr = &magic,
                                .i_len = sizeof(magic),
                                .i_type = XLOG_REG_TYPE_UNMOUNT,
                        };
index 04c78e642cc83b237ed0c5d6258f82e0ccdcad26..5b72e9a40ab20a44b9cb7fbb9deb80f0a16605f9 100644 (file)
@@ -104,7 +104,7 @@ static inline xfs_lsn_t     _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
 #define XLOG_REG_TYPE_MAX              19
 
 typedef struct xfs_log_iovec {
-       xfs_caddr_t     i_addr;         /* beginning address of region */
+       void            *i_addr;        /* beginning address of region */
        int             i_len;          /* length in bytes of region */
        uint            i_type;         /* type of region */
 } xfs_log_iovec_t;
index 5eaeede942b5af0fcdec78945a48b26e0df46a79..31e4ea2d19acfc08f069813dffa367e6b2420973 100644 (file)
@@ -552,7 +552,7 @@ xlog_cil_push(
        thdr.th_type = XFS_TRANS_CHECKPOINT;
        thdr.th_tid = tic->t_tid;
        thdr.th_num_items = num_iovecs;
-       lhdr.i_addr = (xfs_caddr_t)&thdr;
+       lhdr.i_addr = &thdr;
        lhdr.i_len = sizeof(xfs_trans_header_t);
        lhdr.i_type = XLOG_REG_TYPE_TRANSHDR;
        tic->t_curr_res -= lhdr.i_len + sizeof(xlog_op_header_t);
index 0fa18a88febc29ce572a58cfda248f1da2ba13a8..6f3f5fa37acf16cec91cf55eb36d0d7c1b20d0b2 100644 (file)
@@ -1561,9 +1561,7 @@ xlog_recover_reorder_trans(
 
        list_splice_init(&trans->r_itemq, &sort_list);
        list_for_each_entry_safe(item, n, &sort_list, ri_list) {
-               xfs_buf_log_format_t    *buf_f;
-
-               buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr;
+               xfs_buf_log_format_t    *buf_f = item->ri_buf[0].i_addr;
 
                switch (ITEM_TYPE(item)) {
                case XFS_LI_BUF:
@@ -1888,9 +1886,8 @@ xlog_recover_do_inode_buffer(
                 * current di_next_unlinked field.  Extract its value
                 * and copy it to the buffer copy.
                 */
-               logged_nextp = (xfs_agino_t *)
-                              ((char *)(item->ri_buf[item_index].i_addr) +
-                               (next_unlinked_offset - reg_buf_offset));
+               logged_nextp = item->ri_buf[item_index].i_addr +
+                               next_unlinked_offset - reg_buf_offset;
                if (unlikely(*logged_nextp == 0)) {
                        xfs_fs_cmn_err(CE_ALERT, mp,
                                "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(
                                        item->ri_buf[i].i_len, __func__);
                                goto next;
                        }
-                       error = xfs_qm_dqcheck((xfs_disk_dquot_t *)
-                                              item->ri_buf[i].i_addr,
+                       error = xfs_qm_dqcheck(item->ri_buf[i].i_addr,
                                               -1, 0, XFS_QMOPT_DOWARN,
                                               "dquot_buf_recover");
                        if (error)
@@ -2183,7 +2179,7 @@ xlog_recover_do_buffer_trans(
        xlog_recover_item_t     *item,
        int                     pass)
 {
-       xfs_buf_log_format_t    *buf_f;
+       xfs_buf_log_format_t    *buf_f = item->ri_buf[0].i_addr;
        xfs_mount_t             *mp;
        xfs_buf_t               *bp;
        int                     error;
@@ -2193,8 +2189,6 @@ xlog_recover_do_buffer_trans(
        ushort                  flags;
        uint                    buf_flags;
 
-       buf_f = (xfs_buf_log_format_t *)item->ri_buf[0].i_addr;
-
        if (pass == XLOG_RECOVER_PASS1) {
                /*
                 * In this pass we're only looking for buf items
@@ -2315,10 +2309,9 @@ xlog_recover_do_inode_trans(
        }
 
        if (item->ri_buf[0].i_len == sizeof(xfs_inode_log_format_t)) {
-               in_f = (xfs_inode_log_format_t *)item->ri_buf[0].i_addr;
+               in_f = item->ri_buf[0].i_addr;
        } else {
-               in_f = (xfs_inode_log_format_t *)kmem_alloc(
-                       sizeof(xfs_inode_log_format_t), KM_SLEEP);
+               in_f = kmem_alloc(sizeof(xfs_inode_log_format_t), KM_SLEEP);
                need_free = 1;
                error = xfs_inode_item_format_convert(&item->ri_buf[0], in_f);
                if (error)
@@ -2366,7 +2359,7 @@ xlog_recover_do_inode_trans(
                error = EFSCORRUPTED;
                goto error;
        }
-       dicp = (xfs_icdinode_t *)(item->ri_buf[1].i_addr);
+       dicp = item->ri_buf[1].i_addr;
        if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) {
                xfs_buf_relse(bp);
                xfs_fs_cmn_err(CE_ALERT, mp,
@@ -2457,7 +2450,7 @@ xlog_recover_do_inode_trans(
        }
 
        /* The core is in in-core format */
-       xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
+       xfs_dinode_to_disk(dip, item->ri_buf[1].i_addr);
 
        /* the rest is in on-disk format */
        if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
@@ -2574,7 +2567,7 @@ xlog_recover_do_quotaoff_trans(
                return (0);
        }
 
-       qoff_f = (xfs_qoff_logformat_t *)item->ri_buf[0].i_addr;
+       qoff_f = item->ri_buf[0].i_addr;
        ASSERT(qoff_f);
 
        /*
@@ -2618,9 +2611,8 @@ xlog_recover_do_dquot_trans(
        if (mp->m_qflags == 0)
                return (0);
 
-       recddq = (xfs_disk_dquot_t *)item->ri_buf[1].i_addr;
-
-       if (item->ri_buf[1].i_addr == NULL) {
+       recddq = item->ri_buf[1].i_addr;
+       if (recddq == NULL) {
                cmn_err(CE_ALERT,
                        "XFS: NULL dquot in %s.", __func__);
                return XFS_ERROR(EIO);
@@ -2650,7 +2642,7 @@ xlog_recover_do_dquot_trans(
         * The other possibility, of course, is that the quota subsystem was
         * removed since the last mount - ENOSYS.
         */
-       dq_f = (xfs_dq_logformat_t *)item->ri_buf[0].i_addr;
+       dq_f = item->ri_buf[0].i_addr;
        ASSERT(dq_f);
        if ((error = xfs_qm_dqcheck(recddq,
                           dq_f->qlf_id,
@@ -2717,7 +2709,7 @@ xlog_recover_do_efi_trans(
                return 0;
        }
 
-       efi_formatp = (xfs_efi_log_format_t *)item->ri_buf[0].i_addr;
+       efi_formatp = item->ri_buf[0].i_addr;
 
        mp = log->l_mp;
        efip = xfs_efi_init(mp, efi_formatp->efi_nextents);
@@ -2763,7 +2755,7 @@ xlog_recover_do_efd_trans(
                return;
        }
 
-       efd_formatp = (xfs_efd_log_format_t *)item->ri_buf[0].i_addr;
+       efd_formatp = item->ri_buf[0].i_addr;
        ASSERT((item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_32_t) +
                ((efd_formatp->efd_nextents - 1) * sizeof(xfs_extent_32_t)))) ||
               (item->ri_buf[0].i_len == (sizeof(xfs_efd_log_format_64_t) +