Skip to contentSkip to conversation

md/raid1:!conf->r1buf_pool is unlikely in function sync_request.

PATCH majianpeng 2 participants 2 messages Mar 28, 2012 – Apr 2, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

From 7f9446682f64e28106dd52cd12bdf74a19fb4015 Mon Sep 17 00:00:00 2001
From: majianpeng <[email protected]>
Date: Wed, 28 Mar 2012 19:20:07 +0800
Subject: [PATCH] md/raid1:!conf->r1buf_pool is unlikely in function
sync_request.

---
 drivers/md/raid1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/raid1.c +1 -1
index 4a40a20..943b3b3 100644
@@ -2246,7 +2246,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
 	int good_sectors = RESYNC_SECTORS;
 	int min_bad = 0; /* number of sectors that are bad in all devices */
 
-	if (!conf->r1buf_pool)
+	if (unlikely(!conf->r1buf_pool))
 		if (init_resync(conf))
 			return 0;
 
Signature · 6 lines
1.7.5.4

 				
--------------
majianpeng
2012-03-28
#1 lore raw
Quoted 17 lines · On Wed, 28 Mar 2012 19:24:29 +0800 "majianpeng" <[email protected]> wrote:
Quoted 1 line

From 7f9446682f64e28106dd52cd12bdf74a19fb4015 Mon Sep 17 00:00:00 2001

From: majianpeng <[email protected]>
Date: Wed, 28 Mar 2012 19:20:07 +0800
Subject: [PATCH] md/raid1:!conf->r1buf_pool is unlikely in function
sync_request.

---
 drivers/md/raid1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/raid1.c +0 -0
index 4a40a20..943b3b3 100644

drivers/md/raid1.c static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp · line 2252

Quoted 8 lines
drivers/md/raid1.c +1 -1
@@ -2246,7 +2246,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
 	int good_sectors = RESYNC_SECTORS;
 	int min_bad = 0; /* number of sectors that are bad in all devices */
 
-	if (!conf->r1buf_pool)
+	if (unlikely(!conf->r1buf_pool))
 		if (init_resync(conf))
 			return 0;
 

Hi,
I'm really happy that you are reviewing the md patches and even finding some bugs. However I find the stream of occasional tiny patches somewhat distracting.

Also I find micro-optimisation like this fairly pointless. You should only really use unlikely() when it will make a real difference to performance, and this change won't

So I won't apply this patch.
I'll keep looking though the others you have sent since but in future I would prefer it if you collected together little patches like this and send them as a group.

If and when you find genuine bugs, feel free to send them straight away.

Thanks,
NeilBrown