Skip to contentSkip to conversation

md/raid5:Not add data_offset when call is_badblock in chunk_aligned_read().

PATCH In review majianpeng 2 participants 2 messages Jun 12, 2012 – Jun 27, 2012 MD RAID

lore
Share & tools
lore

majianpeng

author
#0 lore raw

PATCH 1/1 md/raid5:Not add data_offset when call is_badblock in chunk_aligned_read().

---
 drivers/md/raid5.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid5.c +3 -2
index d267672..940f3a7 100644
@@ -3881,8 +3881,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
 		raid_bio->bi_next = (void*)rdev;
 		align_bi->bi_bdev =  rdev->bdev;
 		align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
-		/* No reshape active, so we can trust rdev->data_offset */
-		align_bi->bi_sector += rdev->data_offset;
 
 		if (!bio_fits_rdev(align_bi) ||
 		    is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,
@@ -3893,6 +3891,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
 			return 0;
 		}
 
+		/* No reshape active, so we can trust rdev->data_offset */
+		align_bi->bi_sector += rdev->data_offset;
+
 		spin_lock_irq(&conf->device_lock);
 		wait_event_lock_irq(conf->wait_for_stripe,
 				    conf->quiesce == 0,
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 19 lines · On Tue, 12 Jun 2012 16:31:10 +0800 majianpeng <[email protected]> wrote:
---
 drivers/md/raid5.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/md/raid5.c +0 -2
index d267672..940f3a7 100644
@@ -3881,8 +3881,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
 		raid_bio->bi_next = (void*)rdev;
 		align_bi->bi_bdev =  rdev->bdev;
 		align_bi->bi_flags &= ~(1 << BIO_SEG_VALID);
-		/* No reshape active, so we can trust rdev->data_offset */
-		align_bi->bi_sector += rdev->data_offset;
 
 		if (!bio_fits_rdev(align_bi) ||
 		    is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9,

drivers/md/raid5.c static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) · line 3899

Quoted 9 lines
drivers/md/raid5.c +3 -0
@@ -3893,6 +3891,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio)
 			return 0;
 		}
 
+		/* No reshape active, so we can trust rdev->data_offset */
+		align_bi->bi_sector += rdev->data_offset;
+
 		spin_lock_irq(&conf->device_lock);
 		wait_event_lock_irq(conf->wait_for_stripe,
 				    conf->quiesce == 0,

Thanks for catching that!
Patch applied.

NeilBrown