Commit ea9cec36 authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Konrad Sztyber
Browse files

lib/ftl: Improve compaction process



After switch to use P2L map in compaction process, it is possible to
obtain LBA from it instead of recalculating it in the LBA pinning process.

Change-Id: I38c3ff4eb66494f896804aaca4123ad64326a555
Signed-off-by: default avatarMariusz Barczak <Mariusz.Barczak@solidigmtechnology.com>
Signed-off-by: default avatarMateusz Kozlowski <mateusz.kozlowski@solidigm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19614


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent 1f9826d5
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -727,8 +727,6 @@ compaction_process_pin_lba_cb(struct spdk_ftl_dev *dev, int status, struct ftl_l
	}
}

static uint64_t ftl_chunk_map_get_lba_from_addr(struct ftl_nv_cache_chunk *chunk, ftl_addr addr);

static void
compaction_process_pin_lba(struct ftl_nv_cache_compactor *comp)
{
@@ -741,11 +739,8 @@ compaction_process_pin_lba(struct ftl_nv_cache_compactor *comp)
	rq->iter.status = 0;

	FTL_RQ_ENTRY_LOOP(rq, entry, rq->iter.count) {
		struct ftl_nv_cache_chunk *chunk = entry->owner.priv;
		struct ftl_l2p_pin_ctx *pin_ctx = &entry->l2p_pin_ctx;

		entry->lba = ftl_chunk_map_get_lba_from_addr(chunk, entry->addr);

		if (entry->lba == FTL_LBA_INVALID) {
			ftl_l2p_pin_skip(dev, compaction_process_pin_lba_cb, comp, pin_ctx);
		} else {
@@ -1032,6 +1027,7 @@ compaction_entry_read_pos(struct ftl_nv_cache *nv_cache, struct ftl_rq_entry *en
	/* Set entry address info and chunk */
	entry->addr = addr;
	entry->owner.priv = chunk;
	entry->lba = ftl_chunk_map_get_lba(chunk, chunk->md->read_pointer);

	/* Move read pointer in the chunk */
	chunk->md->read_pointer++;
@@ -1374,17 +1370,6 @@ ftl_chunk_set_addr(struct ftl_nv_cache_chunk *chunk, uint64_t lba, ftl_addr addr
	ftl_chunk_map_set_lba(chunk, offset, lba);
}

static uint64_t
ftl_chunk_map_get_lba_from_addr(struct ftl_nv_cache_chunk *chunk, ftl_addr addr)
{
	struct spdk_ftl_dev *dev = SPDK_CONTAINEROF(chunk->nv_cache, struct spdk_ftl_dev, nv_cache);
	uint64_t cache_offset = ftl_addr_to_nvc_offset(dev, addr);
	uint64_t offset;

	offset = (cache_offset - chunk->offset) % chunk->nv_cache->chunk_blocks;
	return ftl_chunk_map_get_lba(chunk, offset);
}

struct ftl_nv_cache_chunk *
ftl_nv_cache_get_chunk_from_addr(struct spdk_ftl_dev *dev, ftl_addr addr)
{