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