Commit a039d024 authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Jim Harris
Browse files

lib/ftl: Remove anonymous defrag structure in config



Merged configuration fields for defrag into the main config structure.

Signed-off-by: default avatarMateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I315c78e2843bd6a310b484af5b688aca424336b0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460518


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 5a16b8e6
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -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;

	/* User writes limits */
	struct spdk_ftl_limit			limits[SPDK_FTL_LIMIT_MAX];
	} defrag;

	/* Number of interleaving units per ws_opt */
	size_t                                  num_interleave_units;
+2 −2
Original line number Diff line number Diff line
@@ -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);
}
+13 −15
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ 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 },
@@ -79,7 +78,6 @@ static const struct spdk_ftl_conf g_default_conf = {
	},
	/* 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;
		}
	}