Commit 67dbb3a0 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 90036013 47d68979
......@@ -249,6 +249,7 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
const int rw = bio_data_dir(bio);
struct mddev *mddev = q->queuedata;
unsigned int sectors;
int cpu;
if (mddev == NULL || mddev->pers == NULL
|| !mddev->ready) {
......@@ -284,7 +285,10 @@ static void md_make_request(struct request_queue *q, struct bio *bio)
sectors = bio_sectors(bio);
mddev->pers->make_request(mddev, bio);
generic_start_io_acct(rw, sectors, &mddev->gendisk->part0);
cpu = part_stat_lock();
part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw], sectors);
part_stat_unlock();
if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
wake_up(&mddev->sb_wait);
......
......@@ -313,7 +313,7 @@ static struct strip_zone *find_zone(struct r0conf *conf,
/*
* remaps the bio to the target device. we separate two flows.
* power 2 flow and a general flow for the sake of perfromance
* power 2 flow and a general flow for the sake of performance
*/
static struct md_rdev *map_sector(struct mddev *mddev, struct strip_zone *zone,
sector_t sector, sector_t *sector_offset)
......@@ -524,6 +524,7 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio)
split = bio;
}
sector = bio->bi_iter.bi_sector;
zone = find_zone(mddev->private, &sector);
tmp_dev = map_sector(mddev, zone, sector, &sector);
split->bi_bdev = tmp_dev->bdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment