xfs_inode_item.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /*
  2. * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. #ifndef __XFS_INODE_ITEM_H__
  33. #define __XFS_INODE_ITEM_H__
  34. /*
  35. * This is the structure used to lay out an inode log item in the
  36. * log. The size of the inline data/extents/b-tree root to be logged
  37. * (if any) is indicated in the ilf_dsize field. Changes to this structure
  38. * must be added on to the end.
  39. *
  40. * Convention for naming inode log item versions : The current version
  41. * is always named XFS_LI_INODE. When an inode log item gets superseded,
  42. * add the latest version of IRIX that will generate logs with that item
  43. * to the version name.
  44. *
  45. * -Version 1 of this structure (XFS_LI_5_3_INODE) included up to the first
  46. * union (ilf_u) field. This was released with IRIX 5.3-XFS.
  47. * -Version 2 of this structure (XFS_LI_6_1_INODE) is currently the entire
  48. * structure. This was released with IRIX 6.0.1-XFS and IRIX 6.1.
  49. * -Version 3 of this structure (XFS_LI_INODE) is the same as version 2
  50. * so a new structure definition wasn't necessary. However, we had
  51. * to add a new type because the inode cluster size changed from 4K
  52. * to 8K and the version number had to be rev'ved to keep older kernels
  53. * from trying to recover logs with the 8K buffers in them. The logging
  54. * code can handle recovery on different-sized clusters now so hopefully
  55. * this'll be the last time we need to change the inode log item just
  56. * for a change in the inode cluster size. This new version was
  57. * released with IRIX 6.2.
  58. */
  59. typedef struct xfs_inode_log_format {
  60. unsigned short ilf_type; /* inode log item type */
  61. unsigned short ilf_size; /* size of this item */
  62. uint ilf_fields; /* flags for fields logged */
  63. ushort ilf_asize; /* size of attr d/ext/root */
  64. ushort ilf_dsize; /* size of data/ext/root */
  65. xfs_ino_t ilf_ino; /* inode number */
  66. union {
  67. xfs_dev_t ilfu_rdev; /* rdev value for dev inode*/
  68. uuid_t ilfu_uuid; /* mount point value */
  69. } ilf_u;
  70. __int64_t ilf_blkno; /* blkno of inode buffer */
  71. int ilf_len; /* len of inode buffer */
  72. int ilf_boffset; /* off of inode in buffer */
  73. } xfs_inode_log_format_t;
  74. /* Initial version shipped with IRIX 5.3-XFS */
  75. typedef struct xfs_inode_log_format_v1 {
  76. unsigned short ilf_type; /* inode log item type */
  77. unsigned short ilf_size; /* size of this item */
  78. uint ilf_fields; /* flags for fields logged */
  79. uint ilf_dsize; /* size of data/ext/root */
  80. xfs_ino_t ilf_ino; /* inode number */
  81. union {
  82. xfs_dev_t ilfu_rdev; /* rdev value for dev inode*/
  83. uuid_t ilfu_uuid; /* mount point value */
  84. } ilf_u;
  85. } xfs_inode_log_format_t_v1;
  86. /*
  87. * Flags for xfs_trans_log_inode flags field.
  88. */
  89. #define XFS_ILOG_CORE 0x001 /* log standard inode fields */
  90. #define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */
  91. #define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */
  92. #define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */
  93. #define XFS_ILOG_DEV 0x010 /* log the dev field */
  94. #define XFS_ILOG_UUID 0x020 /* log the uuid field */
  95. #define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */
  96. #define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */
  97. #define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */
  98. #define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
  99. XFS_ILOG_DBROOT | XFS_ILOG_DEV | \
  100. XFS_ILOG_UUID | XFS_ILOG_ADATA | \
  101. XFS_ILOG_AEXT | XFS_ILOG_ABROOT)
  102. #define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \
  103. XFS_ILOG_DBROOT)
  104. #define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
  105. XFS_ILOG_ABROOT)
  106. #define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \
  107. XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \
  108. XFS_ILOG_DEV | XFS_ILOG_UUID | \
  109. XFS_ILOG_ADATA | XFS_ILOG_AEXT | \
  110. XFS_ILOG_ABROOT)
  111. #define XFS_ILI_HOLD 0x1
  112. #define XFS_ILI_IOLOCKED_EXCL 0x2
  113. #define XFS_ILI_IOLOCKED_SHARED 0x4
  114. #define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
  115. #ifdef __KERNEL__
  116. struct xfs_buf;
  117. struct xfs_bmbt_rec_64;
  118. struct xfs_inode;
  119. struct xfs_mount;
  120. typedef struct xfs_inode_log_item {
  121. xfs_log_item_t ili_item; /* common portion */
  122. struct xfs_inode *ili_inode; /* inode ptr */
  123. xfs_lsn_t ili_flush_lsn; /* lsn at last flush */
  124. xfs_lsn_t ili_last_lsn; /* lsn at last transaction */
  125. unsigned short ili_ilock_recur; /* lock recursion count */
  126. unsigned short ili_iolock_recur; /* lock recursion count */
  127. unsigned short ili_flags; /* misc flags */
  128. unsigned short ili_logged; /* flushed logged data */
  129. unsigned int ili_last_fields; /* fields when flushed */
  130. struct xfs_bmbt_rec_64 *ili_extents_buf; /* array of logged
  131. data exts */
  132. struct xfs_bmbt_rec_64 *ili_aextents_buf; /* array of logged
  133. attr exts */
  134. unsigned int ili_pushbuf_flag; /* one bit used in push_ail */
  135. #ifdef DEBUG
  136. uint64_t ili_push_owner; /* one who sets pushbuf_flag
  137. above gets to push the buf */
  138. #endif
  139. #ifdef XFS_TRANS_DEBUG
  140. int ili_root_size;
  141. char *ili_orig_root;
  142. #endif
  143. xfs_inode_log_format_t ili_format; /* logged structure */
  144. } xfs_inode_log_item_t;
  145. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FDATA)
  146. int xfs_ilog_fdata(int w);
  147. #define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
  148. #else
  149. #define XFS_ILOG_FDATA(w) \
  150. ((w) == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA)
  151. #endif
  152. #endif /* __KERNEL__ */
  153. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FBROOT)
  154. int xfs_ilog_fbroot(int w);
  155. #define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
  156. #else
  157. #define XFS_ILOG_FBROOT(w) \
  158. ((w) == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT)
  159. #endif
  160. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ILOG_FEXT)
  161. int xfs_ilog_fext(int w);
  162. #define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
  163. #else
  164. #define XFS_ILOG_FEXT(w) \
  165. ((w) == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT)
  166. #endif
  167. #ifdef __KERNEL__
  168. void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
  169. void xfs_inode_item_destroy(struct xfs_inode *);
  170. void xfs_iflush_done(struct xfs_buf *, xfs_inode_log_item_t *);
  171. void xfs_istale_done(struct xfs_buf *, xfs_inode_log_item_t *);
  172. void xfs_iflush_abort(struct xfs_inode *);
  173. #endif /* __KERNEL__ */
  174. #endif /* __XFS_INODE_ITEM_H__ */