aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a02bde70874b..abcc0fef30e3 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -869,7 +869,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
869 mddev->minor_version = sb->minor_version; 869 mddev->minor_version = sb->minor_version;
870 mddev->patch_version = sb->patch_version; 870 mddev->patch_version = sb->patch_version;
871 mddev->external = 0; 871 mddev->external = 0;
872 mddev->chunk_size = sb->chunk_size; 872 mddev->chunk_sectors = sb->chunk_size >> 9;
873 mddev->ctime = sb->ctime; 873 mddev->ctime = sb->ctime;
874 mddev->utime = sb->utime; 874 mddev->utime = sb->utime;
875 mddev->level = sb->level; 875 mddev->level = sb->level;
@@ -892,7 +892,7 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
892 mddev->delta_disks = 0; 892 mddev->delta_disks = 0;
893 mddev->new_level = mddev->level; 893 mddev->new_level = mddev->level;
894 mddev->new_layout = mddev->layout; 894 mddev->new_layout = mddev->layout;
895 mddev->new_chunk = mddev->chunk_size; 895 mddev->new_chunk = mddev->chunk_sectors << 9;
896 } 896 }
897 897
898 if (sb->state & (1<<MD_SB_CLEAN)) 898 if (sb->state & (1<<MD_SB_CLEAN))
@@ -1021,7 +1021,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1021 sb->recovery_cp = 0; 1021 sb->recovery_cp = 0;
1022 1022
1023 sb->layout = mddev->layout; 1023 sb->layout = mddev->layout;
1024 sb->chunk_size = mddev->chunk_size; 1024 sb->chunk_size = mddev->chunk_sectors << 9;
1025 1025
1026 if (mddev->bitmap && mddev->bitmap_file == NULL) 1026 if (mddev->bitmap && mddev->bitmap_file == NULL)
1027 sb->state |= (1<<MD_SB_BITMAP_PRESENT); 1027 sb->state |= (1<<MD_SB_BITMAP_PRESENT);
@@ -1278,7 +1278,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
1278 mddev->major_version = 1; 1278 mddev->major_version = 1;
1279 mddev->patch_version = 0; 1279 mddev->patch_version = 0;
1280 mddev->external = 0; 1280 mddev->external = 0;
1281 mddev->chunk_size = le32_to_cpu(sb->chunksize) << 9; 1281 mddev->chunk_sectors = le32_to_cpu(sb->chunksize);
1282 mddev->ctime = le64_to_cpu(sb->ctime) & ((1ULL << 32)-1); 1282 mddev->ctime = le64_to_cpu(sb->ctime) & ((1ULL << 32)-1);
1283 mddev->utime = le64_to_cpu(sb->utime) & ((1ULL << 32)-1); 1283 mddev->utime = le64_to_cpu(sb->utime) & ((1ULL << 32)-1);
1284 mddev->level = le32_to_cpu(sb->level); 1284 mddev->level = le32_to_cpu(sb->level);
@@ -1310,7 +1310,7 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev)
1310 mddev->delta_disks = 0; 1310 mddev->delta_disks = 0;
1311 mddev->new_level = mddev->level; 1311 mddev->new_level = mddev->level;
1312 mddev->new_layout = mddev->layout; 1312 mddev->new_layout = mddev->layout;
1313 mddev->new_chunk = mddev->chunk_size; 1313 mddev->new_chunk = mddev->chunk_sectors << 9;
1314 } 1314 }
1315 1315
1316 } else if (mddev->pers == NULL) { 1316 } else if (mddev->pers == NULL) {
@@ -1382,7 +1382,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
1382 1382
1383 sb->raid_disks = cpu_to_le32(mddev->raid_disks); 1383 sb->raid_disks = cpu_to_le32(mddev->raid_disks);
1384 sb->size = cpu_to_le64(mddev->dev_sectors); 1384 sb->size = cpu_to_le64(mddev->dev_sectors);
1385 sb->chunksize = cpu_to_le32(mddev->chunk_size >> 9); 1385 sb->chunksize = cpu_to_le32(mddev->chunk_sectors);
1386 sb->level = cpu_to_le32(mddev->level); 1386 sb->level = cpu_to_le32(mddev->level);
1387 sb->layout = cpu_to_le32(mddev->layout); 1387 sb->layout = cpu_to_le32(mddev->layout);
1388 1388
@@ -2753,7 +2753,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
2753 if (IS_ERR(priv)) { 2753 if (IS_ERR(priv)) {
2754 mddev->new_level = mddev->level; 2754 mddev->new_level = mddev->level;
2755 mddev->new_layout = mddev->layout; 2755 mddev->new_layout = mddev->layout;
2756 mddev->new_chunk = mddev->chunk_size; 2756 mddev->new_chunk = mddev->chunk_sectors << 9;
2757 mddev->raid_disks -= mddev->delta_disks; 2757 mddev->raid_disks -= mddev->delta_disks;
2758 mddev->delta_disks = 0; 2758 mddev->delta_disks = 0;
2759 module_put(pers->owner); 2759 module_put(pers->owner);
@@ -2771,7 +2771,7 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
2771 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); 2771 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel));
2772 mddev->level = mddev->new_level; 2772 mddev->level = mddev->new_level;
2773 mddev->layout = mddev->new_layout; 2773 mddev->layout = mddev->new_layout;
2774 mddev->chunk_size = mddev->new_chunk; 2774 mddev->chunk_sectors = mddev->new_chunk >> 9;
2775 mddev->delta_disks = 0; 2775 mddev->delta_disks = 0;
2776 pers->run(mddev); 2776 pers->run(mddev);
2777 mddev_resume(mddev); 2777 mddev_resume(mddev);
@@ -2864,10 +2864,10 @@ static ssize_t
2864chunk_size_show(mddev_t *mddev, char *page) 2864chunk_size_show(mddev_t *mddev, char *page)
2865{ 2865{
2866 if (mddev->reshape_position != MaxSector && 2866 if (mddev->reshape_position != MaxSector &&
2867 mddev->chunk_size != mddev->new_chunk) 2867 mddev->chunk_sectors << 9 != mddev->new_chunk)
2868 return sprintf(page, "%d (%d)\n", mddev->new_chunk, 2868 return sprintf(page, "%d (%d)\n", mddev->new_chunk,
2869 mddev->chunk_size); 2869 mddev->chunk_sectors << 9);
2870 return sprintf(page, "%d\n", mddev->chunk_size); 2870 return sprintf(page, "%d\n", mddev->chunk_sectors << 9);
2871} 2871}
2872 2872
2873static ssize_t 2873static ssize_t
@@ -2889,7 +2889,7 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len)
2889 } else { 2889 } else {
2890 mddev->new_chunk = n; 2890 mddev->new_chunk = n;
2891 if (mddev->reshape_position == MaxSector) 2891 if (mddev->reshape_position == MaxSector)
2892 mddev->chunk_size = n; 2892 mddev->chunk_sectors = n >> 9;
2893 } 2893 }
2894 return len; 2894 return len;
2895} 2895}
@@ -3534,9 +3534,9 @@ min_sync_store(mddev_t *mddev, const char *buf, size_t len)
3534 return -EBUSY; 3534 return -EBUSY;
3535 3535
3536 /* Must be a multiple of chunk_size */ 3536 /* Must be a multiple of chunk_size */
3537 if (mddev->chunk_size) { 3537 if (mddev->chunk_sectors) {
3538 sector_t temp = min; 3538 sector_t temp = min;
3539 if (sector_div(temp, (mddev->chunk_size>>9))) 3539 if (sector_div(temp, mddev->chunk_sectors))
3540 return -EINVAL; 3540 return -EINVAL;
3541 } 3541 }
3542 mddev->resync_min = min; 3542 mddev->resync_min = min;
@@ -3572,9 +3572,9 @@ max_sync_store(mddev_t *mddev, const char *buf, size_t len)
3572 return -EBUSY; 3572 return -EBUSY;
3573 3573
3574 /* Must be a multiple of chunk_size */ 3574 /* Must be a multiple of chunk_size */
3575 if (mddev->chunk_size) { 3575 if (mddev->chunk_sectors) {
3576 sector_t temp = max; 3576 sector_t temp = max;
3577 if (sector_div(temp, (mddev->chunk_size>>9))) 3577 if (sector_div(temp, mddev->chunk_sectors))
3578 return -EINVAL; 3578 return -EINVAL;
3579 } 3579 }
3580 mddev->resync_max = max; 3580 mddev->resync_max = max;
@@ -3665,7 +3665,7 @@ reshape_position_store(mddev_t *mddev, const char *buf, size_t len)
3665 mddev->delta_disks = 0; 3665 mddev->delta_disks = 0;
3666 mddev->new_level = mddev->level; 3666 mddev->new_level = mddev->level;
3667 mddev->new_layout = mddev->layout; 3667 mddev->new_layout = mddev->layout;
3668 mddev->new_chunk = mddev->chunk_size; 3668 mddev->new_chunk = mddev->chunk_sectors << 9;
3669 return len; 3669 return len;
3670} 3670}
3671 3671
@@ -4007,7 +4007,7 @@ static int do_md_run(mddev_t * mddev)
4007 analyze_sbs(mddev); 4007 analyze_sbs(mddev);
4008 } 4008 }
4009 4009
4010 chunk_size = mddev->chunk_size; 4010 chunk_size = mddev->chunk_sectors << 9;
4011 4011
4012 if (chunk_size) { 4012 if (chunk_size) {
4013 if (chunk_size > MAX_CHUNK_SIZE) { 4013 if (chunk_size > MAX_CHUNK_SIZE) {
@@ -4406,7 +4406,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4406 mddev->flags = 0; 4406 mddev->flags = 0;
4407 mddev->ro = 0; 4407 mddev->ro = 0;
4408 mddev->metadata_type[0] = 0; 4408 mddev->metadata_type[0] = 0;
4409 mddev->chunk_size = 0; 4409 mddev->chunk_sectors = 0;
4410 mddev->ctime = mddev->utime = 0; 4410 mddev->ctime = mddev->utime = 0;
4411 mddev->layout = 0; 4411 mddev->layout = 0;
4412 mddev->max_disks = 0; 4412 mddev->max_disks = 0;
@@ -4619,7 +4619,7 @@ static int get_array_info(mddev_t * mddev, void __user * arg)
4619 info.spare_disks = spare; 4619 info.spare_disks = spare;
4620 4620
4621 info.layout = mddev->layout; 4621 info.layout = mddev->layout;
4622 info.chunk_size = mddev->chunk_size; 4622 info.chunk_size = mddev->chunk_sectors << 9;
4623 4623
4624 if (copy_to_user(arg, &info, sizeof(info))) 4624 if (copy_to_user(arg, &info, sizeof(info)))
4625 return -EFAULT; 4625 return -EFAULT;
@@ -4844,7 +4844,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
4844 rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; 4844 rdev->sb_start = rdev->bdev->bd_inode->i_size / 512;
4845 } else 4845 } else
4846 rdev->sb_start = calc_dev_sboffset(rdev->bdev); 4846 rdev->sb_start = calc_dev_sboffset(rdev->bdev);
4847 rdev->sectors = calc_num_sectors(rdev, mddev->chunk_size); 4847 rdev->sectors = calc_num_sectors(rdev,
4848 mddev->chunk_sectors << 9);
4848 4849
4849 err = bind_rdev_to_array(rdev, mddev); 4850 err = bind_rdev_to_array(rdev, mddev);
4850 if (err) { 4851 if (err) {
@@ -4914,7 +4915,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
4914 else 4915 else
4915 rdev->sb_start = rdev->bdev->bd_inode->i_size / 512; 4916 rdev->sb_start = rdev->bdev->bd_inode->i_size / 512;
4916 4917
4917 rdev->sectors = calc_num_sectors(rdev, mddev->chunk_size); 4918 rdev->sectors = calc_num_sectors(rdev, mddev->chunk_sectors << 9);
4918 4919
4919 if (test_bit(Faulty, &rdev->flags)) { 4920 if (test_bit(Faulty, &rdev->flags)) {
4920 printk(KERN_WARNING 4921 printk(KERN_WARNING
@@ -5063,7 +5064,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
5063 mddev->external = 0; 5064 mddev->external = 0;
5064 5065
5065 mddev->layout = info->layout; 5066 mddev->layout = info->layout;
5066 mddev->chunk_size = info->chunk_size; 5067 mddev->chunk_sectors = info->chunk_size >> 9;
5067 5068
5068 mddev->max_disks = MD_SB_DISKS; 5069 mddev->max_disks = MD_SB_DISKS;
5069 5070
@@ -5082,7 +5083,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
5082 get_random_bytes(mddev->uuid, 16); 5083 get_random_bytes(mddev->uuid, 16);
5083 5084
5084 mddev->new_level = mddev->level; 5085 mddev->new_level = mddev->level;
5085 mddev->new_chunk = mddev->chunk_size; 5086 mddev->new_chunk = mddev->chunk_sectors << 9;
5086 mddev->new_layout = mddev->layout; 5087 mddev->new_layout = mddev->layout;
5087 mddev->delta_disks = 0; 5088 mddev->delta_disks = 0;
5088 5089
@@ -5192,7 +5193,7 @@ static int update_array_info(mddev_t *mddev, mdu_array_info_t *info)
5192 mddev->level != info->level || 5193 mddev->level != info->level ||
5193/* mddev->layout != info->layout || */ 5194/* mddev->layout != info->layout || */
5194 !mddev->persistent != info->not_persistent|| 5195 !mddev->persistent != info->not_persistent||
5195 mddev->chunk_size != info->chunk_size || 5196 mddev->chunk_sectors != info->chunk_size >> 9 ||
5196 /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */ 5197 /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */
5197 ((state^info->state) & 0xfffffe00) 5198 ((state^info->state) & 0xfffffe00)
5198 ) 5199 )