All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Pavel Reichl <preichl@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/4] xfs: change xfs_isilocked() to always use lockdep()
Date: Tue, 28 Jan 2020 08:42:00 -0800	[thread overview]
Message-ID: <20200128164200.GP3447196@magnolia> (raw)
In-Reply-To: <20200128145528.2093039-2-preichl@redhat.com>

On Tue, Jan 28, 2020 at 03:55:25PM +0100, Pavel Reichl wrote:
> mr_writer is obsolete and the information it contains is accesible
> from mr_lock.
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> ---
>  fs/xfs/xfs_inode.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index c5077e6326c7..32fac6152dc3 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -352,13 +352,17 @@ xfs_isilocked(
>  {
>  	if (lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) {
>  		if (!(lock_flags & XFS_ILOCK_SHARED))
> -			return !!ip->i_lock.mr_writer;
> +			return !debug_locks ||
> +				lockdep_is_held_type(&ip->i_lock.mr_lock, 0);

Why do we reference debug_locks here directly?  It looks as though that
variable exists to shut up lockdep assertions WARN_ONs, but
xfs_isilocked is a predicate (and not itself an assertion), so why can't
we 'return lockdep_is_held_type(...);' directly?

(He says scowling at his own RVB in 6552321831dce).

--D

>  		return rwsem_is_locked(&ip->i_lock.mr_lock);
>  	}
>  
>  	if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) {
>  		if (!(lock_flags & XFS_MMAPLOCK_SHARED))
> -			return !!ip->i_mmaplock.mr_writer;
> +			return !debug_locks ||
> +				lockdep_is_held_type(
> +					&ip->i_mmaplock.mr_lock,
> +					0);
>  		return rwsem_is_locked(&ip->i_mmaplock.mr_lock);
>  	}
>  
> -- 
> 2.24.1
> 

  reply	other threads:[~2020-01-28 16:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 14:55 [PATCH 0/4] xfs: Remove wrappers for some semaphores Pavel Reichl
2020-01-28 14:55 ` [PATCH 1/4] xfs: change xfs_isilocked() to always use lockdep() Pavel Reichl
2020-01-28 16:42   ` Darrick J. Wong [this message]
2020-01-28 16:50     ` Pavel Reichl
2020-01-28 18:00     ` Eric Sandeen
2020-01-28 23:02     ` Dave Chinner
2020-01-29 22:18   ` Dave Chinner
2020-01-29 22:25     ` Darrick J. Wong
2020-01-29 23:20       ` Dave Chinner
2020-01-30  7:44     ` Christoph Hellwig
2020-01-30 20:14       ` Dave Chinner
2020-01-30 20:27         ` Bill O'Donnell
2020-01-28 14:55 ` [PATCH 2/4] xfs: Remove mr_writer field from mrlock_t Pavel Reichl
2020-01-28 14:55 ` [PATCH 3/4] xfs: Make i_lock and i_mmap native rwsems Pavel Reichl
2020-01-28 14:55 ` [PATCH 4/4] xfs: replace mr*() functions with native rwsem calls Pavel Reichl
2020-01-28 16:44   ` Darrick J. Wong
2020-01-30  7:45   ` Christoph Hellwig
2020-01-30  8:57     ` Pavel Reichl
2020-01-30 13:31       ` Christoph Hellwig
2020-01-30 13:43         ` Pavel Reichl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200128164200.GP3447196@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=preichl@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.