From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] xfs: push stale, pinned buffers on trylock failures
Date: Thu, 25 Nov 2010 11:23:20 +1100 [thread overview]
Message-ID: <20101125002319.GA12187@dastard> (raw)
In-Reply-To: <20101124172051.GA32129@infradead.org>
On Wed, Nov 24, 2010 at 12:20:51PM -0500, Christoph Hellwig wrote:
> > - /* Attempt to get the semaphore without sleeping,
> > - * if this does not work then we need to drop the
> > - * spinlock and do a hard attempt on the semaphore.
> > + /*
> > + * Attempt to get the semaphore without sleeping first. if we fail then
> > + * do a blocking lock if requested.
> > */
>
> You might as well remove the comment entirely, as it's utterly
> pointless.
Ok.
> > - if (down_trylock(&bp->b_sema)) {
> > + if (xfs_buf_cond_lock(bp)) {
> > if (!(flags & XBF_TRYLOCK)) {
> > /* wait for buffer ownership */
> > xfs_buf_lock(bp);
> > XFS_STATS_INC(xb_get_locked_waited);
> > } else {
> > - /* We asked for a trylock and failed, no need
> > - * to look at file offset and length here, we
> > - * know that this buffer at least overlaps our
> > - * buffer and is locked, therefore our buffer
> > - * either does not exist, or is this buffer.
> > - */
> > + /* We asked for a trylock and failed. */
> > xfs_buf_rele(bp);
> > XFS_STATS_INC(xb_busy_locked);
> > return NULL;
> > }
>
> In case we wait for the lock we now do the log force twice, but that
> should be fine.
Yeah, I considered ways of avoiding this, but when i actually
measured how often it occurs, it is quite rare because the log force
clears the entire backlog of pinned, stale buffers and so the log
force is lost in the noise of other IO. Hence I thought the more
robust method of fixing and calling xfs_buf_cond_lock() was a better
tradeoff.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-11-25 0:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 11:24 [PATCH 0/2] xfs; fixes for 2.7.37-rc4 Dave Chinner
2010-11-24 11:24 ` [PATCH 1/2] xfs: fix failed write truncation handling Dave Chinner
2010-11-24 17:21 ` Christoph Hellwig
2010-11-24 11:24 ` [PATCH 2/2] xfs: push stale, pinned buffers on trylock failures Dave Chinner
2010-11-24 17:20 ` Christoph Hellwig
2010-11-25 0:23 ` Dave Chinner [this message]
2010-11-25 0:28 ` [PATCH v2] " Dave Chinner
2010-11-25 7:37 ` 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=20101125002319.GA12187@dastard \
--to=david@fromorbit.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