aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h65
1 files changed, 50 insertions, 15 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index bc823720d88f..f75afecef8e7 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -287,6 +287,7 @@ typedef struct xfs_inode {
287 struct xfs_inode *i_cnext; /* cluster hash link forward */ 287 struct xfs_inode *i_cnext; /* cluster hash link forward */
288 struct xfs_inode *i_cprev; /* cluster hash link backward */ 288 struct xfs_inode *i_cprev; /* cluster hash link backward */
289 289
290 xfs_fsize_t i_size; /* in-memory size */
290 /* Trace buffers per inode. */ 291 /* Trace buffers per inode. */
291#ifdef XFS_BMAP_TRACE 292#ifdef XFS_BMAP_TRACE
292 struct ktrace *i_xtrace; /* inode extent list trace */ 293 struct ktrace *i_xtrace; /* inode extent list trace */
@@ -305,6 +306,8 @@ typedef struct xfs_inode {
305#endif 306#endif
306} xfs_inode_t; 307} xfs_inode_t;
307 308
309#define XFS_ISIZE(ip) (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \
310 (ip)->i_size : (ip)->i_d.di_size;
308 311
309/* 312/*
310 * i_flags helper functions 313 * i_flags helper functions
@@ -379,26 +382,58 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
379 382
380/* 383/*
381 * Flags for inode locking. 384 * Flags for inode locking.
385 * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
386 * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
382 */ 387 */
383#define XFS_IOLOCK_EXCL 0x001 388#define XFS_IOLOCK_EXCL (1<<0)
384#define XFS_IOLOCK_SHARED 0x002 389#define XFS_IOLOCK_SHARED (1<<1)
385#define XFS_ILOCK_EXCL 0x004 390#define XFS_ILOCK_EXCL (1<<2)
386#define XFS_ILOCK_SHARED 0x008 391#define XFS_ILOCK_SHARED (1<<3)
387#define XFS_IUNLOCK_NONOTIFY 0x010 392#define XFS_IUNLOCK_NONOTIFY (1<<4)
388/* XFS_IOLOCK_NESTED 0x020 */ 393/* #define XFS_IOLOCK_NESTED (1<<5) */
389#define XFS_EXTENT_TOKEN_RD 0x040 394#define XFS_EXTENT_TOKEN_RD (1<<6)
390#define XFS_SIZE_TOKEN_RD 0x080 395#define XFS_SIZE_TOKEN_RD (1<<7)
391#define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD) 396#define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD)
392#define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */ 397#define XFS_WILLLEND (1<<8) /* Always acquire tokens for lending */
393#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND) 398#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
394#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) 399#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
395#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND) 400#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
396/* XFS_SIZE_TOKEN_WANT 0x200 */ 401/* TODO:XFS_SIZE_TOKEN_WANT (1<<9) */
397 402
398#define XFS_LOCK_MASK \ 403#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
399 (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \ 404 | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
400 XFS_ILOCK_SHARED | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD | \ 405 | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD \
401 XFS_WILLLEND) 406 | XFS_WILLLEND)
407
408/*
409 * Flags for lockdep annotations.
410 *
411 * XFS_I[O]LOCK_PARENT - for operations that require locking two inodes
412 * (ie directory operations that require locking a directory inode and
413 * an entry inode). The first inode gets locked with this flag so it
414 * gets a lockdep subclass of 1 and the second lock will have a lockdep
415 * subclass of 0.
416 *
417 * XFS_I[O]LOCK_INUMORDER - for locking several inodes at the some time
418 * with xfs_lock_inodes(). This flag is used as the starting subclass
419 * and each subsequent lock acquired will increment the subclass by one.
420 * So the first lock acquired will have a lockdep subclass of 2, the
421 * second lock will have a lockdep subclass of 3, and so on.
422 */
423#define XFS_IOLOCK_SHIFT 16
424#define XFS_IOLOCK_PARENT (1 << XFS_IOLOCK_SHIFT)
425#define XFS_IOLOCK_INUMORDER (2 << XFS_IOLOCK_SHIFT)
426
427#define XFS_ILOCK_SHIFT 24
428#define XFS_ILOCK_PARENT (1 << XFS_ILOCK_SHIFT)
429#define XFS_ILOCK_INUMORDER (2 << XFS_ILOCK_SHIFT)
430
431#define XFS_IOLOCK_DEP_MASK 0x00ff0000
432#define XFS_ILOCK_DEP_MASK 0xff000000
433#define XFS_LOCK_DEP_MASK (XFS_IOLOCK_DEP_MASK | XFS_ILOCK_DEP_MASK)
434
435#define XFS_IOLOCK_DEP(flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLOCK_SHIFT)
436#define XFS_ILOCK_DEP(flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT)
402 437
403/* 438/*
404 * Flags for xfs_iflush() 439 * Flags for xfs_iflush()
@@ -481,7 +516,7 @@ uint xfs_ip2xflags(struct xfs_inode *);
481uint xfs_dic2xflags(struct xfs_dinode_core *); 516uint xfs_dic2xflags(struct xfs_dinode_core *);
482int xfs_ifree(struct xfs_trans *, xfs_inode_t *, 517int xfs_ifree(struct xfs_trans *, xfs_inode_t *,
483 struct xfs_bmap_free *); 518 struct xfs_bmap_free *);
484void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); 519int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
485int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, 520int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
486 xfs_fsize_t, int, int); 521 xfs_fsize_t, int, int);
487int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); 522int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);