> +static inline bool > +__xfs_is_ilocked( > + struct rw_semaphore *rwsem, > + bool shared, > + bool excl) This calling conventions seems odd. In other places like lockdep we just have a bool excl. This means we might get a false positive when the lock is held exclusive but only shared is asserted, but given that the low-level helpers can't give better information that isn't going to hurt. Also I'd name this function xfs_rwsem_is_locked, as there is nothing inode specific here. I also agree that this function needs good comments explaining the rationale. > +bool > +xfs_is_ilocked( > + struct xfs_inode *ip, > + int lock_flags) > +{ > + return __xfs_is_ilocked(&ip->i_lock.mr_lock, > + (lock_flags & XFS_ILOCK_SHARED), > + (lock_flags & XFS_ILOCK_EXCL)); > +} > + > +bool > +xfs_is_mmaplocked( > + struct xfs_inode *ip, > + int lock_flags) > +{ > + return __xfs_is_ilocked(&ip->i_mmaplock.mr_lock, > + (lock_flags & XFS_MMAPLOCK_SHARED), > + (lock_flags & XFS_MMAPLOCK_EXCL)); > +} > + > +bool > +xfs_is_iolocked( > + struct xfs_inode *ip, > + int lock_flags) > +{ > + return __xfs_is_ilocked(&VFS_I(ip)->i_rwsem, > + (lock_flags & XFS_IOLOCK_SHARED), > + (lock_flags & XFS_IOLOCK_EXCL)); > +} > #endif What is the benefit of these helpers? xfs_isilocked can just call __xfs_is_ilocked / xfs_rwsem_is_locked directly.