Commit b8919745 authored by Mateusz Kozlowski's avatar Mateusz Kozlowski Committed by Ben Walker
Browse files

lib/ftl: ANM during write error handling



If an ANM event has come to a chunk/sector that has been marked as
high_prio (eg. after a write failure), there's no need to add any
sectors for relocation, as the whole band should be marked for a move
anyway.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 23b51246
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ ftl_band_set_state(struct ftl_band *band, enum ftl_band_state state)

	case FTL_BAND_STATE_CLOSED:
		if (band->state != FTL_BAND_STATE_CLOSED) {
			assert(band->state == FTL_BAND_STATE_CLOSING);
			assert(band->state == FTL_BAND_STATE_CLOSING || band->high_prio);
			_ftl_band_set_closed(band);
		}
		break;
+3 −1
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ ftl_wptr_from_band(struct ftl_band *band)
		}
	}

	assert(false);
	return NULL;
}

@@ -223,6 +222,7 @@ ftl_md_write_fail(struct ftl_io *io, int status)
	char buf[128];

	wptr = ftl_wptr_from_band(band);
	assert(wptr);

	SPDK_ERRLOG("Metadata write failed @ppa: %s, status: %d\n",
		    ftl_ppa2str(wptr->ppa, buf, sizeof(buf)), status);
@@ -240,6 +240,7 @@ ftl_md_write_cb(struct ftl_io *io, void *arg, int status)
	size_t id;

	wptr = ftl_wptr_from_band(band);
	assert(wptr);

	if (status) {
		ftl_md_write_fail(io, status);
@@ -498,6 +499,7 @@ ftl_close_direct_wptr(struct ftl_band *band)
{
	struct ftl_wptr *wptr = ftl_wptr_from_band(band);

	assert(wptr);
	assert(wptr->direct_mode);
	assert(band->state == FTL_BAND_STATE_CLOSED);

+5 −0
Original line number Diff line number Diff line
@@ -780,6 +780,11 @@ ftl_reloc_add(struct ftl_reloc *reloc, struct ftl_band *band, size_t offset,
	struct ftl_band_reloc *breloc = &reloc->brelocs[band->id];
	size_t i, prev_lbks = breloc->num_lbks;

	/* No need to add anything if already at high prio - whole band should be relocated */
	if (!prio && band->high_prio) {
		return;
	}

	pthread_spin_lock(&band->lba_map.lock);
	if (band->lba_map.num_vld == 0) {
		pthread_spin_unlock(&band->lba_map.lock);