diff options
author | Andre Noll <maan@systemlinux.org> | 2009-06-17 18:45:27 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-17 18:45:27 -0400 |
commit | 664e7c413f1e90eceb0b2596dd73a0832faec058 (patch) | |
tree | 72ea827a0f2a493766d3ea1fd14909c756aa4496 /drivers/md/md.c | |
parent | 9d8f0363623b3da12c43007cf77f5e1a4e8a5964 (diff) |
md: Convert mddev->new_chunk to sectors.
A straight-forward conversion which gets rid of some
multiplications/divisions/shifts. The patch also introduces a couple
of new ones, most of which are due to conf->chunk_size still being
represented in bytes. This will be cleaned up in subsequent patches.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index abcc0fef30e3..f996d8342a85 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -886,13 +886,13 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
886 | mddev->delta_disks = sb->delta_disks; | 886 | mddev->delta_disks = sb->delta_disks; |
887 | mddev->new_level = sb->new_level; | 887 | mddev->new_level = sb->new_level; |
888 | mddev->new_layout = sb->new_layout; | 888 | mddev->new_layout = sb->new_layout; |
889 | mddev->new_chunk = sb->new_chunk; | 889 | mddev->new_chunk_sectors = sb->new_chunk >> 9; |
890 | } else { | 890 | } else { |
891 | mddev->reshape_position = MaxSector; | 891 | mddev->reshape_position = MaxSector; |
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_sectors << 9; | 895 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
896 | } | 896 | } |
897 | 897 | ||
898 | if (sb->state & (1<<MD_SB_CLEAN)) | 898 | if (sb->state & (1<<MD_SB_CLEAN)) |
@@ -1007,7 +1007,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1007 | sb->new_level = mddev->new_level; | 1007 | sb->new_level = mddev->new_level; |
1008 | sb->delta_disks = mddev->delta_disks; | 1008 | sb->delta_disks = mddev->delta_disks; |
1009 | sb->new_layout = mddev->new_layout; | 1009 | sb->new_layout = mddev->new_layout; |
1010 | sb->new_chunk = mddev->new_chunk; | 1010 | sb->new_chunk = mddev->new_chunk_sectors << 9; |
1011 | } | 1011 | } |
1012 | mddev->minor_version = sb->minor_version; | 1012 | mddev->minor_version = sb->minor_version; |
1013 | if (mddev->in_sync) | 1013 | if (mddev->in_sync) |
@@ -1304,13 +1304,13 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1304 | mddev->delta_disks = le32_to_cpu(sb->delta_disks); | 1304 | mddev->delta_disks = le32_to_cpu(sb->delta_disks); |
1305 | mddev->new_level = le32_to_cpu(sb->new_level); | 1305 | mddev->new_level = le32_to_cpu(sb->new_level); |
1306 | mddev->new_layout = le32_to_cpu(sb->new_layout); | 1306 | mddev->new_layout = le32_to_cpu(sb->new_layout); |
1307 | mddev->new_chunk = le32_to_cpu(sb->new_chunk)<<9; | 1307 | mddev->new_chunk_sectors = le32_to_cpu(sb->new_chunk); |
1308 | } else { | 1308 | } else { |
1309 | mddev->reshape_position = MaxSector; | 1309 | mddev->reshape_position = MaxSector; |
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_sectors << 9; | 1313 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | } else if (mddev->pers == NULL) { | 1316 | } else if (mddev->pers == NULL) { |
@@ -1409,7 +1409,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1409 | sb->new_layout = cpu_to_le32(mddev->new_layout); | 1409 | sb->new_layout = cpu_to_le32(mddev->new_layout); |
1410 | sb->delta_disks = cpu_to_le32(mddev->delta_disks); | 1410 | sb->delta_disks = cpu_to_le32(mddev->delta_disks); |
1411 | sb->new_level = cpu_to_le32(mddev->new_level); | 1411 | sb->new_level = cpu_to_le32(mddev->new_level); |
1412 | sb->new_chunk = cpu_to_le32(mddev->new_chunk>>9); | 1412 | sb->new_chunk = cpu_to_le32(mddev->new_chunk_sectors); |
1413 | } | 1413 | } |
1414 | 1414 | ||
1415 | max_dev = 0; | 1415 | max_dev = 0; |
@@ -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_sectors << 9; | 2756 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
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_sectors = mddev->new_chunk >> 9; | 2774 | mddev->chunk_sectors = mddev->new_chunk_sectors; |
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,8 +2864,9 @@ static ssize_t | |||
2864 | chunk_size_show(mddev_t *mddev, char *page) | 2864 | chunk_size_show(mddev_t *mddev, char *page) |
2865 | { | 2865 | { |
2866 | if (mddev->reshape_position != MaxSector && | 2866 | if (mddev->reshape_position != MaxSector && |
2867 | mddev->chunk_sectors << 9 != mddev->new_chunk) | 2867 | mddev->chunk_sectors != mddev->new_chunk_sectors) |
2868 | return sprintf(page, "%d (%d)\n", mddev->new_chunk, | 2868 | return sprintf(page, "%d (%d)\n", |
2869 | mddev->new_chunk_sectors << 9, | ||
2869 | mddev->chunk_sectors << 9); | 2870 | mddev->chunk_sectors << 9); |
2870 | return sprintf(page, "%d\n", mddev->chunk_sectors << 9); | 2871 | return sprintf(page, "%d\n", mddev->chunk_sectors << 9); |
2871 | } | 2872 | } |
@@ -2887,7 +2888,7 @@ chunk_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
2887 | if (err) | 2888 | if (err) |
2888 | return err; | 2889 | return err; |
2889 | } else { | 2890 | } else { |
2890 | mddev->new_chunk = n; | 2891 | mddev->new_chunk_sectors = n >> 9; |
2891 | if (mddev->reshape_position == MaxSector) | 2892 | if (mddev->reshape_position == MaxSector) |
2892 | mddev->chunk_sectors = n >> 9; | 2893 | mddev->chunk_sectors = n >> 9; |
2893 | } | 2894 | } |
@@ -3665,7 +3666,7 @@ reshape_position_store(mddev_t *mddev, const char *buf, size_t len) | |||
3665 | mddev->delta_disks = 0; | 3666 | mddev->delta_disks = 0; |
3666 | mddev->new_level = mddev->level; | 3667 | mddev->new_level = mddev->level; |
3667 | mddev->new_layout = mddev->layout; | 3668 | mddev->new_layout = mddev->layout; |
3668 | mddev->new_chunk = mddev->chunk_sectors << 9; | 3669 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
3669 | return len; | 3670 | return len; |
3670 | } | 3671 | } |
3671 | 3672 | ||
@@ -4414,7 +4415,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4414 | mddev->delta_disks = 0; | 4415 | mddev->delta_disks = 0; |
4415 | mddev->new_level = LEVEL_NONE; | 4416 | mddev->new_level = LEVEL_NONE; |
4416 | mddev->new_layout = 0; | 4417 | mddev->new_layout = 0; |
4417 | mddev->new_chunk = 0; | 4418 | mddev->new_chunk_sectors = 0; |
4418 | mddev->curr_resync = 0; | 4419 | mddev->curr_resync = 0; |
4419 | mddev->resync_mismatches = 0; | 4420 | mddev->resync_mismatches = 0; |
4420 | mddev->suspend_lo = mddev->suspend_hi = 0; | 4421 | mddev->suspend_lo = mddev->suspend_hi = 0; |
@@ -5083,7 +5084,7 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info) | |||
5083 | get_random_bytes(mddev->uuid, 16); | 5084 | get_random_bytes(mddev->uuid, 16); |
5084 | 5085 | ||
5085 | mddev->new_level = mddev->level; | 5086 | mddev->new_level = mddev->level; |
5086 | mddev->new_chunk = mddev->chunk_sectors << 9; | 5087 | mddev->new_chunk_sectors = mddev->chunk_sectors; |
5087 | mddev->new_layout = mddev->layout; | 5088 | mddev->new_layout = mddev->layout; |
5088 | mddev->delta_disks = 0; | 5089 | mddev->delta_disks = 0; |
5089 | 5090 | ||