xfs: cleanup xlog_recover_do_trans
Change the big if-elsif-else block handling the different item types into a more natural switch, remove assignments in conditionals and remove an out of place comment from centuries ago on IRIX. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
dd0bbad81c
commit
ff0205e032
|
@ -2763,51 +2763,48 @@ xlog_recover_do_trans(
|
||||||
int error = 0;
|
int error = 0;
|
||||||
xlog_recover_item_t *item, *first_item;
|
xlog_recover_item_t *item, *first_item;
|
||||||
|
|
||||||
if ((error = xlog_recover_reorder_trans(trans)))
|
error = xlog_recover_reorder_trans(trans);
|
||||||
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
first_item = item = trans->r_itemq;
|
first_item = item = trans->r_itemq;
|
||||||
do {
|
do {
|
||||||
/*
|
switch (ITEM_TYPE(item)) {
|
||||||
* we don't need to worry about the block number being
|
case XFS_LI_BUF:
|
||||||
* truncated in > 1 TB buffers because in user-land,
|
error = xlog_recover_do_buffer_trans(log, item, pass);
|
||||||
* we're now n32 or 64-bit so xfs_daddr_t is 64-bits so
|
break;
|
||||||
* the blknos will get through the user-mode buffer
|
case XFS_LI_INODE:
|
||||||
* cache properly. The only bad case is o32 kernels
|
error = xlog_recover_do_inode_trans(log, item, pass);
|
||||||
* where xfs_daddr_t is 32-bits but mount will warn us
|
break;
|
||||||
* off a > 1 TB filesystem before we get here.
|
case XFS_LI_EFI:
|
||||||
*/
|
error = xlog_recover_do_efi_trans(log, item,
|
||||||
if ((ITEM_TYPE(item) == XFS_LI_BUF)) {
|
trans->r_lsn, pass);
|
||||||
if ((error = xlog_recover_do_buffer_trans(log, item,
|
break;
|
||||||
pass)))
|
case XFS_LI_EFD:
|
||||||
break;
|
|
||||||
} else if ((ITEM_TYPE(item) == XFS_LI_INODE)) {
|
|
||||||
if ((error = xlog_recover_do_inode_trans(log, item,
|
|
||||||
pass)))
|
|
||||||
break;
|
|
||||||
} else if (ITEM_TYPE(item) == XFS_LI_EFI) {
|
|
||||||
if ((error = xlog_recover_do_efi_trans(log, item, trans->r_lsn,
|
|
||||||
pass)))
|
|
||||||
break;
|
|
||||||
} else if (ITEM_TYPE(item) == XFS_LI_EFD) {
|
|
||||||
xlog_recover_do_efd_trans(log, item, pass);
|
xlog_recover_do_efd_trans(log, item, pass);
|
||||||
} else if (ITEM_TYPE(item) == XFS_LI_DQUOT) {
|
error = 0;
|
||||||
if ((error = xlog_recover_do_dquot_trans(log, item,
|
break;
|
||||||
pass)))
|
case XFS_LI_DQUOT:
|
||||||
break;
|
error = xlog_recover_do_dquot_trans(log, item, pass);
|
||||||
} else if ((ITEM_TYPE(item) == XFS_LI_QUOTAOFF)) {
|
break;
|
||||||
if ((error = xlog_recover_do_quotaoff_trans(log, item,
|
case XFS_LI_QUOTAOFF:
|
||||||
pass)))
|
error = xlog_recover_do_quotaoff_trans(log, item,
|
||||||
break;
|
pass);
|
||||||
} else {
|
break;
|
||||||
xlog_warn("XFS: xlog_recover_do_trans");
|
default:
|
||||||
|
xlog_warn(
|
||||||
|
"XFS: invalid item type (%d) xlog_recover_do_trans", ITEM_TYPE(item));
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
error = XFS_ERROR(EIO);
|
error = XFS_ERROR(EIO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
item = item->ri_next;
|
item = item->ri_next;
|
||||||
} while (first_item != item);
|
} while (first_item != item);
|
||||||
|
|
||||||
return error;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue