linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md/raid1: use local list for pending write-bio in make_request()
Date: Thu,  2 Jun 2011 21:46:27 +0900	[thread overview]
Message-ID: <1307018787-5749-1-git-send-email-namhyung@gmail.com> (raw)

Use local bio_list for gathering mirrored bios to reduce locking overhead.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 drivers/md/raid1.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5d096096f958..39e9f54038a8 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -707,6 +707,7 @@ static int make_request(mddev_t *mddev, struct bio * bio)
 	const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA));
 	mdk_rdev_t *blocked_rdev;
 	int plugged;
+	struct bio_list write_list;
 
 	/*
 	 * Register the new request and wait if the reconstruction
@@ -801,6 +802,7 @@ static int make_request(mddev_t *mddev, struct bio * bio)
 	plugged = mddev_check_plugged(mddev);
 
 	disks = conf->raid_disks;
+	bio_list_init(&write_list);
  retry_write:
 	blocked_rdev = NULL;
 	rcu_read_lock();
@@ -894,10 +896,12 @@ static int make_request(mddev_t *mddev, struct bio * bio)
 		}
 
 		atomic_inc(&r1_bio->remaining);
-		spin_lock_irqsave(&conf->device_lock, flags);
-		bio_list_add(&conf->pending_bio_list, mbio);
-		spin_unlock_irqrestore(&conf->device_lock, flags);
+		bio_list_add(&write_list, mbio);
 	}
+	spin_lock_irqsave(&conf->device_lock, flags);
+	bio_list_merge(&conf->pending_bio_list, &write_list);
+	spin_unlock_irqrestore(&conf->device_lock, flags);
+
 	r1_bio_write_done(r1_bio);
 
 	/* In case raid1d snuck in to freeze_array */
-- 
1.7.5.2


                 reply	other threads:[~2011-06-02 12:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1307018787-5749-1-git-send-email-namhyung@gmail.com \
    --to=namhyung@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).