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 */ /* IO pool size per user thread */
size_t user_io_pool_size; size_t user_io_pool_size;
struct {
/* Lowest percentage of invalid lbks for a band to be defragged */ /* Lowest percentage of invalid lbks for a band to be defragged */
size_t invalid_thld; size_t invalid_thld;
/* User writes limits */ /* User writes limits */
struct spdk_ftl_limit limits[SPDK_FTL_LIMIT_MAX]; struct spdk_ftl_limit limits[SPDK_FTL_LIMIT_MAX];
} defrag;
/* Number of interleaving units per ws_opt */ /* Number of interleaving units per ws_opt */
size_t num_interleave_units; 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) ftl_get_limit(const struct spdk_ftl_dev *dev, int type)
{ {
assert(type < SPDK_FTL_LIMIT_MAX); assert(type < SPDK_FTL_LIMIT_MAX);
return &dev->conf.defrag.limits[type]; return &dev->conf.limits[type];
} }
static bool static bool
@ -1814,7 +1814,7 @@ ftl_band_needs_defrag(struct ftl_band *band, struct spdk_ftl_dev *dev)
return true; 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); return band->merit > ftl_band_calc_merit(band, &thld_vld);
} }

View File

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