diff options
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r-- | fs/xfs/xfs_log.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index c8d09ef81c4f..08d4fe46f0fa 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -109,7 +109,7 @@ xlog_ungrant_log_space( | |||
109 | STATIC void | 109 | STATIC void |
110 | xlog_verify_dest_ptr( | 110 | xlog_verify_dest_ptr( |
111 | struct xlog *log, | 111 | struct xlog *log, |
112 | char *ptr); | 112 | void *ptr); |
113 | STATIC void | 113 | STATIC void |
114 | xlog_verify_grant_tail( | 114 | xlog_verify_grant_tail( |
115 | struct xlog *log); | 115 | struct xlog *log); |
@@ -1444,7 +1444,7 @@ xlog_alloc_log( | |||
1444 | iclog->ic_bp = bp; | 1444 | iclog->ic_bp = bp; |
1445 | iclog->ic_data = bp->b_addr; | 1445 | iclog->ic_data = bp->b_addr; |
1446 | #ifdef DEBUG | 1446 | #ifdef DEBUG |
1447 | log->l_iclog_bak[i] = (xfs_caddr_t)&(iclog->ic_header); | 1447 | log->l_iclog_bak[i] = &iclog->ic_header; |
1448 | #endif | 1448 | #endif |
1449 | head = &iclog->ic_header; | 1449 | head = &iclog->ic_header; |
1450 | memset(head, 0, sizeof(xlog_rec_header_t)); | 1450 | memset(head, 0, sizeof(xlog_rec_header_t)); |
@@ -1599,7 +1599,7 @@ xlog_pack_data( | |||
1599 | int i, j, k; | 1599 | int i, j, k; |
1600 | int size = iclog->ic_offset + roundoff; | 1600 | int size = iclog->ic_offset + roundoff; |
1601 | __be32 cycle_lsn; | 1601 | __be32 cycle_lsn; |
1602 | xfs_caddr_t dp; | 1602 | char *dp; |
1603 | 1603 | ||
1604 | cycle_lsn = CYCLE_LSN_DISK(iclog->ic_header.h_lsn); | 1604 | cycle_lsn = CYCLE_LSN_DISK(iclog->ic_header.h_lsn); |
1605 | 1605 | ||
@@ -3661,7 +3661,7 @@ xlog_ticket_alloc( | |||
3661 | void | 3661 | void |
3662 | xlog_verify_dest_ptr( | 3662 | xlog_verify_dest_ptr( |
3663 | struct xlog *log, | 3663 | struct xlog *log, |
3664 | char *ptr) | 3664 | void *ptr) |
3665 | { | 3665 | { |
3666 | int i; | 3666 | int i; |
3667 | int good_ptr = 0; | 3667 | int good_ptr = 0; |
@@ -3764,9 +3764,8 @@ xlog_verify_iclog( | |||
3764 | xlog_op_header_t *ophead; | 3764 | xlog_op_header_t *ophead; |
3765 | xlog_in_core_t *icptr; | 3765 | xlog_in_core_t *icptr; |
3766 | xlog_in_core_2_t *xhdr; | 3766 | xlog_in_core_2_t *xhdr; |
3767 | xfs_caddr_t ptr; | 3767 | void *base_ptr, *ptr, *p; |
3768 | xfs_caddr_t base_ptr; | 3768 | ptrdiff_t field_offset; |
3769 | __psint_t field_offset; | ||
3770 | __uint8_t clientid; | 3769 | __uint8_t clientid; |
3771 | int len, i, j, k, op_len; | 3770 | int len, i, j, k, op_len; |
3772 | int idx; | 3771 | int idx; |
@@ -3785,9 +3784,9 @@ xlog_verify_iclog( | |||
3785 | if (iclog->ic_header.h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) | 3784 | if (iclog->ic_header.h_magicno != cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) |
3786 | xfs_emerg(log->l_mp, "%s: invalid magic num", __func__); | 3785 | xfs_emerg(log->l_mp, "%s: invalid magic num", __func__); |
3787 | 3786 | ||
3788 | ptr = (xfs_caddr_t) &iclog->ic_header; | 3787 | base_ptr = ptr = &iclog->ic_header; |
3789 | for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; | 3788 | p = &iclog->ic_header; |
3790 | ptr += BBSIZE) { | 3789 | for (ptr += BBSIZE; ptr < base_ptr + count; ptr += BBSIZE) { |
3791 | if (*(__be32 *)ptr == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) | 3790 | if (*(__be32 *)ptr == cpu_to_be32(XLOG_HEADER_MAGIC_NUM)) |
3792 | xfs_emerg(log->l_mp, "%s: unexpected magic num", | 3791 | xfs_emerg(log->l_mp, "%s: unexpected magic num", |
3793 | __func__); | 3792 | __func__); |
@@ -3795,20 +3794,19 @@ xlog_verify_iclog( | |||
3795 | 3794 | ||
3796 | /* check fields */ | 3795 | /* check fields */ |
3797 | len = be32_to_cpu(iclog->ic_header.h_num_logops); | 3796 | len = be32_to_cpu(iclog->ic_header.h_num_logops); |
3798 | ptr = iclog->ic_datap; | 3797 | base_ptr = ptr = iclog->ic_datap; |
3799 | base_ptr = ptr; | 3798 | ophead = ptr; |
3800 | ophead = (xlog_op_header_t *)ptr; | ||
3801 | xhdr = iclog->ic_data; | 3799 | xhdr = iclog->ic_data; |
3802 | for (i = 0; i < len; i++) { | 3800 | for (i = 0; i < len; i++) { |
3803 | ophead = (xlog_op_header_t *)ptr; | 3801 | ophead = ptr; |
3804 | 3802 | ||
3805 | /* clientid is only 1 byte */ | 3803 | /* clientid is only 1 byte */ |
3806 | field_offset = (__psint_t) | 3804 | p = &ophead->oh_clientid; |
3807 | ((xfs_caddr_t)&(ophead->oh_clientid) - base_ptr); | 3805 | field_offset = p - base_ptr; |
3808 | if (!syncing || (field_offset & 0x1ff)) { | 3806 | if (!syncing || (field_offset & 0x1ff)) { |
3809 | clientid = ophead->oh_clientid; | 3807 | clientid = ophead->oh_clientid; |
3810 | } else { | 3808 | } else { |
3811 | idx = BTOBBT((xfs_caddr_t)&(ophead->oh_clientid) - iclog->ic_datap); | 3809 | idx = BTOBBT((char *)&ophead->oh_clientid - iclog->ic_datap); |
3812 | if (idx >= (XLOG_HEADER_CYCLE_SIZE / BBSIZE)) { | 3810 | if (idx >= (XLOG_HEADER_CYCLE_SIZE / BBSIZE)) { |
3813 | j = idx / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); | 3811 | j = idx / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); |
3814 | k = idx % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); | 3812 | k = idx % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); |
@@ -3826,13 +3824,13 @@ xlog_verify_iclog( | |||
3826 | (unsigned long)field_offset); | 3824 | (unsigned long)field_offset); |
3827 | 3825 | ||
3828 | /* check length */ | 3826 | /* check length */ |
3829 | field_offset = (__psint_t) | 3827 | p = &ophead->oh_len; |
3830 | ((xfs_caddr_t)&(ophead->oh_len) - base_ptr); | 3828 | field_offset = p - base_ptr; |
3831 | if (!syncing || (field_offset & 0x1ff)) { | 3829 | if (!syncing || (field_offset & 0x1ff)) { |
3832 | op_len = be32_to_cpu(ophead->oh_len); | 3830 | op_len = be32_to_cpu(ophead->oh_len); |
3833 | } else { | 3831 | } else { |
3834 | idx = BTOBBT((__psint_t)&ophead->oh_len - | 3832 | idx = BTOBBT((uintptr_t)&ophead->oh_len - |
3835 | (__psint_t)iclog->ic_datap); | 3833 | (uintptr_t)iclog->ic_datap); |
3836 | if (idx >= (XLOG_HEADER_CYCLE_SIZE / BBSIZE)) { | 3834 | if (idx >= (XLOG_HEADER_CYCLE_SIZE / BBSIZE)) { |
3837 | j = idx / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); | 3835 | j = idx / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); |
3838 | k = idx % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); | 3836 | k = idx % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); |