public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Amit Sahrawat <amit.sahrawat83@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [Patch] xfs: serialise unaligned direct IOs
Date: Thu, 3 Nov 2011 03:02:46 -0400	[thread overview]
Message-ID: <20111103070246.GA10579@infradead.org> (raw)
In-Reply-To: <CADDb1s0WUfvt8N+hMATboKxbMUZdk2N-R2e=KFH2JvGUjbigBg@mail.gmail.com>

On Thu, Nov 03, 2011 at 11:37:03AM +0530, Amit Sahrawat wrote:
> This is needed for long term kernel 2.6.35.14.
> Please let me know for any changes/suggestions.

It sounds like a fine candidate to backport, although the context
differs a lot from the actual changes commited to mainline.  A few
comments below:

> they are overlapping IO and the result of concurrent overlapping IOs
> is undefined - the result of either IO is a valid result so we let
> them race. Hence we only penalise unaligned IO, which already has a
> major overhead compared to aligned IO so this isn't a major problem.
> 

You probably should keep the original Signoff and reviewed-by tags,
and add your editor note on the top into [ ]  brackets.

> +		if (!need_i_mutex && ( unaligned_io || mapping->nrpages || pos >
> ip->i_size)) {

no space after the opening brace please, and split overly-long lines
into two:

		if (!need_i_mutex &&
		    (unaligned_io || mapping->nrpages || pos > ip->i_size)) {

>  		if (need_i_mutex) {
> -			/* demote the lock now the cached pages are gone */
> -			xfs_ilock_demote(ip, XFS_IOLOCK_EXCL);

> +			if (unaligned_io)
> +	                       	xfs_ioend_wait(ip);
> +	               /* demote the lock now the cached pages are gone if we can */
> +        	        else {
> +                 	        xfs_ilock_demote(ip, XFS_IOLOCK_EXCL);
> +	                        iolock = XFS_IOLOCK_SHARED;
> +        	        }

Please use the comment that was used upstream here:

			/*
			 * If we are doing unaligned IO, wait for all other IO
			 * to drain, otherwise demote the lock if we had to
			 * flush cached pages.
			 */

>  			mutex_unlock(&inode->i_mutex);
> 
> -			iolock = XFS_IOLOCK_SHARED;


>  			need_i_mutex = 0;

You also need to make the i_mutex unlock and need_i_mutex update
conditional here, otherwise you still serialize all O_DIRECT writes.

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

  reply	other threads:[~2011-11-03  7:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03  6:07 [Patch] xfs: serialise unaligned direct IOs Amit Sahrawat
2011-11-03  7:02 ` Christoph Hellwig [this message]
2011-11-03  9:59   ` Amit Sahrawat
2011-11-03 10:06     ` Christoph Hellwig
2011-11-03 11:19       ` Amit Sahrawat
2011-12-12 14:34         ` Christoph Hellwig
2011-12-14  8:57           ` Amit Sahrawat

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=20111103070246.GA10579@infradead.org \
    --to=hch@infradead.org \
    --cc=amit.sahrawat83@gmail.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