aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/raid
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2008-10-12 20:55:12 -0400
committerNeilBrown <neilb@suse.de>2008-10-12 20:55:12 -0400
commitab5bd5cbc8d4b868378d062eed3d4240930fbb86 (patch)
tree39c6299f79398d7f00b50c4ba39c52e2aea22e00 /include/linux/raid
parent23242fbb470ff4c8c4d41f178832cf1929273d7d (diff)
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.h6
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
15{ 15{
16 struct linear_private_data *prev; /* earlier version */ 16 struct linear_private_data *prev; /* earlier version */
17 dev_info_t **hash_table; 17 dev_info_t **hash_table;
18 sector_t hash_spacing; 18 sector_t spacing;
19 sector_t array_sectors; 19 sector_t array_sectors;
20 int preshift; /* shift before dividing by hash_spacing */ 20 int sector_shift; /* shift before dividing
21 * by spacing
22 */
21 dev_info_t disks[0]; 23 dev_info_t disks[0];
22}; 24};
23 25