Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write the Free Software Foundation, |
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
| 18 | #ifndef __XFS_LOG_RECOVER_H__ |
| 19 | #define __XFS_LOG_RECOVER_H__ |
| 20 | |
| 21 | /* |
| 22 | * Macros, structures, prototypes for internal log manager use. |
| 23 | */ |
| 24 | |
| 25 | #define XLOG_RHASH_BITS 4 |
| 26 | #define XLOG_RHASH_SIZE 16 |
| 27 | #define XLOG_RHASH_SHIFT 2 |
| 28 | #define XLOG_RHASH(tid) \ |
| 29 | ((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1)) |
| 30 | |
Dave Chinner | c115541 | 2010-05-07 11:05:19 +1000 | [diff] [blame] | 31 | #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] | 32 | |
| 33 | |
| 34 | /* |
| 35 | * item headers are in ri_buf[0]. Additional buffers follow. |
| 36 | */ |
| 37 | typedef struct xlog_recover_item { |
Dave Chinner | f0a7695 | 2010-01-11 11:49:57 +0000 | [diff] [blame] | 38 | struct list_head ri_list; |
| 39 | int ri_type; |
| 40 | int ri_cnt; /* count of regions found */ |
| 41 | int ri_total; /* total regions */ |
| 42 | xfs_log_iovec_t *ri_buf; /* ptr to regions buffer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | } xlog_recover_item_t; |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | typedef struct xlog_recover { |
Dave Chinner | f0a7695 | 2010-01-11 11:49:57 +0000 | [diff] [blame] | 46 | struct hlist_node r_list; |
| 47 | xlog_tid_t r_log_tid; /* log's transaction id */ |
| 48 | xfs_trans_header_t r_theader; /* trans header for partial */ |
| 49 | int r_state; /* not needed */ |
| 50 | xfs_lsn_t r_lsn; /* xact lsn */ |
| 51 | struct list_head r_itemq; /* q for items */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | } xlog_recover_t; |
| 53 | |
Darrick J. Wong | 755c7bf | 2016-11-08 11:55:48 +1100 | [diff] [blame] | 54 | #define ITEM_TYPE(i) (*(unsigned short *)(i)->ri_buf[0].i_addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | /* |
| 57 | * This is the number of entries in the l_buf_cancel_table used during |
| 58 | * recovery. |
| 59 | */ |
| 60 | #define XLOG_BC_TABLE_SIZE 64 |
| 61 | |
Brian Foster | 6528250 | 2016-01-04 15:55:10 +1100 | [diff] [blame] | 62 | #define XLOG_RECOVER_CRCPASS 0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | #define XLOG_RECOVER_PASS1 1 |
| 64 | #define XLOG_RECOVER_PASS2 2 |
| 65 | |
| 66 | #endif /* __XFS_LOG_RECOVER_H__ */ |