]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
md: Convert remaining 1k representations in linear.c to sectors.
authorAndre Noll <maan@systemlinux.org>
Mon, 13 Oct 2008 00:55:12 +0000 (11:55 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 13 Oct 2008 00:55:12 +0000 (11:55 +1100)
commitab5bd5cbc8d4b868378d062eed3d4240930fbb86
tree39c6299f79398d7f00b50c4ba39c52e2aea22e00
parent23242fbb470ff4c8c4d41f178832cf1929273d7d
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>
drivers/md/linear.c
include/linux/raid/linear.h