diff options
author | Andre Noll <maan@systemlinux.org> | 2008-10-13 11:55:12 +1100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-10-13 11:55:12 +1100 |
commit | ab5bd5cbc8d4b868378d062eed3d4240930fbb86 (patch) | |
tree | 39c6299f79398d7f00b50c4ba39c52e2aea22e00 /include/linux/raid | |
parent | 23242fbb470ff4c8c4d41f178832cf1929273d7d (diff) | |
download | linux-ab5bd5cbc8d4b868378d062eed3d4240930fbb86.tar.gz linux-ab5bd5cbc8d4b868378d062eed3d4240930fbb86.tar.bz2 linux-ab5bd5cbc8d4b868378d062eed3d4240930fbb86.zip |
md: Convert remaining 1k representations in linear.c to sectors.
This patch renames hash_spacing and preshift to spacing and
sector_shift respectively with the following change of semantics:
Case 1: (sizeof(sector_t) <= sizeof(u32)).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this case, we have sector_shift = preshift = 0 and spacing =
2 * hash_spacing.
Hence, the index for the hash table which is computed by the new code
in which_dev() as sector / spacing equals the old value which was
(sector/2) / hash_spacing.
Note also that the value of nb_zone stays the same because both sz
and base double.
Case 2: (sizeof(sector_t) > sizeof(u32)).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(aka the shifting dance case). Here we have sector_shift = preshift +
1 and
spacing = 2 * hash_spacing
during the computation of nb_zone and curr_sector, but
spacing = hash_spacing
in which_dev() because in the last hunk of the patch for linear.c we
shift down conf->spacing (= 2 * hash_spacing) by one more bit than
in the old code.
Hence in the computation of nb_zone, sz and base have the same value
as before, so nb_zone is not affected. Also curr_sector in the next
hunk stays the same.
In which_dev() the hash table index is computed as
(sector >> sector_shift) / spacing
In view of sector_shift = preshift + 1 and spacing = hash_spacing,
this equals
((sector/2) >> preshift) / hash_spacing
which is the value computed by the old code.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'include/linux/raid')
-rw-r--r-- | include/linux/raid/linear.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/raid/linear.h b/include/linux/raid/linear.h index 87090e98529f..f38b9c586afb 100644 --- a/include/linux/raid/linear.h +++ b/include/linux/raid/linear.h @@ -15,9 +15,11 @@ struct linear_private_data { struct linear_private_data *prev; /* earlier version */ dev_info_t **hash_table; - sector_t hash_spacing; + sector_t spacing; sector_t array_sectors; - int preshift; /* shift before dividing by hash_spacing */ + int sector_shift; /* shift before dividing + * by spacing + */ dev_info_t disks[0]; }; |