Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 3 | * Copyright (c) 2000,2005 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | */ |
| 6 | #ifndef __XFS_LOG_RECOVER_H__ |
| 7 | #define __XFS_LOG_RECOVER_H__ |
| 8 | |
| 9 | /* |
| 10 | * Macros, structures, prototypes for internal log manager use. |
| 11 | */ |
| 12 | |
| 13 | #define XLOG_RHASH_BITS 4 |
| 14 | #define XLOG_RHASH_SIZE 16 |
| 15 | #define XLOG_RHASH_SHIFT 2 |
| 16 | #define XLOG_RHASH(tid) \ |
Darrick J. Wong | c8ce540 | 2017-06-16 11:00:05 -0700 | [diff] [blame] | 17 | ((((uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Dave Chinner | c115541 | 2010-05-07 11:05:19 +1000 | [diff] [blame] | 19 | #define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK / 2 + 1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | |
| 22 | /* |
| 23 | * item headers are in ri_buf[0]. Additional buffers follow. |
| 24 | */ |
| 25 | typedef struct xlog_recover_item { |
Dave Chinner | f0a7695 | 2010-01-11 11:49:57 +0000 | [diff] [blame] | 26 | struct list_head ri_list; |
| 27 | int ri_type; |
| 28 | int ri_cnt; /* count of regions found */ |
| 29 | int ri_total; /* total regions */ |
| 30 | xfs_log_iovec_t *ri_buf; /* ptr to regions buffer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | } xlog_recover_item_t; |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | typedef struct xlog_recover { |
Dave Chinner | f0a7695 | 2010-01-11 11:49:57 +0000 | [diff] [blame] | 34 | struct hlist_node r_list; |
| 35 | xlog_tid_t r_log_tid; /* log's transaction id */ |
| 36 | xfs_trans_header_t r_theader; /* trans header for partial */ |
| 37 | int r_state; /* not needed */ |
| 38 | xfs_lsn_t r_lsn; /* xact lsn */ |
| 39 | struct list_head r_itemq; /* q for items */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | } xlog_recover_t; |
| 41 | |
Darrick J. Wong | 755c7bf | 2016-11-08 11:55:48 +1100 | [diff] [blame] | 42 | #define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | /* |
| 45 | * This is the number of entries in the l_buf_cancel_table used during |
| 46 | * recovery. |
| 47 | */ |
| 48 | #define XLOG_BC_TABLE_SIZE 64 |
| 49 | |
Brian Foster | 6528250 | 2016-01-04 15:55:10 +1100 | [diff] [blame] | 50 | #define XLOG_RECOVER_CRCPASS 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | #define XLOG_RECOVER_PASS1 1 |
| 52 | #define XLOG_RECOVER_PASS2 2 |
| 53 | |
| 54 | #endif /* __XFS_LOG_RECOVER_H__ */ |