Commit 3403ccc0 authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner
Browse files

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 0952c818 ("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: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarEric Sandeen <sandeen@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 3d751af2
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -362,6 +362,17 @@ int xfs_lots_retries;
int xfs_lock_delays;
int xfs_lock_delays;
#endif
#endif


#ifdef CONFIG_LOCKDEP
static bool
xfs_lockdep_subclass_ok(
	int subclass)
{
	return subclass < MAX_LOCKDEP_SUBCLASSES;
}
#else
#define xfs_lockdep_subclass_ok(subclass)	(true)
#endif

/*
/*
 * Bump the subclass so xfs_lock_inodes() acquires each lock with a different
 * Bump the subclass so xfs_lock_inodes() acquires each lock with a different
 * value. This can be called for any type of inode lock combination, including
 * 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)


	ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
	ASSERT(!(lock_mode & (XFS_ILOCK_PARENT | XFS_ILOCK_RTBITMAP |
			      XFS_ILOCK_RTSUM)));
			      XFS_ILOCK_RTSUM)));
	ASSERT(xfs_lockdep_subclass_ok(subclass));


	if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) {
	if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) {
		ASSERT(subclass <= XFS_IOLOCK_MAX_SUBCLASS);
		ASSERT(subclass <= XFS_IOLOCK_MAX_SUBCLASS);
		ASSERT(subclass + XFS_IOLOCK_PARENT_VAL <
		ASSERT(xfs_lockdep_subclass_ok(subclass +
						MAX_LOCKDEP_SUBCLASSES);
						XFS_IOLOCK_PARENT_VAL));
		class += subclass << XFS_IOLOCK_SHIFT;
		class += subclass << XFS_IOLOCK_SHIFT;
		if (lock_mode & XFS_IOLOCK_PARENT)
		if (lock_mode & XFS_IOLOCK_PARENT)
			class += XFS_IOLOCK_PARENT_VAL << XFS_IOLOCK_SHIFT;
			class += XFS_IOLOCK_PARENT_VAL << XFS_IOLOCK_SHIFT;