aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@sgi.com>2007-05-07 23:50:19 -0400
committerTim Shimmin <tes@sgi.com>2007-05-07 23:50:19 -0400
commitf7c66ce3f70d8417de0cfb481ca4e5430382ec5d (patch)
treec9b4d5cb09a9241cb305532edfbd703cd181530d /fs/xfs/xfs_inode.h
parent71dfd5a396d11512aa6c8ed0d35b268bc084bb9b (diff)
[XFS] Add lockdep support for XFS
SGI-PV: 963965 SGI-Modid: xfs-linux-melb:xfs-kern:28485a Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h60
1 files changed, 46 insertions, 14 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index cfe7b58c4533..f75afecef8e7 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -382,26 +382,58 @@ xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
382 382
383/* 383/*
384 * 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)
385 */ 387 */
386#define XFS_IOLOCK_EXCL 0x001 388#define XFS_IOLOCK_EXCL (1<<0)
387#define XFS_IOLOCK_SHARED 0x002 389#define XFS_IOLOCK_SHARED (1<<1)
388#define XFS_ILOCK_EXCL 0x004 390#define XFS_ILOCK_EXCL (1<<2)
389#define XFS_ILOCK_SHARED 0x008 391#define XFS_ILOCK_SHARED (1<<3)
390#define XFS_IUNLOCK_NONOTIFY 0x010 392#define XFS_IUNLOCK_NONOTIFY (1<<4)
391/* XFS_IOLOCK_NESTED 0x020 */ 393/* #define XFS_IOLOCK_NESTED (1<<5) */
392#define XFS_EXTENT_TOKEN_RD 0x040 394#define XFS_EXTENT_TOKEN_RD (1<<6)
393#define XFS_SIZE_TOKEN_RD 0x080 395#define XFS_SIZE_TOKEN_RD (1<<7)
394#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)
395#define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */ 397#define XFS_WILLLEND (1<<8) /* Always acquire tokens for lending */
396#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND) 398#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
397#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) 399#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
398#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND) 400#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
399/* XFS_SIZE_TOKEN_WANT 0x200 */ 401/* TODO:XFS_SIZE_TOKEN_WANT (1<<9) */
400 402
401#define XFS_LOCK_MASK \ 403#define XFS_LOCK_MASK (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
402 (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \ 404 | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
403 XFS_ILOCK_SHARED | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD | \ 405 | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD \
404 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)
405 437
406/* 438/*
407 * Flags for xfs_iflush() 439 * Flags for xfs_iflush()