aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-08-19 19:27:49 -0400
committerDave Chinner <david@fromorbit.com>2015-08-19 19:27:49 -0400
commit3403ccc0c9f069c40ea751a93ac6746f5ef2116a (patch)
tree0fc897b2db02e43143b46c34db01c1ef2bc2da0a
parent3d751af2cbe9a73a869986a18e865f8a34265052 (diff)
xfs: inode lockdep annotations broke non-lockdep build
Fix CONFIG_LOCKDEP=n build, because asserts I put in to ensure we aren't overrunning lockdep subclasses in commit 0952c81 ("xfs: clean up inode lockdep annotations") use a define that doesn't exist when CONFIG_LOCKDEP=n Only check the subclass limits when lockdep is actually enabled. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r--fs/xfs/xfs_inode.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 65792660b043..aa00ccc0bd78 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -362,6 +362,17 @@ int xfs_lots_retries;
362int xfs_lock_delays; 362int xfs_lock_delays;
363#endif 363#endif
364 364
365#ifdef CONFIG_LOCKDEP
366static bool
367xfs_lockdep_subclass_ok(
368 int subclass)
369{
370 return subclass < MAX_LOCKDEP_SUBCLASSES;
371}
372#else
373#define xfs_lockdep_subclass_ok(subclass) (true)
374#endif
375
365/* 376/*
366 * Bump the subclass so xfs_lock_inodes() acquires each lock with a different 377 * Bump the subclass so xfs_lock_inodes() acquires each lock with a different
367 * value. This can be called for any type of inode lock combination, including 378 * value. This can be called for any type of inode lock combination, including
@@ -375,11 +386,12 @@ xfs_lock_inumorder(int lock_mode, int subclass)
375 386
376 ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP | 387 ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
377 XFS_ILOCK_RTSUM))); 388 XFS_ILOCK_RTSUM)));
389 ASSERT(xfs_lockdep_subclass_ok(subclass));
378 390
379 if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) { 391 if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) {
380 ASSERT(subclass <= XFS_IOLOCK_MAX_SUBCLASS); 392 ASSERT(subclass <= XFS_IOLOCK_MAX_SUBCLASS);
381 ASSERT(subclass + XFS_IOLOCK_PARENT_VAL < 393 ASSERT(xfs_lockdep_subclass_ok(subclass +
382 MAX_LOCKDEP_SUBCLASSES); 394 XFS_IOLOCK_PARENT_VAL));
383 class += subclass << XFS_IOLOCK_SHIFT; 395 class += subclass << XFS_IOLOCK_SHIFT;
384 if (lock_mode & XFS_IOLOCK_PARENT) 396 if (lock_mode & XFS_IOLOCK_PARENT)
385 class += XFS_IOLOCK_PARENT_VAL << XFS_IOLOCK_SHIFT; 397 class += XFS_IOLOCK_PARENT_VAL << XFS_IOLOCK_SHIFT;