linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shli@kernel.org>
To: linux-raid@vger.kernel.org
Cc: neilb@suse.de, majianpeng@gmail.com
Subject: [patch]raid5: fix directio regression
Date: Tue, 7 Aug 2012 11:22:40 +0800	[thread overview]
Message-ID: <20120807032240.GA22495@kernel.org> (raw)

My directIO randomwrite 4k workload shows a 10~20% regression caused by commit
895e3c5c58a80bb. directIO usually is random IO and if request size isn't big
(which is the common case), delay handling of the stripe hasn't any advantages.
For big size request, delay can still reduce IO.

Signed-off-by: Shaohua Li <shli@fusionio.com>
---
 drivers/md/raid5.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux/drivers/md/raid5.c
===================================================================
--- linux.orig/drivers/md/raid5.c	2012-08-07 11:04:48.442834682 +0800
+++ linux/drivers/md/raid5.c	2012-08-07 11:09:08.743562203 +0800
@@ -4076,6 +4076,7 @@ static void make_request(struct mddev *m
 	struct stripe_head *sh;
 	const int rw = bio_data_dir(bi);
 	int remaining;
+	bool large_request;
 
 	if (unlikely(bi->bi_rw & REQ_FLUSH)) {
 		md_flush_request(mddev, bi);
@@ -4089,6 +4090,11 @@ static void make_request(struct mddev *m
 	     chunk_aligned_read(mddev,bi))
 		return;
 
+	if (mddev->new_chunk_sectors < mddev->chunk_sectors)
+		large_request = (bi->bi_size >> 9) > mddev->new_chunk_sectors;
+	else
+		large_request = (bi->bi_size >> 9) > mddev->chunk_sectors;
+
 	logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
 	last_sector = bi->bi_sector + (bi->bi_size>>9);
 	bi->bi_next = NULL;
@@ -4192,7 +4198,8 @@ static void make_request(struct mddev *m
 			finish_wait(&conf->wait_for_overlap, &w);
 			set_bit(STRIPE_HANDLE, &sh->state);
 			clear_bit(STRIPE_DELAYED, &sh->state);
-			if ((bi->bi_rw & REQ_NOIDLE) &&
+			if ((bi->bi_rw & REQ_SYNC) &&
+			    ((bi->bi_rw & REQ_NOIDLE) || !large_request) &&
 			    !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
 				atomic_inc(&conf->preread_active_stripes);
 			release_stripe_plug(mddev, sh);

             reply	other threads:[~2012-08-07  3:22 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07  3:22 Shaohua Li [this message]
2012-08-07  5:13 ` [patch]raid5: fix directio regression Jianpeng Ma
2012-08-07  5:32   ` Shaohua Li
2012-08-07  5:42     ` Jianpeng Ma
2012-08-07  6:21     ` Jianpeng Ma
2012-08-08  2:58       ` Shaohua Li
2012-08-08  5:21         ` Jianpeng Ma
2012-08-08 12:53           ` Shaohua Li
2012-08-09  1:20             ` Jianpeng Ma
2012-08-09  1:32               ` NeilBrown
2012-08-09  2:27                 ` Jianpeng Ma
2012-08-09  5:07                 ` Shaohua Li
2012-08-14  6:33                   ` [patch v2]raid5: " Shaohua Li
2012-08-15  0:56                     ` NeilBrown
2012-08-15  1:20                       ` kedacomkernel
2012-08-15  1:44                       ` Shaohua Li
2012-08-15  1:54                         ` Jianpeng Ma
2012-08-16  7:36                         ` Jianpeng Ma
2012-08-16  9:42                           ` Shaohua Li
2012-08-17  1:00                             ` Jianpeng Ma
2012-08-23  6:08                             ` Shaohua Li
2012-08-23  6:46                               ` Jianpeng Ma
2012-08-23  7:55                                 ` Shaohua Li
2012-08-23  8:11                                   ` Jianpeng Ma
2012-08-23 12:17                                   ` Jianpeng Ma
2012-08-24  3:12                                     ` Shaohua Li
2012-08-24  4:21                                       ` kedacomkernel
2012-09-11  0:44                                         ` NeilBrown

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=20120807032240.GA22495@kernel.org \
    --to=shli@kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=majianpeng@gmail.com \
    --cc=neilb@suse.de \
    /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).