diff options
author | Christoph Hellwig <hch@lst.de> | 2009-03-16 03:20:52 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-03-16 03:20:52 -0400 |
commit | ff0205e032b9733bb634ad5dadc79a0f6d30c721 (patch) | |
tree | c6ce6d61960173d6aee9af8071d618e48460318c /fs | |
parent | dd0bbad81c8d02315a5035d3d6ea441dd1254dc1 (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index ac47c5f2bcfa..73584444c194 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2763,51 +2763,48 @@ xlog_recover_do_trans( | |||
2763 | int error = 0; | 2763 | int error = 0; |
2764 | xlog_recover_item_t *item, *first_item; | 2764 | xlog_recover_item_t *item, *first_item; |
2765 | 2765 | ||
2766 | if ((error = xlog_recover_reorder_trans(trans))) | 2766 | error = xlog_recover_reorder_trans(trans); |
2767 | if (error) | ||
2767 | return error; | 2768 | return error; |
2769 | |||
2768 | first_item = item = trans->r_itemq; | 2770 | first_item = item = trans->r_itemq; |
2769 | do { | 2771 | do { |
2770 | /* | 2772 | switch (ITEM_TYPE(item)) { |
2771 | * we don't need to worry about the block number being | 2773 | case XFS_LI_BUF: |
2772 | * truncated in > 1 TB buffers because in user-land, | 2774 | error = xlog_recover_do_buffer_trans(log, item, pass); |
2773 | * we're now n32 or 64-bit so xfs_daddr_t is 64-bits so | 2775 | break; |
2774 | * the blknos will get through the user-mode buffer | 2776 | case XFS_LI_INODE: |
2775 | * cache properly. The only bad case is o32 kernels | 2777 | error = xlog_recover_do_inode_trans(log, item, pass); |
2776 | * where xfs_daddr_t is 32-bits but mount will warn us | 2778 | break; |
2777 | * off a > 1 TB filesystem before we get here. | 2779 | case XFS_LI_EFI: |
2778 | */ | 2780 | error = xlog_recover_do_efi_trans(log, item, |
2779 | if ((ITEM_TYPE(item) == XFS_LI_BUF)) { | 2781 | trans->r_lsn, pass); |
2780 | if ((error = xlog_recover_do_buffer_trans(log, item, | 2782 | break; |
2781 | pass))) | 2783 | case XFS_LI_EFD: |
2782 | break; | ||
2783 | } else if ((ITEM_TYPE(item) == XFS_LI_INODE)) { | ||
2784 | if ((error = xlog_recover_do_inode_trans(log, item, | ||
2785 | pass))) | ||
2786 | break; | ||
2787 | } else if (ITEM_TYPE(item) == XFS_LI_EFI) { | ||
2788 | if ((error = xlog_recover_do_efi_trans(log, item, trans->r_lsn, | ||
2789 | pass))) | ||
2790 | break; | ||
2791 | } else if (ITEM_TYPE(item) == XFS_LI_EFD) { | ||
2792 | xlog_recover_do_efd_trans(log, item, pass); | 2784 | xlog_recover_do_efd_trans(log, item, pass); |
2793 | } else if (ITEM_TYPE(item) == XFS_LI_DQUOT) { | 2785 | error = 0; |
2794 | if ((error = xlog_recover_do_dquot_trans(log, item, | 2786 | break; |
2795 | pass))) | 2787 | case XFS_LI_DQUOT: |
2796 | break; | 2788 | error = xlog_recover_do_dquot_trans(log, item, pass); |
2797 | } else if ((ITEM_TYPE(item) == XFS_LI_QUOTAOFF)) { | 2789 | break; |
2798 | if ((error = xlog_recover_do_quotaoff_trans(log, item, | 2790 | case XFS_LI_QUOTAOFF: |
2799 | pass))) | 2791 | error = xlog_recover_do_quotaoff_trans(log, item, |
2800 | break; | 2792 | pass); |
2801 | } else { | 2793 | break; |
2802 | xlog_warn("XFS: xlog_recover_do_trans"); | 2794 | default: |
2795 | xlog_warn( | ||
2796 | "XFS: invalid item type (%d) xlog_recover_do_trans", ITEM_TYPE(item)); | ||
2803 | ASSERT(0); | 2797 | ASSERT(0); |
2804 | error = XFS_ERROR(EIO); | 2798 | error = XFS_ERROR(EIO); |
2805 | break; | 2799 | break; |
2806 | } | 2800 | } |
2801 | |||
2802 | if (error) | ||
2803 | return error; | ||
2807 | item = item->ri_next; | 2804 | item = item->ri_next; |
2808 | } while (first_item != item); | 2805 | } while (first_item != item); |
2809 | 2806 | ||
2810 | return error; | 2807 | return 0; |
2811 | } | 2808 | } |
2812 | 2809 | ||
2813 | /* | 2810 | /* |