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 | |
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')
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_extfree_item.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log_cil.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 38 |
8 files changed, 39 insertions, 52 deletions
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index cd86bc317d59..2a1f3dc10a02 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -65,11 +65,11 @@ xfs_qm_dquot_logitem_format( | |||
65 | { | 65 | { |
66 | struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip); | 66 | struct xfs_dq_logitem *qlip = DQUOT_ITEM(lip); |
67 | 67 | ||
68 | logvec->i_addr = (xfs_caddr_t)&qlip->qli_format; | 68 | logvec->i_addr = &qlip->qli_format; |
69 | logvec->i_len = sizeof(xfs_dq_logformat_t); | 69 | logvec->i_len = sizeof(xfs_dq_logformat_t); |
70 | logvec->i_type = XLOG_REG_TYPE_QFORMAT; | 70 | logvec->i_type = XLOG_REG_TYPE_QFORMAT; |
71 | logvec++; | 71 | logvec++; |
72 | logvec->i_addr = (xfs_caddr_t)&qlip->qli_dquot->q_core; | 72 | logvec->i_addr = &qlip->qli_dquot->q_core; |
73 | logvec->i_len = sizeof(xfs_disk_dquot_t); | 73 | logvec->i_len = sizeof(xfs_disk_dquot_t); |
74 | logvec->i_type = XLOG_REG_TYPE_DQUOT; | 74 | logvec->i_type = XLOG_REG_TYPE_DQUOT; |
75 | 75 | ||
@@ -369,7 +369,7 @@ xfs_qm_qoff_logitem_format( | |||
369 | 369 | ||
370 | ASSERT(qflip->qql_format.qf_type == XFS_LI_QUOTAOFF); | 370 | ASSERT(qflip->qql_format.qf_type == XFS_LI_QUOTAOFF); |
371 | 371 | ||
372 | log_vector->i_addr = (xfs_caddr_t)&(qflip->qql_format); | 372 | log_vector->i_addr = &qflip->qql_format; |
373 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); | 373 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); |
374 | log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF; | 374 | log_vector->i_type = XLOG_REG_TYPE_QUOTAOFF; |
375 | qflip->qql_format.qf_size = 1; | 375 | qflip->qql_format.qf_size = 1; |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index f53327a19e0d..2a9e4ef12110 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -251,7 +251,7 @@ xfs_buf_item_format( | |||
251 | base_size = | 251 | base_size = |
252 | (uint)(sizeof(xfs_buf_log_format_t) + | 252 | (uint)(sizeof(xfs_buf_log_format_t) + |
253 | ((bip->bli_format.blf_map_size - 1) * sizeof(uint))); | 253 | ((bip->bli_format.blf_map_size - 1) * sizeof(uint))); |
254 | vecp->i_addr = (xfs_caddr_t)&bip->bli_format; | 254 | vecp->i_addr = &bip->bli_format; |
255 | vecp->i_len = base_size; | 255 | vecp->i_len = base_size; |
256 | vecp->i_type = XLOG_REG_TYPE_BFORMAT; | 256 | vecp->i_type = XLOG_REG_TYPE_BFORMAT; |
257 | vecp++; | 257 | vecp++; |
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index 61d83c64ed32..a55e687bf562 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c | |||
@@ -82,7 +82,7 @@ xfs_efi_item_format( | |||
82 | size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t); | 82 | size += (efip->efi_format.efi_nextents - 1) * sizeof(xfs_extent_t); |
83 | efip->efi_format.efi_size = 1; | 83 | efip->efi_format.efi_size = 1; |
84 | 84 | ||
85 | log_vector->i_addr = (xfs_caddr_t)&efip->efi_format; | 85 | log_vector->i_addr = &efip->efi_format; |
86 | log_vector->i_len = size; | 86 | log_vector->i_len = size; |
87 | log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT; | 87 | log_vector->i_type = XLOG_REG_TYPE_EFI_FORMAT; |
88 | ASSERT(size >= sizeof(xfs_efi_log_format_t)); | 88 | ASSERT(size >= sizeof(xfs_efi_log_format_t)); |
@@ -244,7 +244,7 @@ xfs_efi_init( | |||
244 | int | 244 | int |
245 | xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt) | 245 | xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt) |
246 | { | 246 | { |
247 | xfs_efi_log_format_t *src_efi_fmt = (xfs_efi_log_format_t *)buf->i_addr; | 247 | xfs_efi_log_format_t *src_efi_fmt = buf->i_addr; |
248 | uint i; | 248 | uint i; |
249 | uint len = sizeof(xfs_efi_log_format_t) + | 249 | uint len = sizeof(xfs_efi_log_format_t) + |
250 | (src_efi_fmt->efi_nextents - 1) * sizeof(xfs_extent_t); | 250 | (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) | |||
257 | memcpy((char *)dst_efi_fmt, (char*)src_efi_fmt, len); | 257 | memcpy((char *)dst_efi_fmt, (char*)src_efi_fmt, len); |
258 | return 0; | 258 | return 0; |
259 | } else if (buf->i_len == len32) { | 259 | } else if (buf->i_len == len32) { |
260 | xfs_efi_log_format_32_t *src_efi_fmt_32 = | 260 | xfs_efi_log_format_32_t *src_efi_fmt_32 = buf->i_addr; |
261 | (xfs_efi_log_format_32_t *)buf->i_addr; | ||
262 | 261 | ||
263 | dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type; | 262 | dst_efi_fmt->efi_type = src_efi_fmt_32->efi_type; |
264 | dst_efi_fmt->efi_size = src_efi_fmt_32->efi_size; | 263 | 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) | |||
272 | } | 271 | } |
273 | return 0; | 272 | return 0; |
274 | } else if (buf->i_len == len64) { | 273 | } else if (buf->i_len == len64) { |
275 | xfs_efi_log_format_64_t *src_efi_fmt_64 = | 274 | xfs_efi_log_format_64_t *src_efi_fmt_64 = buf->i_addr; |
276 | (xfs_efi_log_format_64_t *)buf->i_addr; | ||
277 | 275 | ||
278 | dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type; | 276 | dst_efi_fmt->efi_type = src_efi_fmt_64->efi_type; |
279 | dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size; | 277 | dst_efi_fmt->efi_size = src_efi_fmt_64->efi_size; |
@@ -373,7 +371,7 @@ xfs_efd_item_format( | |||
373 | size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t); | 371 | size += (efdp->efd_format.efd_nextents - 1) * sizeof(xfs_extent_t); |
374 | efdp->efd_format.efd_size = 1; | 372 | efdp->efd_format.efd_size = 1; |
375 | 373 | ||
376 | log_vector->i_addr = (xfs_caddr_t)&efdp->efd_format; | 374 | log_vector->i_addr = &efdp->efd_format; |
377 | log_vector->i_len = size; | 375 | log_vector->i_len = size; |
378 | log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT; | 376 | log_vector->i_type = XLOG_REG_TYPE_EFD_FORMAT; |
379 | ASSERT(size >= sizeof(xfs_efd_log_format_t)); | 377 | ASSERT(size >= sizeof(xfs_efd_log_format_t)); |
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c index ad050c618e62..2998b2cb7466 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -217,7 +217,7 @@ xfs_inode_item_format( | |||
217 | int nrecs; | 217 | int nrecs; |
218 | xfs_mount_t *mp; | 218 | xfs_mount_t *mp; |
219 | 219 | ||
220 | vecp->i_addr = (xfs_caddr_t)&iip->ili_format; | 220 | vecp->i_addr = &iip->ili_format; |
221 | vecp->i_len = sizeof(xfs_inode_log_format_t); | 221 | vecp->i_len = sizeof(xfs_inode_log_format_t); |
222 | vecp->i_type = XLOG_REG_TYPE_IFORMAT; | 222 | vecp->i_type = XLOG_REG_TYPE_IFORMAT; |
223 | vecp++; | 223 | vecp++; |
@@ -268,7 +268,7 @@ xfs_inode_item_format( | |||
268 | */ | 268 | */ |
269 | xfs_synchronize_times(ip); | 269 | xfs_synchronize_times(ip); |
270 | 270 | ||
271 | vecp->i_addr = (xfs_caddr_t)&ip->i_d; | 271 | vecp->i_addr = &ip->i_d; |
272 | vecp->i_len = sizeof(struct xfs_icdinode); | 272 | vecp->i_len = sizeof(struct xfs_icdinode); |
273 | vecp->i_type = XLOG_REG_TYPE_ICORE; | 273 | vecp->i_type = XLOG_REG_TYPE_ICORE; |
274 | vecp++; | 274 | vecp++; |
@@ -324,8 +324,7 @@ xfs_inode_item_format( | |||
324 | * extents, so just point to the | 324 | * extents, so just point to the |
325 | * real extents array. | 325 | * real extents array. |
326 | */ | 326 | */ |
327 | vecp->i_addr = | 327 | vecp->i_addr = ip->i_df.if_u1.if_extents; |
328 | (char *)(ip->i_df.if_u1.if_extents); | ||
329 | vecp->i_len = ip->i_df.if_bytes; | 328 | vecp->i_len = ip->i_df.if_bytes; |
330 | vecp->i_type = XLOG_REG_TYPE_IEXT; | 329 | vecp->i_type = XLOG_REG_TYPE_IEXT; |
331 | } else | 330 | } else |
@@ -343,7 +342,7 @@ xfs_inode_item_format( | |||
343 | ext_buffer = kmem_alloc(ip->i_df.if_bytes, | 342 | ext_buffer = kmem_alloc(ip->i_df.if_bytes, |
344 | KM_SLEEP); | 343 | KM_SLEEP); |
345 | iip->ili_extents_buf = ext_buffer; | 344 | iip->ili_extents_buf = ext_buffer; |
346 | vecp->i_addr = (xfs_caddr_t)ext_buffer; | 345 | vecp->i_addr = ext_buffer; |
347 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, | 346 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, |
348 | XFS_DATA_FORK); | 347 | XFS_DATA_FORK); |
349 | vecp->i_type = XLOG_REG_TYPE_IEXT; | 348 | vecp->i_type = XLOG_REG_TYPE_IEXT; |
@@ -362,7 +361,7 @@ xfs_inode_item_format( | |||
362 | if (iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) { | 361 | if (iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) { |
363 | ASSERT(ip->i_df.if_broot_bytes > 0); | 362 | ASSERT(ip->i_df.if_broot_bytes > 0); |
364 | ASSERT(ip->i_df.if_broot != NULL); | 363 | ASSERT(ip->i_df.if_broot != NULL); |
365 | vecp->i_addr = (xfs_caddr_t)ip->i_df.if_broot; | 364 | vecp->i_addr = ip->i_df.if_broot; |
366 | vecp->i_len = ip->i_df.if_broot_bytes; | 365 | vecp->i_len = ip->i_df.if_broot_bytes; |
367 | vecp->i_type = XLOG_REG_TYPE_IBROOT; | 366 | vecp->i_type = XLOG_REG_TYPE_IBROOT; |
368 | vecp++; | 367 | vecp++; |
@@ -380,7 +379,7 @@ xfs_inode_item_format( | |||
380 | ASSERT(ip->i_df.if_u1.if_data != NULL); | 379 | ASSERT(ip->i_df.if_u1.if_data != NULL); |
381 | ASSERT(ip->i_d.di_size > 0); | 380 | ASSERT(ip->i_d.di_size > 0); |
382 | 381 | ||
383 | vecp->i_addr = (xfs_caddr_t)ip->i_df.if_u1.if_data; | 382 | vecp->i_addr = ip->i_df.if_u1.if_data; |
384 | /* | 383 | /* |
385 | * Round i_bytes up to a word boundary. | 384 | * Round i_bytes up to a word boundary. |
386 | * The underlying memory is guaranteed to | 385 | * The underlying memory is guaranteed to |
@@ -454,7 +453,7 @@ xfs_inode_item_format( | |||
454 | * There are not delayed allocation extents | 453 | * There are not delayed allocation extents |
455 | * for attributes, so just point at the array. | 454 | * for attributes, so just point at the array. |
456 | */ | 455 | */ |
457 | vecp->i_addr = (char *)(ip->i_afp->if_u1.if_extents); | 456 | vecp->i_addr = ip->i_afp->if_u1.if_extents; |
458 | vecp->i_len = ip->i_afp->if_bytes; | 457 | vecp->i_len = ip->i_afp->if_bytes; |
459 | #else | 458 | #else |
460 | ASSERT(iip->ili_aextents_buf == NULL); | 459 | ASSERT(iip->ili_aextents_buf == NULL); |
@@ -464,7 +463,7 @@ xfs_inode_item_format( | |||
464 | ext_buffer = kmem_alloc(ip->i_afp->if_bytes, | 463 | ext_buffer = kmem_alloc(ip->i_afp->if_bytes, |
465 | KM_SLEEP); | 464 | KM_SLEEP); |
466 | iip->ili_aextents_buf = ext_buffer; | 465 | iip->ili_aextents_buf = ext_buffer; |
467 | vecp->i_addr = (xfs_caddr_t)ext_buffer; | 466 | vecp->i_addr = ext_buffer; |
468 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, | 467 | vecp->i_len = xfs_iextents_copy(ip, ext_buffer, |
469 | XFS_ATTR_FORK); | 468 | XFS_ATTR_FORK); |
470 | #endif | 469 | #endif |
@@ -481,7 +480,7 @@ xfs_inode_item_format( | |||
481 | if (iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) { | 480 | if (iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) { |
482 | ASSERT(ip->i_afp->if_broot_bytes > 0); | 481 | ASSERT(ip->i_afp->if_broot_bytes > 0); |
483 | ASSERT(ip->i_afp->if_broot != NULL); | 482 | ASSERT(ip->i_afp->if_broot != NULL); |
484 | vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_broot; | 483 | vecp->i_addr = ip->i_afp->if_broot; |
485 | vecp->i_len = ip->i_afp->if_broot_bytes; | 484 | vecp->i_len = ip->i_afp->if_broot_bytes; |
486 | vecp->i_type = XLOG_REG_TYPE_IATTR_BROOT; | 485 | vecp->i_type = XLOG_REG_TYPE_IATTR_BROOT; |
487 | vecp++; | 486 | vecp++; |
@@ -497,7 +496,7 @@ xfs_inode_item_format( | |||
497 | ASSERT(ip->i_afp->if_bytes > 0); | 496 | ASSERT(ip->i_afp->if_bytes > 0); |
498 | ASSERT(ip->i_afp->if_u1.if_data != NULL); | 497 | ASSERT(ip->i_afp->if_u1.if_data != NULL); |
499 | 498 | ||
500 | vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_u1.if_data; | 499 | vecp->i_addr = ip->i_afp->if_u1.if_data; |
501 | /* | 500 | /* |
502 | * Round i_bytes up to a word boundary. | 501 | * Round i_bytes up to a word boundary. |
503 | * The underlying memory is guaranteed to | 502 | * The underlying memory is guaranteed to |
@@ -938,9 +937,8 @@ xfs_inode_item_format_convert( | |||
938 | xfs_inode_log_format_t *in_f) | 937 | xfs_inode_log_format_t *in_f) |
939 | { | 938 | { |
940 | if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) { | 939 | if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) { |
941 | xfs_inode_log_format_32_t *in_f32; | 940 | xfs_inode_log_format_32_t *in_f32 = buf->i_addr; |
942 | 941 | ||
943 | in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr; | ||
944 | in_f->ilf_type = in_f32->ilf_type; | 942 | in_f->ilf_type = in_f32->ilf_type; |
945 | in_f->ilf_size = in_f32->ilf_size; | 943 | in_f->ilf_size = in_f32->ilf_size; |
946 | in_f->ilf_fields = in_f32->ilf_fields; | 944 | in_f->ilf_fields = in_f32->ilf_fields; |
@@ -956,9 +954,8 @@ xfs_inode_item_format_convert( | |||
956 | in_f->ilf_boffset = in_f32->ilf_boffset; | 954 | in_f->ilf_boffset = in_f32->ilf_boffset; |
957 | return 0; | 955 | return 0; |
958 | } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){ | 956 | } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){ |
959 | xfs_inode_log_format_64_t *in_f64; | 957 | xfs_inode_log_format_64_t *in_f64 = buf->i_addr; |
960 | 958 | ||
961 | in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr; | ||
962 | in_f->ilf_type = in_f64->ilf_type; | 959 | in_f->ilf_type = in_f64->ilf_type; |
963 | in_f->ilf_size = in_f64->ilf_size; | 960 | in_f->ilf_size = in_f64->ilf_size; |
964 | in_f->ilf_fields = in_f64->ilf_fields; | 961 | in_f->ilf_fields = in_f64->ilf_fields; |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 1857c412d839..f461760c5b76 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -548,7 +548,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
548 | .magic = XLOG_UNMOUNT_TYPE, | 548 | .magic = XLOG_UNMOUNT_TYPE, |
549 | }; | 549 | }; |
550 | struct xfs_log_iovec reg = { | 550 | struct xfs_log_iovec reg = { |
551 | .i_addr = (void *)&magic, | 551 | .i_addr = &magic, |
552 | .i_len = sizeof(magic), | 552 | .i_len = sizeof(magic), |
553 | .i_type = XLOG_REG_TYPE_UNMOUNT, | 553 | .i_type = XLOG_REG_TYPE_UNMOUNT, |
554 | }; | 554 | }; |
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index 04c78e642cc8..5b72e9a40ab2 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h | |||
@@ -104,7 +104,7 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2) | |||
104 | #define XLOG_REG_TYPE_MAX 19 | 104 | #define XLOG_REG_TYPE_MAX 19 |
105 | 105 | ||
106 | typedef struct xfs_log_iovec { | 106 | typedef struct xfs_log_iovec { |
107 | xfs_caddr_t i_addr; /* beginning address of region */ | 107 | void *i_addr; /* beginning address of region */ |
108 | int i_len; /* length in bytes of region */ | 108 | int i_len; /* length in bytes of region */ |
109 | uint i_type; /* type of region */ | 109 | uint i_type; /* type of region */ |
110 | } xfs_log_iovec_t; | 110 | } xfs_log_iovec_t; |
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c index 5eaeede942b5..31e4ea2d19ac 100644 --- a/fs/xfs/xfs_log_cil.c +++ b/fs/xfs/xfs_log_cil.c | |||
@@ -552,7 +552,7 @@ xlog_cil_push( | |||
552 | thdr.th_type = XFS_TRANS_CHECKPOINT; | 552 | thdr.th_type = XFS_TRANS_CHECKPOINT; |
553 | thdr.th_tid = tic->t_tid; | 553 | thdr.th_tid = tic->t_tid; |
554 | thdr.th_num_items = num_iovecs; | 554 | thdr.th_num_items = num_iovecs; |
555 | lhdr.i_addr = (xfs_caddr_t)&thdr; | 555 | lhdr.i_addr = &thdr; |
556 | lhdr.i_len = sizeof(xfs_trans_header_t); | 556 | lhdr.i_len = sizeof(xfs_trans_header_t); |
557 | lhdr.i_type = XLOG_REG_TYPE_TRANSHDR; | 557 | lhdr.i_type = XLOG_REG_TYPE_TRANSHDR; |
558 | tic->t_curr_res -= lhdr.i_len + sizeof(xlog_op_header_t); | 558 | tic->t_curr_res -= lhdr.i_len + sizeof(xlog_op_header_t); |
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) + |