From: majianpeng <majianpeng@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: viro <viro@ZenIV.linux.org.uk>,
linux-raid <linux-raid@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: Re: [PATCH 2/2] raid5: For write performance, remove REQ_SYNC when write was odirect.
Date: Mon, 16 Jul 2012 16:14:43 +0800 [thread overview]
Message-ID: <2012071616143768718310@gmail.com> (raw)
In-Reply-To: 20120716173028.69dd5ead@notabene.brown
On 2012-07-16 15:30 NeilBrown <neilb@suse.de> Wrote:
>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
>
>
Yes, thanks your time.I maked a stupid mistake.
I'll corrected by your suggestion and resend to you.
prev parent reply other threads:[~2012-07-16 8:14 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
2012-07-16 8:14 ` majianpeng [this message]
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=2012071616143768718310@gmail.com \
--to=majianpeng@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.