From: majianpeng <majianpeng@gmail.com>
To: viro <viro@ZenIV.linux.org.uk>, "Neil Brown" <neilb@suse.de>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-raid <linux-raid@vger.kernel.org>
Subject: [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.
Date: Fri, 27 Jul 2012 16:02:10 +0800 [thread overview]
Message-ID: <201207271602081096921@gmail.com> (raw)
When exec bio_alloc, the bi_rw is zero.But after calling bio_add_page,
it will use bi_rw.
Fox example, in functiion __bio_add_page,it will call merge_bvec_fn().
The merge_bvec_fn of raid456 will use the bi_rw to judge the merge.
>> if ((bvm->bi_rw & 1) == WRITE)
>> return biovec->bv_len; /* always allow writes to be mergeable */
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
There are many place like this in kernel.If you think this patch ok, i will correct those.
---
fs/direct-io.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1faf4cb..77f0bbf 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -349,6 +349,7 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
bio->bi_bdev = bdev;
bio->bi_sector = first_sector;
+ bio->bi_rw = dio->rw;
if (dio->is_async)
bio->bi_end_io = dio_bio_end_aio;
else
--
1.7.5.4
next reply other threads:[~2012-07-27 8:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-27 8:02 majianpeng [this message]
2012-07-27 14:21 ` [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio Jeff Moyer
2012-07-30 0:40 ` majianpeng
2012-07-30 13:31 ` Jeff Moyer
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=201207271602081096921@gmail.com \
--to=majianpeng@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 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).