xfs_inode.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. /*
  2. * Copyright (c) 2000-2003 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_H__
  33. #define __XFS_INODE_H__
  34. /*
  35. * File incore extent information, present for each of data & attr forks.
  36. */
  37. #define XFS_INLINE_EXTS 2
  38. #define XFS_INLINE_DATA 32
  39. typedef struct xfs_ifork {
  40. int if_bytes; /* bytes in if_u1 */
  41. int if_real_bytes; /* bytes allocated in if_u1 */
  42. xfs_bmbt_block_t *if_broot; /* file's incore btree root */
  43. short if_broot_bytes; /* bytes allocated for root */
  44. unsigned char if_flags; /* per-fork flags */
  45. unsigned char if_ext_max; /* max # of extent records */
  46. xfs_extnum_t if_lastex; /* last if_extents used */
  47. union {
  48. xfs_bmbt_rec_t *if_extents; /* linear map file exts */
  49. char *if_data; /* inline file data */
  50. } if_u1;
  51. union {
  52. xfs_bmbt_rec_t if_inline_ext[XFS_INLINE_EXTS];
  53. /* very small file extents */
  54. char if_inline_data[XFS_INLINE_DATA];
  55. /* very small file data */
  56. xfs_dev_t if_rdev; /* dev number if special */
  57. uuid_t if_uuid; /* mount point value */
  58. } if_u2;
  59. } xfs_ifork_t;
  60. /*
  61. * Flags for xfs_ichgtime().
  62. */
  63. #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
  64. #define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
  65. #define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
  66. /*
  67. * Per-fork incore inode flags.
  68. */
  69. #define XFS_IFINLINE 0x0001 /* Inline data is read in */
  70. #define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */
  71. #define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */
  72. /*
  73. * Flags for xfs_imap() and xfs_dilocate().
  74. */
  75. #define XFS_IMAP_LOOKUP 0x1
  76. /*
  77. * Maximum number of extent pointers in if_u1.if_extents.
  78. */
  79. #define XFS_MAX_INCORE_EXTENTS 32768
  80. #ifdef __KERNEL__
  81. struct bhv_desc;
  82. struct cred;
  83. struct ktrace;
  84. struct vnode;
  85. struct xfs_buf;
  86. struct xfs_bmap_free;
  87. struct xfs_bmbt_irec;
  88. struct xfs_bmbt_block;
  89. struct xfs_inode;
  90. struct xfs_inode_log_item;
  91. struct xfs_mount;
  92. struct xfs_trans;
  93. struct xfs_dquot;
  94. #if defined(XFS_ILOCK_TRACE)
  95. #define XFS_ILOCK_KTRACE_SIZE 32
  96. extern ktrace_t *xfs_ilock_trace_buf;
  97. extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
  98. #else
  99. #define xfs_ilock_trace(i,n,f,ra)
  100. #endif
  101. /*
  102. * This structure is used to communicate which extents of a file
  103. * were holes when a write started from xfs_write_file() to
  104. * xfs_strat_read(). This is necessary so that we can know which
  105. * blocks need to be zeroed when they are read in in xfs_strat_read()
  106. * if they weren\'t allocated when the buffer given to xfs_strat_read()
  107. * was mapped.
  108. *
  109. * We keep a list of these attached to the inode. The list is
  110. * protected by the inode lock and the fact that the io lock is
  111. * held exclusively by writers.
  112. */
  113. typedef struct xfs_gap {
  114. struct xfs_gap *xg_next;
  115. xfs_fileoff_t xg_offset_fsb;
  116. xfs_extlen_t xg_count_fsb;
  117. } xfs_gap_t;
  118. typedef struct dm_attrs_s {
  119. __uint32_t da_dmevmask; /* DMIG event mask */
  120. __uint16_t da_dmstate; /* DMIG state info */
  121. __uint16_t da_pad; /* DMIG extra padding */
  122. } dm_attrs_t;
  123. typedef struct xfs_iocore {
  124. void *io_obj; /* pointer to container
  125. * inode or dcxvn structure */
  126. struct xfs_mount *io_mount; /* fs mount struct ptr */
  127. #ifdef DEBUG
  128. mrlock_t *io_lock; /* inode IO lock */
  129. mrlock_t *io_iolock; /* inode IO lock */
  130. #endif
  131. /* I/O state */
  132. xfs_fsize_t io_new_size; /* sz when write completes */
  133. /* Miscellaneous state. */
  134. unsigned int io_flags; /* IO related flags */
  135. /* DMAPI state */
  136. dm_attrs_t io_dmattrs;
  137. } xfs_iocore_t;
  138. #define io_dmevmask io_dmattrs.da_dmevmask
  139. #define io_dmstate io_dmattrs.da_dmstate
  140. #define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj))
  141. #define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj))
  142. /*
  143. * Flags in the flags field
  144. */
  145. #define XFS_IOCORE_RT 0x1
  146. /*
  147. * xfs_iocore prototypes
  148. */
  149. extern void xfs_iocore_inode_init(struct xfs_inode *);
  150. extern void xfs_iocore_inode_reinit(struct xfs_inode *);
  151. /*
  152. * This is the type used in the xfs inode hash table.
  153. * An array of these is allocated for each mounted
  154. * file system to hash the inodes for that file system.
  155. */
  156. typedef struct xfs_ihash {
  157. struct xfs_inode *ih_next;
  158. rwlock_t ih_lock;
  159. uint ih_version;
  160. } xfs_ihash_t;
  161. #define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)(ino)) % (mp)->m_ihsize))
  162. /*
  163. * This is the xfs inode cluster hash. This hash is used by xfs_iflush to
  164. * find inodes that share a cluster and can be flushed to disk at the same
  165. * time.
  166. */
  167. typedef struct xfs_chashlist {
  168. struct xfs_chashlist *chl_next;
  169. struct xfs_inode *chl_ip;
  170. xfs_daddr_t chl_blkno; /* starting block number of
  171. * the cluster */
  172. struct xfs_buf *chl_buf; /* the inode buffer */
  173. } xfs_chashlist_t;
  174. typedef struct xfs_chash {
  175. xfs_chashlist_t *ch_list;
  176. lock_t ch_lock;
  177. } xfs_chash_t;
  178. #define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
  179. /*
  180. * This is the xfs in-core inode structure.
  181. * Most of the on-disk inode is embedded in the i_d field.
  182. *
  183. * The extent pointers/inline file space, however, are managed
  184. * separately. The memory for this information is pointed to by
  185. * the if_u1 unions depending on the type of the data.
  186. * This is used to linearize the array of extents for fast in-core
  187. * access. This is used until the file's number of extents
  188. * surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers
  189. * are accessed through the buffer cache.
  190. *
  191. * Other state kept in the in-core inode is used for identification,
  192. * locking, transactional updating, etc of the inode.
  193. *
  194. * Generally, we do not want to hold the i_rlock while holding the
  195. * i_ilock. Hierarchy is i_iolock followed by i_rlock.
  196. *
  197. * xfs_iptr_t contains all the inode fields upto and including the
  198. * i_mnext and i_mprev fields, it is used as a marker in the inode
  199. * chain off the mount structure by xfs_sync calls.
  200. */
  201. typedef struct {
  202. struct xfs_ihash *ip_hash; /* pointer to hash header */
  203. struct xfs_inode *ip_next; /* inode hash link forw */
  204. struct xfs_inode *ip_mnext; /* next inode in mount list */
  205. struct xfs_inode *ip_mprev; /* ptr to prev inode */
  206. struct xfs_inode **ip_prevp; /* ptr to prev i_next */
  207. struct xfs_mount *ip_mount; /* fs mount struct ptr */
  208. } xfs_iptr_t;
  209. typedef struct xfs_inode {
  210. /* Inode linking and identification information. */
  211. struct xfs_ihash *i_hash; /* pointer to hash header */
  212. struct xfs_inode *i_next; /* inode hash link forw */
  213. struct xfs_inode *i_mnext; /* next inode in mount list */
  214. struct xfs_inode *i_mprev; /* ptr to prev inode */
  215. struct xfs_inode **i_prevp; /* ptr to prev i_next */
  216. struct xfs_mount *i_mount; /* fs mount struct ptr */
  217. struct list_head i_reclaim; /* reclaim list */
  218. struct bhv_desc i_bhv_desc; /* inode behavior descriptor*/
  219. struct xfs_dquot *i_udquot; /* user dquot */
  220. struct xfs_dquot *i_gdquot; /* group dquot */
  221. /* Inode location stuff */
  222. xfs_ino_t i_ino; /* inode number (agno/agino)*/
  223. xfs_daddr_t i_blkno; /* blkno of inode buffer */
  224. ushort i_len; /* len of inode buffer */
  225. ushort i_boffset; /* off of inode in buffer */
  226. /* Extent information. */
  227. xfs_ifork_t *i_afp; /* attribute fork pointer */
  228. xfs_ifork_t i_df; /* data fork */
  229. /* Transaction and locking information. */
  230. struct xfs_trans *i_transp; /* ptr to owning transaction*/
  231. struct xfs_inode_log_item *i_itemp; /* logging information */
  232. mrlock_t i_lock; /* inode lock */
  233. mrlock_t i_iolock; /* inode IO lock */
  234. sema_t i_flock; /* inode flush lock */
  235. atomic_t i_pincount; /* inode pin count */
  236. wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */
  237. #ifdef HAVE_REFCACHE
  238. struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
  239. struct xfs_inode *i_release; /* inode to unref */
  240. #endif
  241. /* I/O state */
  242. xfs_iocore_t i_iocore; /* I/O core */
  243. /* Miscellaneous state. */
  244. unsigned short i_flags; /* see defined flags below */
  245. unsigned char i_update_core; /* timestamps/size is dirty */
  246. unsigned char i_update_size; /* di_size field is dirty */
  247. unsigned int i_gen; /* generation count */
  248. unsigned int i_delayed_blks; /* count of delay alloc blks */
  249. xfs_dinode_core_t i_d; /* most of ondisk inode */
  250. xfs_chashlist_t *i_chash; /* cluster hash list header */
  251. struct xfs_inode *i_cnext; /* cluster hash link forward */
  252. struct xfs_inode *i_cprev; /* cluster hash link backward */
  253. /* Trace buffers per inode. */
  254. #ifdef XFS_BMAP_TRACE
  255. struct ktrace *i_xtrace; /* inode extent list trace */
  256. #endif
  257. #ifdef XFS_BMBT_TRACE
  258. struct ktrace *i_btrace; /* inode bmap btree trace */
  259. #endif
  260. #ifdef XFS_RW_TRACE
  261. struct ktrace *i_rwtrace; /* inode read/write trace */
  262. #endif
  263. #ifdef XFS_ILOCK_TRACE
  264. struct ktrace *i_lock_trace; /* inode lock/unlock trace */
  265. #endif
  266. #ifdef XFS_DIR2_TRACE
  267. struct ktrace *i_dir_trace; /* inode directory trace */
  268. #endif
  269. } xfs_inode_t;
  270. #endif /* __KERNEL__ */
  271. /*
  272. * Fork handling.
  273. */
  274. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR)
  275. xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w);
  276. #define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
  277. #else
  278. #define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
  279. #endif
  280. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q)
  281. int xfs_ifork_q(xfs_inode_t *ip);
  282. #define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
  283. #else
  284. #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
  285. #endif
  286. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE)
  287. int xfs_ifork_dsize(xfs_inode_t *ip);
  288. #define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
  289. #else
  290. #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
  291. #endif
  292. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE)
  293. int xfs_ifork_asize(xfs_inode_t *ip);
  294. #define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
  295. #else
  296. #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
  297. #endif
  298. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE)
  299. int xfs_ifork_size(xfs_inode_t *ip, int w);
  300. #define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
  301. #else
  302. #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
  303. #endif
  304. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT)
  305. int xfs_ifork_format(xfs_inode_t *ip, int w);
  306. #define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
  307. #else
  308. #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
  309. #endif
  310. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET)
  311. void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n);
  312. #define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
  313. #else
  314. #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
  315. #endif
  316. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS)
  317. int xfs_ifork_nextents(xfs_inode_t *ip, int w);
  318. #define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
  319. #else
  320. #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
  321. #endif
  322. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET)
  323. void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
  324. #define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
  325. #else
  326. #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
  327. #endif
  328. #ifdef __KERNEL__
  329. /*
  330. * In-core inode flags.
  331. */
  332. #define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */
  333. #define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */
  334. #define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */
  335. #define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */
  336. #define XFS_ISTALE 0x0010 /* inode has been staled */
  337. #define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
  338. #define XFS_INEW 0x0040
  339. /*
  340. * Flags for inode locking.
  341. */
  342. #define XFS_IOLOCK_EXCL 0x001
  343. #define XFS_IOLOCK_SHARED 0x002
  344. #define XFS_ILOCK_EXCL 0x004
  345. #define XFS_ILOCK_SHARED 0x008
  346. #define XFS_IUNLOCK_NONOTIFY 0x010
  347. #define XFS_EXTENT_TOKEN_RD 0x040
  348. #define XFS_SIZE_TOKEN_RD 0x080
  349. #define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD)
  350. #define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */
  351. #define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
  352. #define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
  353. #define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
  354. #define XFS_LOCK_MASK \
  355. (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \
  356. XFS_ILOCK_SHARED | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD | \
  357. XFS_WILLLEND)
  358. /*
  359. * Flags for xfs_iflush()
  360. */
  361. #define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
  362. #define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
  363. #define XFS_IFLUSH_SYNC 3
  364. #define XFS_IFLUSH_ASYNC 4
  365. #define XFS_IFLUSH_DELWRI 5
  366. /*
  367. * Flags for xfs_itruncate_start().
  368. */
  369. #define XFS_ITRUNC_DEFINITE 0x1
  370. #define XFS_ITRUNC_MAYBE 0x2
  371. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
  372. struct vnode *xfs_itov(xfs_inode_t *ip);
  373. #define XFS_ITOV(ip) xfs_itov(ip)
  374. #else
  375. #define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
  376. #endif
  377. #define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
  378. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV)
  379. struct bhv_desc *xfs_itobhv(xfs_inode_t *ip);
  380. #define XFS_ITOBHV(ip) xfs_itobhv(ip)
  381. #else
  382. #define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
  383. #endif
  384. #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI)
  385. xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
  386. #define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
  387. #else
  388. #define XFS_BHVTOI(bhvp) \
  389. ((xfs_inode_t *)((char *)(bhvp) - \
  390. (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
  391. #endif
  392. #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
  393. /*
  394. * For multiple groups support: if S_ISGID bit is set in the parent
  395. * directory, group of new file is set to that of the parent, and
  396. * new subdirectory gets S_ISGID bit from parent.
  397. */
  398. #define XFS_INHERIT_GID(pip, vfsp) \
  399. (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & S_ISGID))
  400. /*
  401. * xfs_iget.c prototypes.
  402. */
  403. #define IGET_CREATE 1
  404. void xfs_ihash_init(struct xfs_mount *);
  405. void xfs_ihash_free(struct xfs_mount *);
  406. void xfs_chash_init(struct xfs_mount *);
  407. void xfs_chash_free(struct xfs_mount *);
  408. xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
  409. struct xfs_trans *);
  410. void xfs_inode_lock_init(xfs_inode_t *, struct vnode *);
  411. int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
  412. uint, uint, xfs_inode_t **, xfs_daddr_t);
  413. void xfs_iput(xfs_inode_t *, uint);
  414. void xfs_iput_new(xfs_inode_t *, uint);
  415. void xfs_ilock(xfs_inode_t *, uint);
  416. int xfs_ilock_nowait(xfs_inode_t *, uint);
  417. void xfs_iunlock(xfs_inode_t *, uint);
  418. void xfs_ilock_demote(xfs_inode_t *, uint);
  419. void xfs_iflock(xfs_inode_t *);
  420. int xfs_iflock_nowait(xfs_inode_t *);
  421. uint xfs_ilock_map_shared(xfs_inode_t *);
  422. void xfs_iunlock_map_shared(xfs_inode_t *, uint);
  423. void xfs_ifunlock(xfs_inode_t *);
  424. void xfs_ireclaim(xfs_inode_t *);
  425. int xfs_finish_reclaim(xfs_inode_t *, int, int);
  426. int xfs_finish_reclaim_all(struct xfs_mount *, int);
  427. /*
  428. * xfs_inode.c prototypes.
  429. */
  430. int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
  431. xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **,
  432. xfs_daddr_t);
  433. int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
  434. xfs_inode_t **, xfs_daddr_t);
  435. int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
  436. int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
  437. xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
  438. int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
  439. void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *,
  440. int);
  441. uint xfs_ip2xflags(struct xfs_inode *);
  442. uint xfs_dic2xflags(struct xfs_dinode_core *);
  443. int xfs_ifree(struct xfs_trans *, xfs_inode_t *,
  444. struct xfs_bmap_free *);
  445. void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
  446. int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
  447. xfs_fsize_t, int, int);
  448. int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
  449. int xfs_igrow_start(xfs_inode_t *, xfs_fsize_t, struct cred *);
  450. void xfs_igrow_finish(struct xfs_trans *, xfs_inode_t *,
  451. xfs_fsize_t, int);
  452. void xfs_idestroy_fork(xfs_inode_t *, int);
  453. void xfs_idestroy(xfs_inode_t *);
  454. void xfs_idata_realloc(xfs_inode_t *, int, int);
  455. void xfs_iextract(xfs_inode_t *);
  456. void xfs_iext_realloc(xfs_inode_t *, int, int);
  457. void xfs_iroot_realloc(xfs_inode_t *, int, int);
  458. void xfs_ipin(xfs_inode_t *);
  459. void xfs_iunpin(xfs_inode_t *);
  460. int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
  461. int xfs_iflush(xfs_inode_t *, uint);
  462. void xfs_iflush_all(struct xfs_mount *);
  463. int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
  464. uint xfs_iroundup(uint);
  465. void xfs_ichgtime(xfs_inode_t *, int);
  466. xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
  467. void xfs_lock_inodes(xfs_inode_t **, int, int, uint);
  468. #define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
  469. #ifdef DEBUG
  470. void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t);
  471. #else /* DEBUG */
  472. #define xfs_isize_check(mp, ip, isize)
  473. #endif /* DEBUG */
  474. #if defined(DEBUG)
  475. void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
  476. #else
  477. #define xfs_inobp_check(mp, bp)
  478. #endif /* DEBUG */
  479. extern struct kmem_zone *xfs_chashlist_zone;
  480. extern struct kmem_zone *xfs_ifork_zone;
  481. extern struct kmem_zone *xfs_inode_zone;
  482. extern struct kmem_zone *xfs_ili_zone;
  483. extern struct vnodeops xfs_vnodeops;
  484. #endif /* __KERNEL__ */
  485. #endif /* __XFS_INODE_H__ */