diff options
author | Andre Noll <maan@systemlinux.org> | 2009-03-30 23:33:13 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-03-30 23:33:13 -0400 |
commit | 58c0fed400603a802968b23ddf78f029c5a84e41 (patch) | |
tree | 474fcb9775bb07f39ebb7802fb9b51d69222dcbb /drivers/md/raid10.c | |
parent | 575a80fa4f623141e9791e41879d87800fb6d862 (diff) |
md: Make mddev->size sector-based.
This patch renames the "size" field of struct mddev_s to "dev_sectors"
and stores the number of 512-byte sectors instead of the number of
1K-blocks in it.
All users of that field, including raid levels 1,4-6,10, are adjusted
accordingly. This simplifies the code a bit because it allows to get
rid of a couple of divisions/multiplications by two.
In order to make checkpatch happy, some minor coding style issues
have also been addressed. In particular, size_store() now uses
strict_strtoull() instead of simple_strtoull().
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index fea61e3dcd95..d56cb2ae515f 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1698,7 +1698,7 @@ static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, i | |||
1698 | return 0; | 1698 | return 0; |
1699 | 1699 | ||
1700 | skipped: | 1700 | skipped: |
1701 | max_sector = mddev->size << 1; | 1701 | max_sector = mddev->dev_sectors; |
1702 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) | 1702 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) |
1703 | max_sector = mddev->resync_max_sectors; | 1703 | max_sector = mddev->resync_max_sectors; |
1704 | if (sector_nr >= max_sector) { | 1704 | if (sector_nr >= max_sector) { |
@@ -2079,7 +2079,7 @@ static int run(mddev_t *mddev) | |||
2079 | conf->far_offset = fo; | 2079 | conf->far_offset = fo; |
2080 | conf->chunk_mask = (sector_t)(mddev->chunk_size>>9)-1; | 2080 | conf->chunk_mask = (sector_t)(mddev->chunk_size>>9)-1; |
2081 | conf->chunk_shift = ffz(~mddev->chunk_size) - 9; | 2081 | conf->chunk_shift = ffz(~mddev->chunk_size) - 9; |
2082 | size = mddev->size >> (conf->chunk_shift-1); | 2082 | size = mddev->dev_sectors >> conf->chunk_shift; |
2083 | sector_div(size, fc); | 2083 | sector_div(size, fc); |
2084 | size = size * conf->raid_disks; | 2084 | size = size * conf->raid_disks; |
2085 | sector_div(size, nc); | 2085 | sector_div(size, nc); |
@@ -2092,7 +2092,7 @@ static int run(mddev_t *mddev) | |||
2092 | */ | 2092 | */ |
2093 | stride += conf->raid_disks - 1; | 2093 | stride += conf->raid_disks - 1; |
2094 | sector_div(stride, conf->raid_disks); | 2094 | sector_div(stride, conf->raid_disks); |
2095 | mddev->size = stride << (conf->chunk_shift-1); | 2095 | mddev->dev_sectors = stride << conf->chunk_shift; |
2096 | 2096 | ||
2097 | if (fo) | 2097 | if (fo) |
2098 | stride = 1; | 2098 | stride = 1; |