mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Create a generic dispatch structure to delegate recovery of different log item types into various code modules. This will enable us to move code specific to a particular log item type out of xfs_log_recover.c and into the log item source. The first operation we virtualize is the log item sorting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
96 lines
3.0 KiB
C
96 lines
3.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2000,2005 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*/
|
|
#ifndef __XFS_LOG_RECOVER_H__
|
|
#define __XFS_LOG_RECOVER_H__
|
|
|
|
/*
|
|
* Each log item type (XFS_LI_*) gets its own xlog_recover_item_ops to
|
|
* define how recovery should work for that type of log item.
|
|
*/
|
|
struct xlog_recover_item;
|
|
|
|
/* Sorting hat for log items as they're read in. */
|
|
enum xlog_recover_reorder {
|
|
XLOG_REORDER_BUFFER_LIST,
|
|
XLOG_REORDER_ITEM_LIST,
|
|
XLOG_REORDER_INODE_BUFFER_LIST,
|
|
XLOG_REORDER_CANCEL_LIST,
|
|
};
|
|
|
|
struct xlog_recover_item_ops {
|
|
uint16_t item_type; /* XFS_LI_* type code. */
|
|
|
|
/*
|
|
* Help sort recovered log items into the order required to replay them
|
|
* correctly. Log item types that always use XLOG_REORDER_ITEM_LIST do
|
|
* not have to supply a function here. See the comment preceding
|
|
* xlog_recover_reorder_trans for more details about what the return
|
|
* values mean.
|
|
*/
|
|
enum xlog_recover_reorder (*reorder)(struct xlog_recover_item *item);
|
|
};
|
|
|
|
extern const struct xlog_recover_item_ops xlog_icreate_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_buf_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_inode_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_dquot_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_quotaoff_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_bui_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_bud_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_efi_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_efd_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_rui_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_rud_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_cui_item_ops;
|
|
extern const struct xlog_recover_item_ops xlog_cud_item_ops;
|
|
|
|
/*
|
|
* Macros, structures, prototypes for internal log manager use.
|
|
*/
|
|
|
|
#define XLOG_RHASH_BITS 4
|
|
#define XLOG_RHASH_SIZE 16
|
|
#define XLOG_RHASH_SHIFT 2
|
|
#define XLOG_RHASH(tid) \
|
|
((((uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1))
|
|
|
|
#define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK / 2 + 1)
|
|
|
|
|
|
/*
|
|
* item headers are in ri_buf[0]. Additional buffers follow.
|
|
*/
|
|
struct xlog_recover_item {
|
|
struct list_head ri_list;
|
|
int ri_cnt; /* count of regions found */
|
|
int ri_total; /* total regions */
|
|
struct xfs_log_iovec *ri_buf; /* ptr to regions buffer */
|
|
const struct xlog_recover_item_ops *ri_ops;
|
|
};
|
|
|
|
struct xlog_recover {
|
|
struct hlist_node r_list;
|
|
xlog_tid_t r_log_tid; /* log's transaction id */
|
|
xfs_trans_header_t r_theader; /* trans header for partial */
|
|
int r_state; /* not needed */
|
|
xfs_lsn_t r_lsn; /* xact lsn */
|
|
struct list_head r_itemq; /* q for items */
|
|
};
|
|
|
|
#define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr)
|
|
|
|
/*
|
|
* This is the number of entries in the l_buf_cancel_table used during
|
|
* recovery.
|
|
*/
|
|
#define XLOG_BC_TABLE_SIZE 64
|
|
|
|
#define XLOG_RECOVER_CRCPASS 0
|
|
#define XLOG_RECOVER_PASS1 1
|
|
#define XLOG_RECOVER_PASS2 2
|
|
|
|
#endif /* __XFS_LOG_RECOVER_H__ */
|