Skip to content

Commit 76c3d31

Browse files
committed
Optional repartitioning when reconfiguring IO classes
With `all` parameter set repartition data from all IO classes. If `all` is unset repartition only from deleted IO classes. Signed-off-by: Daniel Madej <daniel.madej@huawei.com>
1 parent 72d2548 commit 76c3d31

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

inc/ocf_mngt.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,16 +1025,17 @@ int ocf_mngt_cache_io_classes_configure(ocf_cache_t cache,
10251025
const struct ocf_mngt_io_classes_config *cfg);
10261026

10271027
/**
1028-
* @brief Repartition lines from all IO classes to default
1028+
* @brief Repartition lines to default IO class
10291029
*
10301030
* @param[in] cache Handle for cache
10311031
* @param[in] cfg IO class configuration
1032+
* @param[in] all Repartition from all IO classes (including reconfigured)
10321033
*
10331034
* @retval 0 Repartitioning successful
10341035
* @retval Non-zero Error occurred
10351036
*/
1036-
int ocf_repart_all_to_default(ocf_cache_t cache,
1037-
const struct ocf_mngt_io_classes_config *cfg);
1037+
int ocf_repart_to_default(ocf_cache_t cache,
1038+
const struct ocf_mngt_io_classes_config *cfg, bool all);
10381039

10391040
/**
10401041
* @brief Asociate new UUID value with given core

src/mngt/ocf_mngt_io_class.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ int ocf_mngt_cache_io_classes_configure(ocf_cache_t cache,
330330
return result;
331331
}
332332

333-
int ocf_repart_all_to_default(ocf_cache_t cache,
334-
const struct ocf_mngt_io_classes_config *cfg)
333+
int ocf_repart_to_default(ocf_cache_t cache,
334+
const struct ocf_mngt_io_classes_config *cfg, bool all)
335335
{
336336
int i;
337337

@@ -342,9 +342,11 @@ int ocf_repart_all_to_default(ocf_cache_t cache,
342342
_ocf_mngt_set_partition_size(cache, i, 0, 0);
343343

344344
for (i = 1; i < OCF_USER_IO_CLASS_MAX; i++) {
345-
ocf_lru_repart_all(cache,
346-
&cache->user_parts[i].part,
347-
&cache->user_parts[0].part);
345+
if (all || !cfg->config[i].name) {
346+
ocf_lru_repart_all(cache,
347+
&cache->user_parts[i].part,
348+
&cache->user_parts[0].part);
349+
}
348350
}
349351

350352
/* Reenable IO classes */

0 commit comments

Comments
 (0)