lib/ftl: Remove anonymous defrag structure in config

Merged configuration fields for defrag into the main config structure.

Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I315c78e2843bd6a310b484af5b688aca424336b0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460518
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Mateusz Kozlowski 2019-07-04 14:41:08 +02:00 committed by Jim Harris
parent 5a16b8e671
commit a039d024ff
3 changed files with 19 additions and 23 deletions

View File

@ -83,13 +83,11 @@ struct spdk_ftl_conf {
/* IO pool size per user thread */
size_t user_io_pool_size;
struct {
/* Lowest percentage of invalid lbks for a band to be defragged */
size_t invalid_thld;
/* Lowest percentage of invalid lbks for a band to be defragged */
size_t invalid_thld;
/* User writes limits */
struct spdk_ftl_limit limits[SPDK_FTL_LIMIT_MAX];
} defrag;
/* User writes limits */
struct spdk_ftl_limit limits[SPDK_FTL_LIMIT_MAX];
/* Number of interleaving units per ws_opt */
size_t num_interleave_units;

View File

@ -660,7 +660,7 @@ static const struct spdk_ftl_limit *
ftl_get_limit(const struct spdk_ftl_dev *dev, int type)
{
assert(type < SPDK_FTL_LIMIT_MAX);
return &dev->conf.defrag.limits[type];
return &dev->conf.limits[type];
}
static bool
@ -1814,7 +1814,7 @@ ftl_band_needs_defrag(struct ftl_band *band, struct spdk_ftl_dev *dev)
return true;
}
thld_vld = (ftl_band_num_usable_lbks(band) * conf->defrag.invalid_thld) / 100;
thld_vld = (ftl_band_num_usable_lbks(band) * conf->invalid_thld) / 100;
return band->merit > ftl_band_calc_merit(band, &thld_vld);
}

View File

@ -66,20 +66,18 @@ struct ftl_admin_cmpl {
static STAILQ_HEAD(, spdk_ftl_dev) g_ftl_queue = STAILQ_HEAD_INITIALIZER(g_ftl_queue);
static pthread_mutex_t g_ftl_queue_lock = PTHREAD_MUTEX_INITIALIZER;
static const struct spdk_ftl_conf g_default_conf = {
.defrag = {
.limits = {
/* 5 free bands / 0 % host writes */
[SPDK_FTL_LIMIT_CRIT] = { .thld = 5, .limit = 0 },
/* 10 free bands / 5 % host writes */
[SPDK_FTL_LIMIT_HIGH] = { .thld = 10, .limit = 5 },
/* 20 free bands / 40 % host writes */
[SPDK_FTL_LIMIT_LOW] = { .thld = 20, .limit = 40 },
/* 40 free bands / 100 % host writes - defrag starts running */
[SPDK_FTL_LIMIT_START] = { .thld = 40, .limit = 100 },
},
/* 10 percent valid lbks */
.invalid_thld = 10,
.limits = {
/* 5 free bands / 0 % host writes */
[SPDK_FTL_LIMIT_CRIT] = { .thld = 5, .limit = 0 },
/* 10 free bands / 5 % host writes */
[SPDK_FTL_LIMIT_HIGH] = { .thld = 10, .limit = 5 },
/* 20 free bands / 40 % host writes */
[SPDK_FTL_LIMIT_LOW] = { .thld = 20, .limit = 40 },
/* 40 free bands / 100 % host writes - defrag starts running */
[SPDK_FTL_LIMIT_START] = { .thld = 40, .limit = 100 },
},
/* 10 percent valid lbks */
.invalid_thld = 10,
/* 20% spare lbks */
.lba_rsvd = 20,
/* 6M write buffer */
@ -141,7 +139,7 @@ ftl_check_conf(const struct spdk_ftl_conf *conf,
{
size_t i;
if (conf->defrag.invalid_thld >= 100) {
if (conf->invalid_thld >= 100) {
return -1;
}
if (conf->lba_rsvd >= 100) {
@ -161,7 +159,7 @@ ftl_check_conf(const struct spdk_ftl_conf *conf,
}
for (i = 0; i < SPDK_FTL_LIMIT_MAX; ++i) {
if (conf->defrag.limits[i].limit > 100) {
if (conf->limits[i].limit > 100) {
return -1;
}
}