linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: majianpeng <majianpeng@gmail.com>
Cc: viro <viro@ZenIV.linux.org.uk>,
	linux-raid <linux-raid@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/2] raid5: For write performance, remove REQ_SYNC when write was odirect.
Date: Mon, 16 Jul 2012 17:30:28 +1000	[thread overview]
Message-ID: <20120716173028.69dd5ead@notabene.brown> (raw)
In-Reply-To: <201207161511247039289@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1506 bytes --]

On Mon, 16 Jul 2012 15:11:29 +0800 majianpeng <majianpeng@gmail.com> wrote:

> On 2012-07-16 15:07 NeilBrown <neilb@suse.de> Wrote:
> >On Mon, 16 Jul 2012 14:42:54 +0800 majianpeng <majianpeng@gmail.com> wrote:
> >
> >> On 2012-07-16 13:40 NeilBrown <neilb@suse.de> Wrote:
> >> >On Mon, 16 Jul 2012 09:31:55 +0800 majianpeng <majianpeng@gmail.com> wrote:
> >> >
> [snip]
> >> > Normal 'sync' requests use WRITE_SYNC which includes "REQ_NOIDLE" which means
> >> >   /* don't anticipate more IO after this one */
> >> > O_DIRECT request use WRITE_ODIRECT which does not include this flag.
> >> >
> >
> >> Using REQ_NOIDEL to difference odirect and sync.Why not using:
> >>  +	if (bi->bi_rw & WRITE_ODIRECT)
> >>  +		bi->bi_rw &= ~REQ_SYNC;
> >
> >Because that code is wrong.  WRITE_ODIRECT is not one flag, it is two flags
> >'or'ed together.  So this code does not do what you expect.
> >
> No, I used those code test and it's ok.
> The code used & not &&.
> Maybe I wrong?

Think about it...

#define REQ_WRITE               (1 << __REQ_WRITE)
#define REQ_SYNC                (1 << __REQ_SYNC)

#define RW_MASK                 REQ_WRITE
#define WRITE                   RW_MASK

#define WRITE_ODIRECT		(WRITE | REQ_SYNC)

So   
    (bi->bi_rw & WRITE_ODIRECT)

will be true if either REQ_WRITE or REQ_SYNC are set in bi_rw
So whenever REQ_SYNC is set, your code clears the flag.
So your code is functionally identical to

   bi->bi_rw &= ~REQ_SYNC;

NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-07-16  7:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16  1:31 [PATCH 2/2] raid5: For write performance, remove REQ_SYNC when write was odirect majianpeng
2012-07-16  5:40 ` NeilBrown
2012-07-16  5:47   ` majianpeng
2012-07-16  6:42   ` majianpeng
2012-07-16  7:07     ` NeilBrown
2012-07-16  7:11       ` majianpeng
2012-07-16  7:30         ` NeilBrown [this message]
2012-07-16  8:14           ` majianpeng

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=20120716173028.69dd5ead@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.com \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).