linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid <linux-raid@vger.kernel.org>
Subject: [PATCH 2/2] md:Rewrite the md_write_start().
Date: Sat, 2 Jun 2012 16:16:40 +0800	[thread overview]
Message-ID: <201206021616382814001@gmail.com> (raw)

Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put
it before call md_write_start.

Signed-off-by: majianpeng <majianpeng@gmail.com>
---
 drivers/md/md.c     |    4 +---
 drivers/md/md.h     |    2 +-
 drivers/md/raid1.c  |    4 ++--
 drivers/md/raid10.c |    3 ++-
 drivers/md/raid5.c  |    3 ++-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1c2f904..e009f1d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7198,11 +7198,9 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok)
  * in superblock) before writing, schedule a superblock update
  * and wait for it to complete.
  */
-void md_write_start(struct mddev *mddev, struct bio *bi)
+void md_write_start(struct mddev *mddev)
 {
 	int did_change = 0;
-	if (bio_data_dir(bi) != WRITE)
-		return;
 
 	BUG_ON(mddev->ro == 1);
 	if (mddev->ro == 2) {
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 7b4a3c3..906e3db 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -593,7 +593,7 @@ extern struct md_thread *md_register_thread(
 extern void md_unregister_thread(struct md_thread **threadp);
 extern void md_wakeup_thread(struct md_thread *thread);
 extern void md_check_recovery(struct mddev *mddev);
-extern void md_write_start(struct mddev *mddev, struct bio *bi);
+extern void md_write_start(struct mddev *mddev);
 extern void md_write_end(struct mddev *mddev);
 extern void md_done_sync(struct mddev *mddev, int blocks, int ok);
 extern void md_error(struct mddev *mddev, struct md_rdev *rdev);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 835de71..4bfa77d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -893,8 +893,8 @@ static void make_request(struct mddev *mddev, struct bio * bio)
 	 * thread has put up a bar for new requests.
 	 * Continue immediately if no resync is active currently.
 	 */
-
-	md_write_start(mddev, bio); /* wait on superblock update early */
+	if (rw == WRITE)
+		md_write_start(mddev); /* wait on superblock update early */
 
 	if (bio_data_dir(bio) == WRITE &&
 	    bio->bi_sector + bio->bi_size/512 > mddev->suspend_lo &&
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 987db37..b10cb99 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1098,7 +1098,8 @@ static void make_request(struct mddev *mddev, struct bio * bio)
 		return;
 	}
 
-	md_write_start(mddev, bio);
+	if (rw == WRITE)
+		md_write_start(mddev);
 
 	/*
 	 * Register the new request and wait if the reconstruction
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5653125..8e330f8 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3983,7 +3983,8 @@ static void make_request(struct mddev *mddev, struct bio * bi)
 	     chunk_aligned_read(mddev,bi))
 		return;
 
-	md_write_start(mddev, bi);
+	if (rw == WRITE)
+		md_write_start(mddev);
 
 	logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
 	last_sector = bi->bi_sector + (bi->bi_size>>9);
-- 
1.7.5.4



--------------
majianpeng

             reply	other threads:[~2012-06-02  8:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-02  8:16 majianpeng [this message]
2012-06-03 21:11 ` [PATCH 2/2] md:Rewrite the md_write_start() Dan Williams
2012-06-04  1:03   ` majianpeng
2012-06-04  1:12     ` 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=201206021616382814001@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --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).