Skip to contentSkip to conversation

md/raid10:using conf->chunk_mask instead "chunk_secotrs - 1"

PATCH In review majianpeng 2 participants 2 messages Apr 17, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 md/raid10:using conf->chunk_mask instead "chunk_secotrs - 1"

From 2c637bca4e50e87f7b4e6b3abce27f8cd935fd92 Mon Sep 17 00:00:00 2001
From: majianpeng <[email protected]>
Date: Tue, 17 Apr 2012 16:47:07 +0800
Subject: [PATCH] md/raid10:using conf->chunk_mask instead "chunk_secotrs -
1".

---
 drivers/md/raid10.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/raid10.c +1 -1
index c8dbb84..5734d92 100644
@@ -601,7 +601,7 @@ static int raid10_mergeable_bvec(struct request_queue *q,
 	unsigned int bio_sectors = bvm->bi_size >> 9;
 
 	if (conf->near_copies < conf->raid_disks) {
-		max = (chunk_sectors - ((sector & (chunk_sectors - 1))
+		max = (chunk_sectors - ((sector & conf->chunk_mask)
 					+ bio_sectors)) << 9;
 		if (max < 0)
 			/* bio_add cannot handle a negative return */
Signature · 6 lines
1.7.5.4

 				
--------------
majianpeng
2012-04-17
#1 lore raw
Quoted 17 lines · On Tue, 17 Apr 2012 16:49:50 +0800 "majianpeng" <[email protected]> wrote:
Quoted 1 line

From 2c637bca4e50e87f7b4e6b3abce27f8cd935fd92 Mon Sep 17 00:00:00 2001

From: majianpeng <[email protected]>
Date: Tue, 17 Apr 2012 16:47:07 +0800
Subject: [PATCH] md/raid10:using conf->chunk_mask instead "chunk_secotrs -
1".

---
 drivers/md/raid10.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/raid10.c +0 -0
index c8dbb84..5734d92 100644

drivers/md/raid10.c static int raid10_mergeable_bvec(struct request_queue *q, · line 607

Quoted 8 lines
drivers/md/raid10.c +1 -1
@@ -601,7 +601,7 @@ static int raid10_mergeable_bvec(struct request_queue *q,
 	unsigned int bio_sectors = bvm->bi_size >> 9;
 
 	if (conf->near_copies < conf->raid_disks) {
-		max = (chunk_sectors - ((sector & (chunk_sectors - 1))
+		max = (chunk_sectors - ((sector & conf->chunk_mask)
 					+ bio_sectors)) << 9;
 		if (max < 0)
 			/* bio_add cannot handle a negative return */

Doesn't apply to latest code (in for-next).

And are you sure that it is actually an improvement? 'chunk_sectors' is probably in a register, conf->chunk_mask is not.

I really am not interested in micro-optimisations like this (as I have said before).

An please try to fix up your mailing process so that patch doesn't have duplicate headers.

NeilBrown