1. 16 Jun, 2009 6 commits
    • Andre Noll's avatar
      md: raid0: Allocate all buffers for the raid0 configuration in one function. · ed7b0038
      Andre Noll authored
      Currently the raid0 configuration is allocated in raid0_run() while
      the buffers for the strip_zone and the dev_list arrays are allocated
      in create_strip_zones(). On errors, all three buffers are freed
      in raid0_run().
      
      It's easier and more readable to do the allocation and cleanup within
      a single function. So move that code into create_strip_zones().
      Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      ed7b0038
    • Andre Noll's avatar
      md: raid0: Make raid0_run() return a proper error code. · 5568a603
      Andre Noll authored
      Currently raid0_run() always returns -ENOMEM on errors. This is
      incorrect as running the array might fail for other reasons, for
      example because not all component devices were available.
      
      This patch changes create_strip_zones() so that it returns a proper
      error code (either -ENOMEM or -EINVAL) rather than 1 on errors and
      makes raid0_run(), its single caller, return that value instead
      of -ENOMEM.
      Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      5568a603
    • Andre Noll's avatar
      md: raid0: Remove hash spacing and sector shift. · 8f79cfcd
      Andre Noll authored
      The "sector_shift" and "spacing" fields of struct raid0_private_data
      were only used for the hash table lookups. So the removal of the
      hash table allows get rid of these fields as well which simplifies
      create_strip_zones() and raid0_run() quite a bit.
      Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      8f79cfcd
    • Andre Noll's avatar
      md: raid0: Remove hash table. · 09770e0b
      Andre Noll authored
      The raid0 hash table has become unused due to the changes in the
      previous patch. This patch removes the hash table allocation and
      setup code and kills the hash_table field of struct raid0_private_data.
      Signed-off-by: default avatarAndre Noll <maan@systemlinux.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      09770e0b
    • NeilBrown's avatar
      md/raid0: two cleanups in create_stripe_zones. · d27a43ab
      NeilBrown authored
      1/ remove current_start.  The same value is available in
           zone->dev_start and storing it separately doesn't gain anything.
      2/ rename curr_zone_start to curr_zone_end as we are now more
           focused on the 'end' of each zone.  We end up storing the
           same number though - the old name was a little confusing
           (and what does 'current' mean in this context anyway).
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      d27a43ab
    • Andre Noll's avatar
      md: raid0: Replace hash table lookup by looping over all strip_zones. · dc582663
      Andre Noll authored
      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: default avatarAndre Noll <maan@systemlinux.org>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      dc582663
  2. 14 Jun, 2009 32 commits
  3. 13 Jun, 2009 2 commits