linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2 V1] raid5: For odirect-write performance, not set  STRIPE_PREREAD_ACTIVE.
@ 2012-07-16  8:33 majianpeng
  2012-07-17  2:02 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2012-07-16  8:33 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid, viro

Using flag REQ_NOIDLE to difference odirect-write and sync_write.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 drivers/md/raid5.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 04348d7..29edaf0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4113,7 +4113,10 @@ static void make_request(struct mddev *mddev, struct bio * bi)
 			finish_wait(&conf->wait_for_overlap, &w);
 			set_bit(STRIPE_HANDLE, &sh->state);
 			clear_bit(STRIPE_DELAYED, &sh->state);
-			if ((bi->bi_rw & REQ_SYNC) &&
+			/* Difference odirect-write between regular file
+			 * and block-device
+			 */
+			if ((bi->bi_rw & REQ_NOIDLE) &&
 			    !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
 				atomic_inc(&conf->preread_active_stripes);
 			mddev_check_plugged(mddev);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2 V1] raid5: For odirect-write performance, not set STRIPE_PREREAD_ACTIVE.
  2012-07-16  8:33 [PATCH 2/2 V1] raid5: For odirect-write performance, not set STRIPE_PREREAD_ACTIVE majianpeng
@ 2012-07-17  2:02 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2012-07-17  2:02 UTC (permalink / raw)
  To: majianpeng; +Cc: linux-raid, viro

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

On Mon, 16 Jul 2012 16:33:02 +0800 majianpeng <majianpeng@gmail.com> wrote:

> Using flag REQ_NOIDLE to difference odirect-write and sync_write.
> 
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
>  drivers/md/raid5.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 04348d7..29edaf0 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -4113,7 +4113,10 @@ static void make_request(struct mddev *mddev, struct bio * bi)
>  			finish_wait(&conf->wait_for_overlap, &w);
>  			set_bit(STRIPE_HANDLE, &sh->state);
>  			clear_bit(STRIPE_DELAYED, &sh->state);
> -			if ((bi->bi_rw & REQ_SYNC) &&
> +			/* Difference odirect-write between regular file
> +			 * and block-device
> +			 */
> +			if ((bi->bi_rw & REQ_NOIDLE) &&
>  			    !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
>  				atomic_inc(&conf->preread_active_stripes);
>  			mddev_check_plugged(mddev);


Thanks.
I've improved that patch description and remove the code comment and I don't
think it is helpful.

NeilBrown


From c6e353648f062901f435f67b91e9438897d42ddf Mon Sep 17 00:00:00 2001
From: majianpeng <majianpeng@gmail.com>
Date: Tue, 17 Jul 2012 12:00:35 +1000
Subject: [PATCH] md/raid5: For odirect-write performance, do not set
 STRIPE_PREREAD_ACTIVE.

'sync' writes set both REQ_SYNC and REQ_NOIDLE.
O_DIRECT writes set REQ_SYNC but not REQ_NOIDLE.

We currently assume that a REQ_SYNC request will not be followed by
more requests and so set STRIPE_PREREAD_ACTIVE to expedite the
request.
This is appropriate for sync requests, but not for O_DIRECT requests.

So make the setting of STRIPE_PREREAD_ACTIVE conditional on REQ_NOIDLE
rather than REQ_SYNC.  This is consistent with the documented meaning
of REQ_NOIDLE:

        __REQ_NOIDLE,           /* don't anticipate more IO after this one */

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 0e4439e..ee492a8 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4187,7 +4187,7 @@ static void make_request(struct mddev *mddev, struct bio * bi)
 			finish_wait(&conf->wait_for_overlap, &w);
 			set_bit(STRIPE_HANDLE, &sh->state);
 			clear_bit(STRIPE_DELAYED, &sh->state);
-			if ((bi->bi_rw & REQ_SYNC) &&
+			if ((bi->bi_rw & REQ_NOIDLE) &&
 			    !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
 				atomic_inc(&conf->preread_active_stripes);
 			release_stripe_plug(mddev, sh);

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-17  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-16  8:33 [PATCH 2/2 V1] raid5: For odirect-write performance, not set STRIPE_PREREAD_ACTIVE majianpeng
2012-07-17  2:02 ` NeilBrown

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).