xfs_log_recover.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (c) 2000,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  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
  7. * published by the Free Software Foundation.
  8. *
  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.
  13. *
  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
  17. */
  18. #ifndef __XFS_LOG_RECOVER_H__
  19. #define __XFS_LOG_RECOVER_H__
  20. /*
  21. * Macros, structures, prototypes for internal log manager use.
  22. */
  23. #define XLOG_RHASH_BITS 4
  24. #define XLOG_RHASH_SIZE 16
  25. #define XLOG_RHASH_SHIFT 2
  26. #define XLOG_RHASH(tid) \
  27. ((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1))
  28. #define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK / 2 + 1)
  29. /*
  30. * item headers are in ri_buf[0]. Additional buffers follow.
  31. */
  32. typedef struct xlog_recover_item {
  33. struct xlog_recover_item *ri_next;
  34. struct xlog_recover_item *ri_prev;
  35. int ri_type;
  36. int ri_cnt; /* count of regions found */
  37. int ri_total; /* total regions */
  38. xfs_log_iovec_t *ri_buf; /* ptr to regions buffer */
  39. } xlog_recover_item_t;
  40. struct xlog_tid;
  41. typedef struct xlog_recover {
  42. struct xlog_recover *r_next;
  43. xlog_tid_t r_log_tid; /* log's transaction id */
  44. xfs_trans_header_t r_theader; /* trans header for partial */
  45. int r_state; /* not needed */
  46. xfs_lsn_t r_lsn; /* xact lsn */
  47. xlog_recover_item_t *r_itemq; /* q for items */
  48. } xlog_recover_t;
  49. #define ITEM_TYPE(i) (*(ushort *)(i)->ri_buf[0].i_addr)
  50. /*
  51. * This is the number of entries in the l_buf_cancel_table used during
  52. * recovery.
  53. */
  54. #define XLOG_BC_TABLE_SIZE 64
  55. #define XLOG_RECOVER_PASS1 1
  56. #define XLOG_RECOVER_PASS2 2
  57. #endif /* __XFS_LOG_RECOVER_H__ */