All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: improve xfs_isilocked
Date: Sat, 29 May 2010 05:50:19 -0400	[thread overview]
Message-ID: <20100529095019.GA18859@infradead.org> (raw)
In-Reply-To: <1275075653.2302.38.camel@doink>

On Fri, May 28, 2010 at 02:40:53PM -0500, Alex Elder wrote:
> On Thu, 2010-05-27 at 15:05 -0400, Christoph Hellwig wrote:
> > Use rwsem_is_locked to make the assertations for shared locks work.
> 
> So you're changing it so it answers "yes it's locked"
> even it it's only a read lock now, right?

If XFS_ILOCK_SHARED/XFS_IOLOCK_SHARED are in the flags we'll answer yes
it's locked for a read lock now, indeed.

> Previously it was basically (once each for ilock and
> iolock):  "If the exclusive flag is set, but there is no
> writer, then it is not locked; otherwise it is."

Yes.

> Now it's "If the exclusive flag is set, but no writer,
> it's not locked.  Otherwise if the shared flag is
> set it's locked if rwsem_is_locked() says we are.
> Otherwise (ASSERT(0) and) it is not locked."

Not exactly.  Now it's:

 - if excl is set but shared isn't return true if mr_writer is
   set, else false
 - if shared is set either alone or together with excl return
   if it is locked in any way (rwsem_is_locked).

Note that xfs_isilocked can be called like:

	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));

which means that either excl or shared is fine.

 - if either one or both of excl and shared are set and it's 

> That last part is wrong I think.  It should be OK to
> call xfs_isilocked() with neither flag set, in which
> case the result should be 0.

We can argue about removing the assert, but we currently don't
and should't call xfs_isilocked wit ha 0 argument - it's rather
pointless to do so.

> And if the exclusive
> flag is set, and there *is* a writer, it *is* locked,
> so it should return 1.

We do that right now.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2010-05-29  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 19:05 [PATCH] xfs: improve xfs_isilocked Christoph Hellwig
2010-05-28 19:40 ` Alex Elder
2010-05-29  9:50   ` Christoph Hellwig [this message]
2010-06-03 16:19     ` Alex Elder

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=20100529095019.GA18859@infradead.org \
    --to=hch@infradead.org \
    --cc=aelder@sgi.com \
    --cc=xfs@oss.sgi.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.