diff options
author | Andre Noll <maan@systemlinux.org> | 2009-06-16 02:18:43 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-16 02:18:43 -0400 |
commit | dc58266385e51420298275c90a616c34f1473a73 (patch) | |
tree | f7532a7886f71c0b4e863033e95f8b57fb1ca1f2 /drivers/md/raid0.h | |
parent | 45e3e1935e2857c54783291107d33323b3ef33c8 (diff) |
md: raid0: Replace hash table lookup by looping over all strip_zones.
The number of strip_zones of a raid0 array is bounded by the number of
drives in the array and is in fact much smaller for typical setups. For
example, any raid0 array containing identical disks will have only
a single strip_zone.
Therefore, the hash tables which are used for quickly finding the
strip_zone that holds a particular sector are of questionable value
and add quite a bit of unnecessary complexity.
This patch replaces the hash table lookup by equivalent code which
simply loops over all strip zones to find the zone that holds the
given sector.
In order to make this loop as fast as possible, the zone->start field
of struct strip_zone has been renamed to zone_end, and it now stores
the beginning of the next zone in sectors. This allows to save one
addition in the loop.
Subsequent cleanup patches will remove the hash table structure.
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid0.h')
-rw-r--r-- | drivers/md/raid0.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h index 824b12eb1d4f..556666fec3a5 100644 --- a/drivers/md/raid0.h +++ b/drivers/md/raid0.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | struct strip_zone | 4 | struct strip_zone |
5 | { | 5 | { |
6 | sector_t zone_start; /* Zone offset in md_dev (in sectors) */ | 6 | sector_t zone_end; /* Start of the next zone (in sectors) */ |
7 | sector_t dev_start; /* Zone offset in real dev (in sectors) */ | 7 | sector_t dev_start; /* Zone offset in real dev (in sectors) */ |
8 | sector_t sectors; /* Zone size in sectors */ | 8 | sector_t sectors; /* Zone size in sectors */ |
9 | int nb_dev; /* # of devices attached to the zone */ | 9 | int nb_dev; /* # of devices attached to the zone */ |