* [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.
@ 2012-07-27 8:02 majianpeng
2012-07-27 14:21 ` Jeff Moyer
0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-07-27 8:02 UTC (permalink / raw)
To: viro, Neil Brown; +Cc: linux-fsdevel, linux-kernel, linux-raid
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.
2012-07-27 8:02 [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio majianpeng
@ 2012-07-27 14:21 ` Jeff Moyer
2012-07-30 0:40 ` majianpeng
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Moyer @ 2012-07-27 14:21 UTC (permalink / raw)
To: majianpeng; +Cc: viro, Neil Brown, linux-fsdevel, linux-kernel, linux-raid
majianpeng <majianpeng@gmail.com> writes:
> 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>
Good catch. How did you find this? Did you experience data corruption
as a result of this oversight, reduced performance due to missed merge
opportunities, or did you just notice it in reviewing the code?
Reviewed-by: Jeff Moyer <jmoyer@redhat.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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.
2012-07-27 14:21 ` Jeff Moyer
@ 2012-07-30 0:40 ` majianpeng
2012-07-30 13:31 ` Jeff Moyer
0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-07-30 0:40 UTC (permalink / raw)
To: Jeff Moyer; +Cc: viro, Neil Brown, linux-fsdevel, linux-kernel, linux-raid
On 2012-07-27 22:21 Jeff Moyer <jmoyer@redhat.com> Wrote:
>majianpeng <majianpeng@gmail.com> writes:
>
>> 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>
>
>Good catch. How did you find this? Did you experience data corruption
>as a result of this oversight, reduced performance due to missed merge
>opportunities, or did you just notice it in reviewing the code?
>
>Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
>
Sorry for late to reply. When i analysed the performance of raid5, i found this bug.
>>
>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio.
2012-07-30 0:40 ` majianpeng
@ 2012-07-30 13:31 ` Jeff Moyer
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Moyer @ 2012-07-30 13:31 UTC (permalink / raw)
To: majianpeng; +Cc: viro, Neil Brown, linux-fsdevel, linux-kernel, linux-raid
majianpeng <majianpeng@gmail.com> writes:
> On 2012-07-27 22:21 Jeff Moyer <jmoyer@redhat.com> Wrote:
>>majianpeng <majianpeng@gmail.com> writes:
>>
>>> 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>
>>
>>Good catch. How did you find this? Did you experience data corruption
>>as a result of this oversight, reduced performance due to missed merge
>>opportunities, or did you just notice it in reviewing the code?
>>
>>Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
>>
> Sorry for late to reply. When i analysed the performance of raid5, i found this bug.
OK, thanks. In the future, it would be good to include that information
in the patch description.
Cheers,
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-07-30 13:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-27 8:02 [RFC PATCH] fs/direct-io.c: Set bi_rw when alloc bio majianpeng
2012-07-27 14:21 ` Jeff Moyer
2012-07-30 0:40 ` majianpeng
2012-07-30 13:31 ` Jeff Moyer
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).