0001
0002
0003
0004
0005
0006 #ifndef __XFS_LOG_RECOVER_H__
0007 #define __XFS_LOG_RECOVER_H__
0008
0009
0010
0011
0012
0013 struct xlog_recover_item;
0014
0015
0016 enum xlog_recover_reorder {
0017 XLOG_REORDER_BUFFER_LIST,
0018 XLOG_REORDER_ITEM_LIST,
0019 XLOG_REORDER_INODE_BUFFER_LIST,
0020 XLOG_REORDER_CANCEL_LIST,
0021 };
0022
0023 struct xlog_recover_item_ops {
0024 uint16_t item_type;
0025
0026
0027
0028
0029
0030
0031
0032
0033 enum xlog_recover_reorder (*reorder)(struct xlog_recover_item *item);
0034
0035
0036 void (*ra_pass2)(struct xlog *log, struct xlog_recover_item *item);
0037
0038
0039 int (*commit_pass1)(struct xlog *log, struct xlog_recover_item *item);
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058 int (*commit_pass2)(struct xlog *log, struct list_head *buffer_list,
0059 struct xlog_recover_item *item, xfs_lsn_t lsn);
0060 };
0061
0062 extern const struct xlog_recover_item_ops xlog_icreate_item_ops;
0063 extern const struct xlog_recover_item_ops xlog_buf_item_ops;
0064 extern const struct xlog_recover_item_ops xlog_inode_item_ops;
0065 extern const struct xlog_recover_item_ops xlog_dquot_item_ops;
0066 extern const struct xlog_recover_item_ops xlog_quotaoff_item_ops;
0067 extern const struct xlog_recover_item_ops xlog_bui_item_ops;
0068 extern const struct xlog_recover_item_ops xlog_bud_item_ops;
0069 extern const struct xlog_recover_item_ops xlog_efi_item_ops;
0070 extern const struct xlog_recover_item_ops xlog_efd_item_ops;
0071 extern const struct xlog_recover_item_ops xlog_rui_item_ops;
0072 extern const struct xlog_recover_item_ops xlog_rud_item_ops;
0073 extern const struct xlog_recover_item_ops xlog_cui_item_ops;
0074 extern const struct xlog_recover_item_ops xlog_cud_item_ops;
0075 extern const struct xlog_recover_item_ops xlog_attri_item_ops;
0076 extern const struct xlog_recover_item_ops xlog_attrd_item_ops;
0077
0078
0079
0080
0081
0082 #define XLOG_RHASH_BITS 4
0083 #define XLOG_RHASH_SIZE 16
0084 #define XLOG_RHASH_SHIFT 2
0085 #define XLOG_RHASH(tid) \
0086 ((((uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1))
0087
0088 #define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK / 2 + 1)
0089
0090
0091
0092
0093
0094 struct xlog_recover_item {
0095 struct list_head ri_list;
0096 int ri_cnt;
0097 int ri_total;
0098 struct xfs_log_iovec *ri_buf;
0099 const struct xlog_recover_item_ops *ri_ops;
0100 };
0101
0102 struct xlog_recover {
0103 struct hlist_node r_list;
0104 xlog_tid_t r_log_tid;
0105 xfs_trans_header_t r_theader;
0106 int r_state;
0107 xfs_lsn_t r_lsn;
0108 struct list_head r_itemq;
0109 };
0110
0111 #define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr)
0112
0113 #define XLOG_RECOVER_CRCPASS 0
0114 #define XLOG_RECOVER_PASS1 1
0115 #define XLOG_RECOVER_PASS2 2
0116
0117 void xlog_buf_readahead(struct xlog *log, xfs_daddr_t blkno, uint len,
0118 const struct xfs_buf_ops *ops);
0119 bool xlog_is_buffer_cancelled(struct xlog *log, xfs_daddr_t blkno, uint len);
0120
0121 int xlog_recover_iget(struct xfs_mount *mp, xfs_ino_t ino,
0122 struct xfs_inode **ipp);
0123 void xlog_recover_release_intent(struct xlog *log, unsigned short intent_type,
0124 uint64_t intent_id);
0125 int xlog_alloc_buf_cancel_table(struct xlog *log);
0126 void xlog_free_buf_cancel_table(struct xlog *log);
0127
0128 #ifdef DEBUG
0129 void xlog_check_buf_cancel_table(struct xlog *log);
0130 #else
0131 #define xlog_check_buf_cancel_table(log) do { } while (0)
0132 #endif
0133
0134 #endif