Loading drivers/md/raid5.c +13 −14 Original line number Original line Diff line number Diff line Loading @@ -1274,8 +1274,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, sector_t new_sector; sector_t new_sector; int algorithm = previous ? conf->prev_algo int algorithm = previous ? conf->prev_algo : conf->algorithm; : conf->algorithm; int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) int sectors_per_chunk = previous ? conf->prev_chunk_sectors : (conf->chunk_size >> 9); : conf->chunk_sectors; int raid_disks = previous ? conf->previous_raid_disks int raid_disks = previous ? conf->previous_raid_disks : conf->raid_disks; : conf->raid_disks; int data_disks = raid_disks - conf->max_degraded; int data_disks = raid_disks - conf->max_degraded; Loading Loading @@ -1480,8 +1480,8 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) int raid_disks = sh->disks; int raid_disks = sh->disks; int data_disks = raid_disks - conf->max_degraded; int data_disks = raid_disks - conf->max_degraded; sector_t new_sector = sh->sector, check; sector_t new_sector = sh->sector, check; int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) int sectors_per_chunk = previous ? conf->prev_chunk_sectors : (conf->chunk_size >> 9); : conf->chunk_sectors; int algorithm = previous ? conf->prev_algo int algorithm = previous ? conf->prev_algo : conf->algorithm; : conf->algorithm; sector_t stripe; sector_t stripe; Loading Loading @@ -1997,8 +1997,7 @@ static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, struct stripe_head *sh) struct stripe_head *sh) { { int sectors_per_chunk = int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) previous ? conf->prev_chunk_sectors : conf->chunk_sectors; : (conf->chunk_size >> 9); int dd_idx; int dd_idx; int chunk_offset = sector_div(stripe, sectors_per_chunk); int chunk_offset = sector_div(stripe, sectors_per_chunk); int disks = previous ? conf->previous_raid_disks : conf->raid_disks; int disks = previous ? conf->previous_raid_disks : conf->raid_disks; Loading Loading @@ -3917,7 +3916,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped 1, &dd_idx, NULL); 1, &dd_idx, NULL); last_sector = last_sector = raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) *(new_data_disks) - 1), * new_data_disks - 1), 1, &dd_idx, NULL); 1, &dd_idx, NULL); if (last_sector >= mddev->dev_sectors) if (last_sector >= mddev->dev_sectors) last_sector = mddev->dev_sectors - 1; last_sector = mddev->dev_sectors - 1; Loading Loading @@ -4403,7 +4402,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) conf->fullsync = 1; conf->fullsync = 1; } } conf->chunk_size = mddev->new_chunk_sectors << 9; conf->chunk_sectors = mddev->new_chunk_sectors; conf->level = mddev->new_level; conf->level = mddev->new_level; if (conf->level == 6) if (conf->level == 6) conf->max_degraded = 2; conf->max_degraded = 2; Loading @@ -4413,7 +4412,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) conf->max_nr_stripes = NR_STRIPES; conf->max_nr_stripes = NR_STRIPES; conf->reshape_progress = mddev->reshape_position; conf->reshape_progress = mddev->reshape_position; if (conf->reshape_progress != MaxSector) { if (conf->reshape_progress != MaxSector) { conf->prev_chunk = mddev->chunk_sectors << 9; conf->prev_chunk_sectors = mddev->chunk_sectors; conf->prev_algo = mddev->layout; conf->prev_algo = mddev->layout; } } Loading Loading @@ -4931,8 +4930,8 @@ static int raid5_start_reshape(mddev_t *mddev) spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock); conf->previous_raid_disks = conf->raid_disks; conf->previous_raid_disks = conf->raid_disks; conf->raid_disks += mddev->delta_disks; conf->raid_disks += mddev->delta_disks; conf->prev_chunk = conf->chunk_size; conf->prev_chunk_sectors = conf->chunk_sectors; conf->chunk_size = mddev->new_chunk_sectors << 9; conf->chunk_sectors = mddev->new_chunk_sectors; conf->prev_algo = conf->algorithm; conf->prev_algo = conf->algorithm; conf->algorithm = mddev->new_layout; conf->algorithm = mddev->new_layout; if (mddev->delta_disks < 0) if (mddev->delta_disks < 0) Loading Loading @@ -5014,7 +5013,7 @@ static void end_reshape(raid5_conf_t *conf) */ */ { { int data_disks = conf->raid_disks - conf->max_degraded; int data_disks = conf->raid_disks - conf->max_degraded; int stripe = data_disks * (conf->chunk_size int stripe = data_disks * ((conf->chunk_sectors << 9) / PAGE_SIZE); / PAGE_SIZE); if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; Loading Loading @@ -5059,7 +5058,7 @@ static void raid5_finish_reshape(mddev_t *mddev) raid5_remove_disk(mddev, d); raid5_remove_disk(mddev, d); } } mddev->layout = conf->algorithm; mddev->layout = conf->algorithm; mddev->chunk_sectors = conf->chunk_size >> 9; mddev->chunk_sectors = conf->chunk_sectors; mddev->reshape_position = MaxSector; mddev->reshape_position = MaxSector; mddev->delta_disks = 0; mddev->delta_disks = 0; } } Loading Loading @@ -5187,7 +5186,7 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) mddev->layout = mddev->new_layout = new_layout; mddev->layout = mddev->new_layout = new_layout; } } if (new_chunk > 0) { if (new_chunk > 0) { conf->chunk_size = new_chunk; conf->chunk_sectors = new_chunk >> 9; mddev->new_chunk_sectors = new_chunk >> 9; mddev->new_chunk_sectors = new_chunk >> 9; mddev->chunk_sectors = new_chunk >> 9; mddev->chunk_sectors = new_chunk >> 9; } } Loading drivers/md/raid5.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -334,7 +334,8 @@ struct raid5_private_data { struct hlist_head *stripe_hashtbl; struct hlist_head *stripe_hashtbl; mddev_t *mddev; mddev_t *mddev; struct disk_info *spare; struct disk_info *spare; int chunk_size, level, algorithm; int chunk_sectors; int level, algorithm; int max_degraded; int max_degraded; int raid_disks; int raid_disks; int max_nr_stripes; int max_nr_stripes; Loading @@ -350,7 +351,8 @@ struct raid5_private_data { */ */ sector_t reshape_safe; sector_t reshape_safe; int previous_raid_disks; int previous_raid_disks; int prev_chunk, prev_algo; int prev_chunk_sectors; int prev_algo; short generation; /* increments with every reshape */ short generation; /* increments with every reshape */ unsigned long reshape_checkpoint; /* Time we last updated unsigned long reshape_checkpoint; /* Time we last updated * metadata */ * metadata */ Loading Loading
drivers/md/raid5.c +13 −14 Original line number Original line Diff line number Diff line Loading @@ -1274,8 +1274,8 @@ static sector_t raid5_compute_sector(raid5_conf_t *conf, sector_t r_sector, sector_t new_sector; sector_t new_sector; int algorithm = previous ? conf->prev_algo int algorithm = previous ? conf->prev_algo : conf->algorithm; : conf->algorithm; int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) int sectors_per_chunk = previous ? conf->prev_chunk_sectors : (conf->chunk_size >> 9); : conf->chunk_sectors; int raid_disks = previous ? conf->previous_raid_disks int raid_disks = previous ? conf->previous_raid_disks : conf->raid_disks; : conf->raid_disks; int data_disks = raid_disks - conf->max_degraded; int data_disks = raid_disks - conf->max_degraded; Loading Loading @@ -1480,8 +1480,8 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous) int raid_disks = sh->disks; int raid_disks = sh->disks; int data_disks = raid_disks - conf->max_degraded; int data_disks = raid_disks - conf->max_degraded; sector_t new_sector = sh->sector, check; sector_t new_sector = sh->sector, check; int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) int sectors_per_chunk = previous ? conf->prev_chunk_sectors : (conf->chunk_size >> 9); : conf->chunk_sectors; int algorithm = previous ? conf->prev_algo int algorithm = previous ? conf->prev_algo : conf->algorithm; : conf->algorithm; sector_t stripe; sector_t stripe; Loading Loading @@ -1997,8 +1997,7 @@ static void stripe_set_idx(sector_t stripe, raid5_conf_t *conf, int previous, struct stripe_head *sh) struct stripe_head *sh) { { int sectors_per_chunk = int sectors_per_chunk = previous ? (conf->prev_chunk >> 9) previous ? conf->prev_chunk_sectors : conf->chunk_sectors; : (conf->chunk_size >> 9); int dd_idx; int dd_idx; int chunk_offset = sector_div(stripe, sectors_per_chunk); int chunk_offset = sector_div(stripe, sectors_per_chunk); int disks = previous ? conf->previous_raid_disks : conf->raid_disks; int disks = previous ? conf->previous_raid_disks : conf->raid_disks; Loading Loading @@ -3917,7 +3916,7 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped 1, &dd_idx, NULL); 1, &dd_idx, NULL); last_sector = last_sector = raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) raid5_compute_sector(conf, ((stripe_addr+reshape_sectors) *(new_data_disks) - 1), * new_data_disks - 1), 1, &dd_idx, NULL); 1, &dd_idx, NULL); if (last_sector >= mddev->dev_sectors) if (last_sector >= mddev->dev_sectors) last_sector = mddev->dev_sectors - 1; last_sector = mddev->dev_sectors - 1; Loading Loading @@ -4403,7 +4402,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) conf->fullsync = 1; conf->fullsync = 1; } } conf->chunk_size = mddev->new_chunk_sectors << 9; conf->chunk_sectors = mddev->new_chunk_sectors; conf->level = mddev->new_level; conf->level = mddev->new_level; if (conf->level == 6) if (conf->level == 6) conf->max_degraded = 2; conf->max_degraded = 2; Loading @@ -4413,7 +4412,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) conf->max_nr_stripes = NR_STRIPES; conf->max_nr_stripes = NR_STRIPES; conf->reshape_progress = mddev->reshape_position; conf->reshape_progress = mddev->reshape_position; if (conf->reshape_progress != MaxSector) { if (conf->reshape_progress != MaxSector) { conf->prev_chunk = mddev->chunk_sectors << 9; conf->prev_chunk_sectors = mddev->chunk_sectors; conf->prev_algo = mddev->layout; conf->prev_algo = mddev->layout; } } Loading Loading @@ -4931,8 +4930,8 @@ static int raid5_start_reshape(mddev_t *mddev) spin_lock_irq(&conf->device_lock); spin_lock_irq(&conf->device_lock); conf->previous_raid_disks = conf->raid_disks; conf->previous_raid_disks = conf->raid_disks; conf->raid_disks += mddev->delta_disks; conf->raid_disks += mddev->delta_disks; conf->prev_chunk = conf->chunk_size; conf->prev_chunk_sectors = conf->chunk_sectors; conf->chunk_size = mddev->new_chunk_sectors << 9; conf->chunk_sectors = mddev->new_chunk_sectors; conf->prev_algo = conf->algorithm; conf->prev_algo = conf->algorithm; conf->algorithm = mddev->new_layout; conf->algorithm = mddev->new_layout; if (mddev->delta_disks < 0) if (mddev->delta_disks < 0) Loading Loading @@ -5014,7 +5013,7 @@ static void end_reshape(raid5_conf_t *conf) */ */ { { int data_disks = conf->raid_disks - conf->max_degraded; int data_disks = conf->raid_disks - conf->max_degraded; int stripe = data_disks * (conf->chunk_size int stripe = data_disks * ((conf->chunk_sectors << 9) / PAGE_SIZE); / PAGE_SIZE); if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) if (conf->mddev->queue->backing_dev_info.ra_pages < 2 * stripe) conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; conf->mddev->queue->backing_dev_info.ra_pages = 2 * stripe; Loading Loading @@ -5059,7 +5058,7 @@ static void raid5_finish_reshape(mddev_t *mddev) raid5_remove_disk(mddev, d); raid5_remove_disk(mddev, d); } } mddev->layout = conf->algorithm; mddev->layout = conf->algorithm; mddev->chunk_sectors = conf->chunk_size >> 9; mddev->chunk_sectors = conf->chunk_sectors; mddev->reshape_position = MaxSector; mddev->reshape_position = MaxSector; mddev->delta_disks = 0; mddev->delta_disks = 0; } } Loading Loading @@ -5187,7 +5186,7 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk) mddev->layout = mddev->new_layout = new_layout; mddev->layout = mddev->new_layout = new_layout; } } if (new_chunk > 0) { if (new_chunk > 0) { conf->chunk_size = new_chunk; conf->chunk_sectors = new_chunk >> 9; mddev->new_chunk_sectors = new_chunk >> 9; mddev->new_chunk_sectors = new_chunk >> 9; mddev->chunk_sectors = new_chunk >> 9; mddev->chunk_sectors = new_chunk >> 9; } } Loading
drivers/md/raid5.h +4 −2 Original line number Original line Diff line number Diff line Loading @@ -334,7 +334,8 @@ struct raid5_private_data { struct hlist_head *stripe_hashtbl; struct hlist_head *stripe_hashtbl; mddev_t *mddev; mddev_t *mddev; struct disk_info *spare; struct disk_info *spare; int chunk_size, level, algorithm; int chunk_sectors; int level, algorithm; int max_degraded; int max_degraded; int raid_disks; int raid_disks; int max_nr_stripes; int max_nr_stripes; Loading @@ -350,7 +351,8 @@ struct raid5_private_data { */ */ sector_t reshape_safe; sector_t reshape_safe; int previous_raid_disks; int previous_raid_disks; int prev_chunk, prev_algo; int prev_chunk_sectors; int prev_algo; short generation; /* increments with every reshape */ short generation; /* increments with every reshape */ unsigned long reshape_checkpoint; /* Time we last updated unsigned long reshape_checkpoint; /* Time we last updated * metadata */ * metadata */ Loading