diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-13 13:11:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-13 13:11:18 -0400 |
commit | 67dbb3a099d0fe04df5974edddc0b8c64a9f7529 (patch) | |
tree | a69eb15d6ad783716cdf5f27162ac97e4ef57781 | |
parent | 900360131066f192c82311a098d03d6ac6429e20 (diff) | |
parent | 47d68979cc968535cb87f3e5f2e6a3533ea48fbd (diff) |
Merge tag 'md/4.0-rc7-fix' of git://neil.brown.name/md
Pull md fixes from Neil Brown:
"Two regression fixes for md, one fairly recent and minor (diskstats
has confusing data) and one older and more serious - RAID0 with
non-power-of-2 chunksize corrupts data.
I guess (almost) no-one uses non-power-of-2 chunks.
Summary:
- Revert recent change which broke IO accounting.
- Fix bug with RAID0 arrays with non-power-of-2 chunk size"
* tag 'md/4.0-rc7-fix' of git://neil.brown.name/md:
md/raid0: fix bug with chunksize not a power of 2.
md: fix md io stats accounting broken
-rw-r--r-- | drivers/md/md.c | 6 | ||||
-rw-r--r-- | drivers/md/raid0.c | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 717daad71fb1..e6178787ce3d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -249,6 +249,7 @@ static void md_make_request(struct request_queue *q, struct bio *bio) | |||
249 | const int rw = bio_data_dir(bio); | 249 | const int rw = bio_data_dir(bio); |
250 | struct mddev *mddev = q->queuedata; | 250 | struct mddev *mddev = q->queuedata; |
251 | unsigned int sectors; | 251 | unsigned int sectors; |
252 | int cpu; | ||
252 | 253 | ||
253 | if (mddev == NULL || mddev->pers == NULL | 254 | if (mddev == NULL || mddev->pers == NULL |
254 | || !mddev->ready) { | 255 | || !mddev->ready) { |
@@ -284,7 +285,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio) | |||
284 | sectors = bio_sectors(bio); | 285 | sectors = bio_sectors(bio); |
285 | mddev->pers->make_request(mddev, bio); | 286 | mddev->pers->make_request(mddev, bio); |
286 | 287 | ||
287 | generic_start_io_acct(rw, sectors, &mddev->gendisk->part0); | 288 | cpu = part_stat_lock(); |
289 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); | ||
290 | part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors); | ||
291 | part_stat_unlock(); | ||
288 | 292 | ||
289 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) | 293 | if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended) |
290 | wake_up(&mddev->sb_wait); | 294 | wake_up(&mddev->sb_wait); |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 3ed9f42ddca6..3b5d7f704aa3 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -313,7 +313,7 @@ static struct strip_zone *find_zone(struct r0conf *conf, | |||
313 | 313 | ||
314 | /* | 314 | /* |
315 | * remaps the bio to the target device. we separate two flows. | 315 | * remaps the bio to the target device. we separate two flows. |
316 | * power 2 flow and a general flow for the sake of perfromance | 316 | * power 2 flow and a general flow for the sake of performance |
317 | */ | 317 | */ |
318 | static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone, | 318 | static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone, |
319 | sector_t sector, sector_t *sector_offset) | 319 | sector_t sector, sector_t *sector_offset) |
@@ -524,6 +524,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
524 | split = bio; | 524 | split = bio; |
525 | } | 525 | } |
526 | 526 | ||
527 | sector = bio->bi_iter.bi_sector; | ||
527 | zone = find_zone(mddev->private, §or); | 528 | zone = find_zone(mddev->private, §or); |
528 | tmp_dev = map_sector(mddev, zone, sector, §or); | 529 | tmp_dev = map_sector(mddev, zone, sector, §or); |
529 | split->bi_bdev = tmp_dev->bdev; | 530 | split->bi_bdev = tmp_dev->bdev; |