public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/2] xfs: push stale, pinned buffers on trylock failures
Date: Wed, 24 Nov 2010 12:20:51 -0500	[thread overview]
Message-ID: <20101124172051.GA32129@infradead.org> (raw)
In-Reply-To: <1290597873-5807-3-git-send-email-david@fromorbit.com>

> -	/* 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.

> -	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.

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

  reply	other threads:[~2010-11-24 17:19 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 [this message]
2010-11-25  0:23     ` Dave Chinner
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=20101124172051.GA32129@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox