linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [PATCH 1/4] raid1: change the code layout of raid1_mergeable_bvec() to make it look a bit nicer
Date: Thu, 31 May 2012 18:18:45 +0800	[thread overview]
Message-ID: <1338459528-24490-1-git-send-email-yuanhan.liu@linux.intel.com> (raw)

This don't fix anything but just make function raid1_mergeable_bvec
look a bit nicer.

Minro note: this make 2 lines exceed 80 a bit(81).

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 drivers/md/raid1.c |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 835de71..5829f46 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -623,27 +623,25 @@ static int raid1_mergeable_bvec(struct request_queue *q,
 	struct r1conf *conf = mddev->private;
 	sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
 	int max = biovec->bv_len;
+	int disk;
 
-	if (mddev->merge_check_needed) {
-		int disk;
-		rcu_read_lock();
-		for (disk = 0; disk < conf->raid_disks * 2; disk++) {
-			struct md_rdev *rdev = rcu_dereference(
-				conf->mirrors[disk].rdev);
-			if (rdev && !test_bit(Faulty, &rdev->flags)) {
-				struct request_queue *q =
-					bdev_get_queue(rdev->bdev);
-				if (q->merge_bvec_fn) {
-					bvm->bi_sector = sector +
-						rdev->data_offset;
-					bvm->bi_bdev = rdev->bdev;
-					max = min(max, q->merge_bvec_fn(
-							  q, bvm, biovec));
-				}
+	if (!mddev->merge_check_needed)
+		return max;
+
+	rcu_read_lock();
+	for (disk = 0; disk < conf->raid_disks * 2; disk++) {
+		struct md_rdev *rdev = rcu_dereference(conf->mirrors[disk].rdev);
+		if (rdev && !test_bit(Faulty, &rdev->flags)) {
+			struct request_queue *q = bdev_get_queue(rdev->bdev);
+			if (q->merge_bvec_fn) {
+				bvm->bi_sector = sector + rdev->data_offset;
+				bvm->bi_bdev = rdev->bdev;
+				max = min(max, q->merge_bvec_fn(q, bvm, biovec));
 			}
 		}
-		rcu_read_unlock();
 	}
+	rcu_read_unlock();
+
 	return max;
 
 }
-- 
1.7.7.6


             reply	other threads:[~2012-05-31 10:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-31 10:18 Yuanhan Liu [this message]
2012-05-31 10:18 ` [PATCH 2/4] raid10: change the code layout of raid10_mergeable_bvec() to make it look a bit nicer Yuanhan Liu
2012-05-31 10:18 ` [PATCH 3/4] md: introduce md_rdev_merge_bvec to reduce code duplicate Yuanhan Liu
2012-05-31 10:18 ` [PATCH 4/4] md: put EXPORT_SYMBOL macro immediately after the corresponding function Yuanhan Liu
2012-06-04  3:42 ` [PATCH 1/4] raid1: change the code layout of raid1_mergeable_bvec() to make it look a bit nicer NeilBrown
2012-06-04  3:52   ` Yuanhan Liu

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=1338459528-24490-1-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.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).