|
|
59ea72 |
From 9529d3436771d9f38884861683dee3b40ab9d180 Mon Sep 17 00:00:00 2001
|
|
|
59ea72 |
From: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
|
|
|
59ea72 |
Date: Thu, 5 Apr 2018 13:38:37 +0200
|
|
|
59ea72 |
Subject: [RHEL7.5 PATCH 06/26] imsm: pass already existing map to
|
|
|
59ea72 |
imsm_num_data_members
|
|
|
59ea72 |
|
|
|
59ea72 |
In almost every place where imsm_num_data_members is called there is
|
|
|
59ea72 |
already existing map so it can be used it to avoid mistake when specifying
|
|
|
59ea72 |
map for imsm_num_data_members.
|
|
|
59ea72 |
|
|
|
59ea72 |
Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com>
|
|
|
59ea72 |
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
|
|
|
59ea72 |
---
|
|
|
59ea72 |
super-intel.c | 41 +++++++++++++++++++++--------------------
|
|
|
59ea72 |
1 file changed, 21 insertions(+), 20 deletions(-)
|
|
|
59ea72 |
|
|
|
59ea72 |
diff --git a/super-intel.c b/super-intel.c
|
|
|
59ea72 |
index fe2a705..3fc3cf4 100644
|
|
|
59ea72 |
--- a/super-intel.c
|
|
|
59ea72 |
+++ b/super-intel.c
|
|
|
59ea72 |
@@ -2767,13 +2767,11 @@ static __u32 num_stripes_per_unit_rebuild(struct imsm_dev *dev)
|
|
|
59ea72 |
return num_stripes_per_unit_resync(dev);
|
|
|
59ea72 |
}
|
|
|
59ea72 |
|
|
|
59ea72 |
-static __u8 imsm_num_data_members(struct imsm_dev *dev, int second_map)
|
|
|
59ea72 |
+static __u8 imsm_num_data_members(struct imsm_map *map)
|
|
|
59ea72 |
{
|
|
|
59ea72 |
/* named 'imsm_' because raid0, raid1 and raid10
|
|
|
59ea72 |
* counter-intuitively have the same number of data disks
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
- struct imsm_map *map = get_imsm_map(dev, second_map);
|
|
|
59ea72 |
-
|
|
|
59ea72 |
switch (get_imsm_raid_level(map)) {
|
|
|
59ea72 |
case 0:
|
|
|
59ea72 |
return map->num_members;
|
|
|
59ea72 |
@@ -2862,7 +2860,7 @@ static __u64 blocks_per_migr_unit(struct intel_super *super,
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
stripes_per_unit = num_stripes_per_unit_resync(dev);
|
|
|
59ea72 |
migr_chunk = migr_strip_blocks_resync(dev);
|
|
|
59ea72 |
- disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ disks = imsm_num_data_members(map);
|
|
|
59ea72 |
blocks_per_unit = stripes_per_unit * migr_chunk * disks;
|
|
|
59ea72 |
stripe = __le16_to_cpu(map->blocks_per_strip) * disks;
|
|
|
59ea72 |
segment = blocks_per_unit / stripe;
|
|
|
59ea72 |
@@ -3381,7 +3379,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
|
|
59ea72 |
(unsigned long long)blocks_per_unit,
|
|
|
59ea72 |
info->reshape_progress);
|
|
|
59ea72 |
|
|
|
59ea72 |
- used_disks = imsm_num_data_members(dev, MAP_1);
|
|
|
59ea72 |
+ used_disks = imsm_num_data_members(prev_map);
|
|
|
59ea72 |
if (used_disks > 0) {
|
|
|
59ea72 |
array_blocks = blocks_per_member(map) *
|
|
|
59ea72 |
used_disks;
|
|
|
59ea72 |
@@ -8140,9 +8138,9 @@ static void handle_missing(struct intel_super *super, struct imsm_dev *dev)
|
|
|
59ea72 |
static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
|
|
|
59ea72 |
long long new_size)
|
|
|
59ea72 |
{
|
|
|
59ea72 |
- int used_disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
unsigned long long array_blocks;
|
|
|
59ea72 |
- struct imsm_map *map;
|
|
|
59ea72 |
+ struct imsm_map *map = get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
+ int used_disks = imsm_num_data_members(map);
|
|
|
59ea72 |
|
|
|
59ea72 |
if (used_disks == 0) {
|
|
|
59ea72 |
/* when problems occures
|
|
|
59ea72 |
@@ -8155,17 +8153,15 @@ static unsigned long long imsm_set_array_size(struct imsm_dev *dev,
|
|
|
59ea72 |
|
|
|
59ea72 |
/* set array size in metadata
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
- if (new_size <= 0) {
|
|
|
59ea72 |
+ if (new_size <= 0)
|
|
|
59ea72 |
/* OLCE size change is caused by added disks
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
- map = get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
array_blocks = blocks_per_member(map) * used_disks;
|
|
|
59ea72 |
- } else {
|
|
|
59ea72 |
+ else
|
|
|
59ea72 |
/* Online Volume Size Change
|
|
|
59ea72 |
* Using available free space
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
array_blocks = new_size;
|
|
|
59ea72 |
- }
|
|
|
59ea72 |
|
|
|
59ea72 |
array_blocks = round_size_to_mb(array_blocks, used_disks);
|
|
|
59ea72 |
set_imsm_dev_size(dev, array_blocks);
|
|
|
59ea72 |
@@ -8274,7 +8270,7 @@ static int imsm_set_array_state(struct active_array *a, int consistent)
|
|
|
59ea72 |
int used_disks;
|
|
|
59ea72 |
struct mdinfo *mdi;
|
|
|
59ea72 |
|
|
|
59ea72 |
- used_disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ used_disks = imsm_num_data_members(map);
|
|
|
59ea72 |
if (used_disks > 0) {
|
|
|
59ea72 |
array_blocks =
|
|
|
59ea72 |
blocks_per_member(map) *
|
|
|
59ea72 |
@@ -9132,8 +9128,10 @@ static int apply_reshape_migration_update(struct imsm_update_reshape_migration *
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
if (u->new_chunksize > 0) {
|
|
|
59ea72 |
unsigned long long num_data_stripes;
|
|
|
59ea72 |
+ struct imsm_map *dest_map =
|
|
|
59ea72 |
+ get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
int used_disks =
|
|
|
59ea72 |
- imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ imsm_num_data_members(dest_map);
|
|
|
59ea72 |
|
|
|
59ea72 |
if (used_disks == 0)
|
|
|
59ea72 |
return ret_val;
|
|
|
59ea72 |
@@ -9210,7 +9208,7 @@ static int apply_size_change_update(struct imsm_update_size_change *u,
|
|
|
59ea72 |
if (id->index == (unsigned)u->subdev) {
|
|
|
59ea72 |
struct imsm_dev *dev = get_imsm_dev(super, u->subdev);
|
|
|
59ea72 |
struct imsm_map *map = get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
- int used_disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ int used_disks = imsm_num_data_members(map);
|
|
|
59ea72 |
unsigned long long blocks_per_member;
|
|
|
59ea72 |
unsigned long long num_data_stripes;
|
|
|
59ea72 |
|
|
|
59ea72 |
@@ -10589,7 +10587,7 @@ void init_migr_record_imsm(struct supertype *st, struct imsm_dev *dev,
|
|
|
59ea72 |
max(map_dest->blocks_per_strip, map_src->blocks_per_strip);
|
|
|
59ea72 |
migr_rec->dest_depth_per_unit *=
|
|
|
59ea72 |
max(map_dest->blocks_per_strip, map_src->blocks_per_strip);
|
|
|
59ea72 |
- new_data_disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ new_data_disks = imsm_num_data_members(map_dest);
|
|
|
59ea72 |
migr_rec->blocks_per_unit =
|
|
|
59ea72 |
__cpu_to_le32(migr_rec->dest_depth_per_unit * new_data_disks);
|
|
|
59ea72 |
migr_rec->dest_depth_per_unit =
|
|
|
59ea72 |
@@ -10657,7 +10655,7 @@ int save_backup_imsm(struct supertype *st,
|
|
|
59ea72 |
int dest_layout = 0;
|
|
|
59ea72 |
int dest_chunk;
|
|
|
59ea72 |
unsigned long long start;
|
|
|
59ea72 |
- int data_disks = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
+ int data_disks = imsm_num_data_members(map_dest);
|
|
|
59ea72 |
|
|
|
59ea72 |
targets = xmalloc(new_disks * sizeof(int));
|
|
|
59ea72 |
|
|
|
59ea72 |
@@ -11279,6 +11277,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
|
|
|
59ea72 |
int imsm_layout = -1;
|
|
|
59ea72 |
int data_disks;
|
|
|
59ea72 |
struct imsm_dev *dev;
|
|
|
59ea72 |
+ struct imsm_map *map;
|
|
|
59ea72 |
struct intel_super *super;
|
|
|
59ea72 |
unsigned long long current_size;
|
|
|
59ea72 |
unsigned long long free_size;
|
|
|
59ea72 |
@@ -11369,7 +11368,8 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
|
|
|
59ea72 |
|
|
|
59ea72 |
super = st->sb;
|
|
|
59ea72 |
dev = get_imsm_dev(super, super->current_vol);
|
|
|
59ea72 |
- data_disks = imsm_num_data_members(dev , MAP_0);
|
|
|
59ea72 |
+ map = get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
+ data_disks = imsm_num_data_members(map);
|
|
|
59ea72 |
/* compute current size per disk member
|
|
|
59ea72 |
*/
|
|
|
59ea72 |
current_size = info.custom_array_size / data_disks;
|
|
|
59ea72 |
@@ -11838,7 +11838,7 @@ static int imsm_manage_reshape(
|
|
|
59ea72 |
struct intel_dev *dv;
|
|
|
59ea72 |
unsigned int sector_size = super->sector_size;
|
|
|
59ea72 |
struct imsm_dev *dev = NULL;
|
|
|
59ea72 |
- struct imsm_map *map_src;
|
|
|
59ea72 |
+ struct imsm_map *map_src, *map_dest;
|
|
|
59ea72 |
int migr_vol_qan = 0;
|
|
|
59ea72 |
int ndata, odata; /* [bytes] */
|
|
|
59ea72 |
int chunk; /* [bytes] */
|
|
|
59ea72 |
@@ -11876,12 +11876,13 @@ static int imsm_manage_reshape(
|
|
|
59ea72 |
goto abort;
|
|
|
59ea72 |
}
|
|
|
59ea72 |
|
|
|
59ea72 |
+ map_dest = get_imsm_map(dev, MAP_0);
|
|
|
59ea72 |
map_src = get_imsm_map(dev, MAP_1);
|
|
|
59ea72 |
if (map_src == NULL)
|
|
|
59ea72 |
goto abort;
|
|
|
59ea72 |
|
|
|
59ea72 |
- ndata = imsm_num_data_members(dev, MAP_0);
|
|
|
59ea72 |
- odata = imsm_num_data_members(dev, MAP_1);
|
|
|
59ea72 |
+ ndata = imsm_num_data_members(map_dest);
|
|
|
59ea72 |
+ odata = imsm_num_data_members(map_src);
|
|
|
59ea72 |
|
|
|
59ea72 |
chunk = __le16_to_cpu(map_src->blocks_per_strip) * 512;
|
|
|
59ea72 |
old_data_stripe_length = odata * chunk;
|
|
|
59ea72 |
--
|
|
|
59ea72 |
2.7.4
|
|
|
59ea72 |
|