mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-10 14:26:44 +07:00
ab5bd5cbc8
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>
32 lines
576 B
C
32 lines
576 B
C
#ifndef _LINEAR_H
|
|
#define _LINEAR_H
|
|
|
|
#include <linux/raid/md.h>
|
|
|
|
struct dev_info {
|
|
mdk_rdev_t *rdev;
|
|
sector_t num_sectors;
|
|
sector_t start_sector;
|
|
};
|
|
|
|
typedef struct dev_info dev_info_t;
|
|
|
|
struct linear_private_data
|
|
{
|
|
struct linear_private_data *prev; /* earlier version */
|
|
dev_info_t **hash_table;
|
|
sector_t spacing;
|
|
sector_t array_sectors;
|
|
int sector_shift; /* shift before dividing
|
|
* by spacing
|
|
*/
|
|
dev_info_t disks[0];
|
|
};
|
|
|
|
|
|
typedef struct linear_private_data linear_conf_t;
|
|
|
|
#define mddev_to_conf(mddev) ((linear_conf_t *) mddev->private)
|
|
|
|
#endif
|