aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-01-25 04:06:21 -0500
committerAlex Elder <aelder@sgi.com>2011-02-07 14:29:18 -0500
commit9681153b460006923bb1e9d39b05b80ec09d6b4e (patch)
tree4695cb892fd54dd75910583a4002f44509dbf239 /fs
parent0d8b30ad19bf13197cbcd786e2cd5a2ecef72e68 (diff)
xfs: add lockdep annotations for the rt inodes
The rt bitmap and summary inodes do not participate in the normal inode locking protocol. Instead the rt bitmap inode can be locked in any transaction involving rt allocations, and the both of the rt inodes can be locked at the same time. Add specific lockdep subclasses for the rt inodes to prevent lockdep from blowing up. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_bmap.c2
-rw-r--r--fs/xfs/xfs_inode.h23
-rw-r--r--fs/xfs/xfs_rtalloc.c16
3 files changed, 26 insertions, 15 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 2f89af25996f..d8d090665283 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -2371,7 +2371,7 @@ xfs_bmap_rtalloc(
2371 * Lock out other modifications to the RT bitmap inode. 2371 * Lock out other modifications to the RT bitmap inode.
2372 */ 2372 */
2373 error = xfs_trans_iget(mp, ap->tp, mp->m_sb.sb_rbmino, 0, 2373 error = xfs_trans_iget(mp, ap->tp, mp->m_sb.sb_rbmino, 0,
2374 XFS_ILOCK_EXCL, &ip); 2374 XFS_ILOCK_EXCL | XFS_ILOCK_RTBITMAP, &ip);
2375 if (error) 2375 if (error)
2376 return error; 2376 return error;
2377 ASSERT(ip == mp->m_rbmip); 2377 ASSERT(ip == mp->m_rbmip);
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 5c95fa8ec11d..f753200cef8d 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -409,28 +409,35 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
409/* 409/*
410 * Flags for lockdep annotations. 410 * Flags for lockdep annotations.
411 * 411 *
412 * XFS_I[O]LOCK_PARENT - for operations that require locking two inodes 412 * XFS_LOCK_PARENT - for directory operations that require locking a
413 * (ie directory operations that require locking a directory inode and 413 * parent directory inode and a child entry inode. The parent gets locked
414 * an entry inode). The first inode gets locked with this flag so it 414 * with this flag so it gets a lockdep subclass of 1 and the child entry
415 * gets a lockdep subclass of 1 and the second lock will have a lockdep 415 * lock will have a lockdep subclass of 0.
416 * subclass of 0. 416 *
417 * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
418 * inodes do not participate in the normal lock order, and thus have their
419 * own subclasses.
417 * 420 *
418 * XFS_LOCK_INUMORDER - for locking several inodes at the some time 421 * XFS_LOCK_INUMORDER - for locking several inodes at the some time
419 * with xfs_lock_inodes(). This flag is used as the starting subclass 422 * with xfs_lock_inodes(). This flag is used as the starting subclass
420 * and each subsequent lock acquired will increment the subclass by one. 423 * and each subsequent lock acquired will increment the subclass by one.
421 * So the first lock acquired will have a lockdep subclass of 2, the 424 * So the first lock acquired will have a lockdep subclass of 4, the
422 * second lock will have a lockdep subclass of 3, and so on. It is 425 * second lock will have a lockdep subclass of 5, and so on. It is
423 * the responsibility of the class builder to shift this to the correct 426 * the responsibility of the class builder to shift this to the correct
424 * portion of the lock_mode lockdep mask. 427 * portion of the lock_mode lockdep mask.
425 */ 428 */
426#define XFS_LOCK_PARENT 1 429#define XFS_LOCK_PARENT 1
427#define XFS_LOCK_INUMORDER 2 430#define XFS_LOCK_RTBITMAP 2
431#define XFS_LOCK_RTSUM 3
432#define XFS_LOCK_INUMORDER 4
428 433
429#define XFS_IOLOCK_SHIFT 16 434#define XFS_IOLOCK_SHIFT 16
430#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT) 435#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT)
431 436
432#define XFS_ILOCK_SHIFT 24 437#define XFS_ILOCK_SHIFT 24
433#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) 438#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT)
439#define XFS_ILOCK_RTBITMAP (XFS_LOCK_RTBITMAP << XFS_ILOCK_SHIFT)
440#define XFS_ILOCK_RTSUM (XFS_LOCK_RTSUM << XFS_ILOCK_SHIFT)
434 441
435#define XFS_IOLOCK_DEP_MASK 0x00ff0000 442#define XFS_IOLOCK_DEP_MASK 0x00ff0000
436#define XFS_ILOCK_DEP_MASK 0xff000000 443#define XFS_ILOCK_DEP_MASK 0xff000000
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 037fab140242..f592ac978186 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1972,8 +1972,10 @@ xfs_growfs_rt(
1972 /* 1972 /*
1973 * Lock out other callers by grabbing the bitmap inode lock. 1973 * Lock out other callers by grabbing the bitmap inode lock.
1974 */ 1974 */
1975 if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 1975 error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
1976 XFS_ILOCK_EXCL, &ip))) 1976 XFS_ILOCK_EXCL | XFS_ILOCK_RTBITMAP,
1977 &ip);
1978 if (error)
1977 goto error_cancel; 1979 goto error_cancel;
1978 ASSERT(ip == mp->m_rbmip); 1980 ASSERT(ip == mp->m_rbmip);
1979 /* 1981 /*
@@ -1986,8 +1988,9 @@ xfs_growfs_rt(
1986 /* 1988 /*
1987 * Get the summary inode into the transaction. 1989 * Get the summary inode into the transaction.
1988 */ 1990 */
1989 if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, 1991 error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0,
1990 XFS_ILOCK_EXCL, &ip))) 1992 XFS_ILOCK_EXCL | XFS_ILOCK_RTSUM, &ip);
1993 if (error)
1991 goto error_cancel; 1994 goto error_cancel;
1992 ASSERT(ip == mp->m_rsumip); 1995 ASSERT(ip == mp->m_rsumip);
1993 /* 1996 /*
@@ -2160,8 +2163,9 @@ xfs_rtfree_extent(
2160 /* 2163 /*
2161 * Synchronize by locking the bitmap inode. 2164 * Synchronize by locking the bitmap inode.
2162 */ 2165 */
2163 if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, 2166 error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
2164 XFS_ILOCK_EXCL, &ip))) 2167 XFS_ILOCK_EXCL | XFS_ILOCK_RTBITMAP, &ip);
2168 if (error)
2165 return error; 2169 return error;
2166#if defined(__KERNEL__) && defined(DEBUG) 2170#if defined(__KERNEL__) && defined(DEBUG)
2167 /* 2171 /*