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: Zheng Da <zhengda1936@gmail.com>, xfs@oss.sgi.com
Subject: Re: concurrent direct IO write in xfs
Date: Mon, 13 Feb 2012 12:48:06 -0500	[thread overview]
Message-ID: <20120213174806.GA7630@infradead.org> (raw)
In-Reply-To: <20120209060920.GF7479@dastard>

On Thu, Feb 09, 2012 at 05:09:20PM +1100, Dave Chinner wrote:
>  	if (create) {
> -		lockmode = XFS_ILOCK_EXCL;
> +		/*
> +		 * For direct IO, we lock in shared mode so that write
> +		 * operations that don't require allocation can occur
> +		 * concurrently. The ilock has to be dropped over the allocation
> +		 * transaction reservation, so the only thing the ilock is
> +		 * providing here is modification exclusion. i.e. there is no
> +		 * need to hold the lock exclusive.
> +		 *
> +		 * For buffered IO, if we need to do delayed allocation then
> +		 * hold the ilock exclusive so that the lookup and delalloc
> +		 * reservation is atomic.
> +		 */
> +		if (direct)
> +			lockmode = XFS_ILOCK_SHARED;
> +		else
> +			lockmode = XFS_ILOCK_EXCL;
>  		xfs_ilock(ip, lockmode);
>  	} else {
>  		lockmode = xfs_ilock_map_shared(ip);

We'll actually need to use xfs_ilock_map_shared for the the direct
create case too, to make sure we have the exclusive lock when we first
read the extent list in.

Also xfs_qm_dqattach_locked really wants the inode locked exclusively,
which your current code doesn't handle.

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

  parent reply	other threads:[~2012-02-13 17:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16  0:01 concurrent direct IO write in xfs Zheng Da
2012-01-16 17:48 ` Christoph Hellwig
2012-01-16 19:44   ` Zheng Da
2012-01-16 23:25 ` Dave Chinner
2012-01-17 19:19   ` Zheng Da
2012-01-20  8:53     ` Linda Walsh
2012-01-20 15:07       ` Zheng Da
2012-01-23  5:11     ` Dave Chinner
2012-01-23 19:34       ` Zheng Da
2012-01-23 20:51         ` Zheng Da
2012-01-24  0:34           ` Stan Hoeppner
2012-01-24  1:40             ` Zheng Da
2012-01-24  3:54           ` Dave Chinner
2012-01-25 21:20             ` Zheng Da
2012-01-25 22:25               ` Dave Chinner
2012-02-09  6:09             ` Dave Chinner
2012-02-09  6:44               ` Zheng Da
2012-02-13 17:48               ` Christoph Hellwig [this message]
2012-02-13 23:07                 ` Dave Chinner

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=20120213174806.GA7630@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    --cc=zhengda1936@gmail.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