public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <aelder@sgi.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock
Date: Wed, 26 Oct 2011 16:07:21 -0500	[thread overview]
Message-ID: <1319663241.5239.74.camel@doink> (raw)
In-Reply-To: <20111019182420.881974453@bombadil.infradead.org>

On Wed, 2011-10-19 at 14:23 -0400, Christoph Hellwig wrote:
> plain text document attachment (xfs-kill-i_flush)
> We almost never block on i_flock, the exception is synchronous inode
> flushing.  Instead of bloating the inode with a 16/24-byte completion
> that we abuse as a semaphore just implement it as a bitlock that uses
> a bit waitqueue for the rare sleeping path.  This primarily is a
> tradeoff between a much smaller inode and a faster non-blocking
> path vs a faster faster wakeups, and we are much better off with
       vs faster wakeups
> the former.
> 
> A small downside is that we will lose lockdep checking for i_flock, but
> given that it's always taken inside the ilock that should be acceptable.
> 
> Note that for example the inode writeback locking is implemented in a
> very similar way.

Substitute "beeing" -> "being" throughout.  There's
also one thing I'd like you to check and likely fix,
below.  Otherwise looks good.

> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Alex Elder <aelder@sgi.com>

. . .

> @@ -331,6 +330,19 @@ xfs_iflags_test_and_clear(xfs_inode_t *i
>  	return ret;
>  }
>  
> +static inline int
> +xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)

i_flags is now an unsigned long (so make the
flags argument here match that type).

> +{
> +	int ret;
> +
> +	spin_lock(&ip->i_flags_lock);
> +	ret = ip->i_flags & flags;
> +	if (!ret)
> +		ip->i_flags |= flags;

Although you are now only passing in a single
flag bit, the interface doesn't preclude you
passing in multiple bits.

Therefore I think the correct logic would be:

	ret = (ip->i_flags & flags) != flags;
	if (ret)
		ip->flags |= flags;

Either that, or change the name of the "flags"
argument to better reflect that we really want
a single lock bit provided (and perhaps,
ASSERT(is_power_of_2(flags))).

> +	spin_unlock(&ip->i_flags_lock);
> +	return ret;
> +}
> +

. . .


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

  reply	other threads:[~2011-10-26 21:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 18:23 [PATCH 0/4] inode diet, part1 V2 Christoph Hellwig
2011-10-19 18:23 ` [PATCH 1/4] xfs: make i_flags and unsigned long Christoph Hellwig
2011-10-26 21:07   ` Alex Elder
2011-10-19 18:23 ` [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2011-10-26 21:07   ` Alex Elder [this message]
2011-10-19 18:23 ` [PATCH 3/4] xfs: replace i_pin_wait with a bit waitqueue Christoph Hellwig
2011-10-26 21:07   ` Alex Elder
2011-10-27 16:42     ` Christoph Hellwig
2011-10-19 18:23 ` [PATCH 4/4] xfs: remove the unused dm_attrs structure Christoph Hellwig
2011-10-26 21:07   ` Alex Elder
  -- strict thread matches above, loose matches on Subject: below --
2011-10-18 20:13 [PATCH 0/4] inode diet, part1 Christoph Hellwig
2011-10-18 20:13 ` [PATCH 2/4] xfs: replace i_flock with a sleeping bitlock Christoph Hellwig
2011-10-19  0:42   ` Dave Chinner
2011-10-19  9:01     ` Christoph Hellwig

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=1319663241.5239.74.camel@doink \
    --to=aelder@sgi.com \
    --cc=hch@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox