All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Mateusz Guzik <mjguzik@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Chandan Babu R <chandan.babu@oracle.com>,
	"Darrick J . Wong" <djwong@kernel.org>,
	linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 5/5] fs: Add inode_assert_locked() and inode_assert_locked_excl()
Date: Sun, 8 Oct 2023 22:05:22 +0100	[thread overview]
Message-ID: <ZSMZkuJGgHyyqDWP@casper.infradead.org> (raw)
In-Reply-To: <CAGudoHEg7oWG8CuyivWRsWLZZtw51oY0=PjLPRzFZDDZf=kzGg@mail.gmail.com>

On Sun, Oct 08, 2023 at 10:26:40PM +0200, Mateusz Guzik wrote:
> On 10/7/23, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
> > +static inline void inode_assert_locked_excl(const struct inode *inode)
> > +{
> > +	rwsem_assert_held_write(&inode->i_rwsem);
> > +}
> > +
> >  static inline void inode_lock_nested(struct inode *inode, unsigned
> > subclass)
> >  {
> >  	down_write_nested(&inode->i_rwsem, subclass);
> 
> Why "excl" instead of "write"? Apart from looking weird, it is
> inconsistent with "prior art" in the file: i_mmap_assert_write_locked.

Yes, but that pairs with i_mmap_lock_write() / i_mmap_lock_read().

The problem is that we have inode_lock() / inode_lock_shared()
inode_assert_locked_read/write doesn't make sense with them.  But
inode_assert_locked() doesn't make sense as the assertion for
inode_lock() because you'd expect it to assert whether the inode lock
is held at all.  So I went with inode_assert_locked_excl().

I wouldn't mind if we converted all the inode_lock()/shared to
inode_lock_read() / inode_lock_write(), and then added
inode_assert_read_locked() / inode_assert_write_locked().  That's
a bit of a bigger job than I want to take on today.

  reply	other threads:[~2023-10-08 21:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-07 20:35 [PATCH v2 0/5] Remove the XFS mrlock Matthew Wilcox (Oracle)
2023-10-07 20:35 ` [PATCH v2 1/5] locking: Add rwsem_assert_held() and rwsem_assert_held_write() Matthew Wilcox (Oracle)
2023-10-08 21:54   ` Dave Chinner
2023-10-07 20:35 ` [PATCH v2 2/5] mm: Use rwsem assertion macros for mmap_lock Matthew Wilcox (Oracle)
2023-10-07 20:35 ` [PATCH v2 3/5] xfs: Replace xfs_isilocked with xfs_assert_locked Matthew Wilcox (Oracle)
2023-10-08 21:59   ` Dave Chinner
2023-10-09 18:27   ` Darrick J. Wong
2023-10-07 20:35 ` [PATCH v2 4/5] xfs: Remove mrlock wrapper Matthew Wilcox (Oracle)
2023-10-08 22:17   ` Dave Chinner
2023-10-07 20:35 ` [PATCH v2 5/5] fs: Add inode_assert_locked() and inode_assert_locked_excl() Matthew Wilcox (Oracle)
2023-10-08 20:26   ` Mateusz Guzik
2023-10-08 21:05     ` Matthew Wilcox [this message]
2023-10-08 21:21       ` Mateusz Guzik
2023-10-08 20:31 ` [PATCH v2 0/5] Remove the XFS mrlock Mateusz Guzik

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=ZSMZkuJGgHyyqDWP@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=chandan.babu@oracle.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=mjguzik@gmail.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /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.