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: Mateusz Kozlowski <mateusz.kozlowski@intel.com>
Change-Id: I57824ba7e592540ea639f9f011149210fd688a5a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463289
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Mateusz Kozlowski 2019-07-26 10:57:38 +02:00 committed by Ben Walker
parent 23b5124617
commit b8919745c5
3 changed files with 9 additions and 2 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);