lib/ftl: Fix band picking for write pointer
Removing band from "free list" is moved from FTL_BAND_STATE_OPENING to FTL_BAND_STATE_PREP state's change actions. This will fix race condition when one band is prepared (erased) and write pointer is trying to get next active band. Change-Id: I9e4fe9482a01ee732271736e4a0e6fcedf2582d8 Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/445118 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447461 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
e22df3fbcf
commit
f882a577d4
@ -224,13 +224,14 @@ _ftl_band_set_free(struct ftl_band *band)
|
||||
}
|
||||
|
||||
static void
|
||||
_ftl_band_set_opening(struct ftl_band *band)
|
||||
_ftl_band_set_preparing(struct ftl_band *band)
|
||||
{
|
||||
struct spdk_ftl_dev *dev = band->dev;
|
||||
struct ftl_md *md = &band->md;
|
||||
|
||||
/* Verify band's previous state */
|
||||
assert(band->state == FTL_BAND_STATE_PREP);
|
||||
assert(band->state == FTL_BAND_STATE_FREE);
|
||||
/* Remove band from free list */
|
||||
LIST_REMOVE(band, list_entry);
|
||||
|
||||
md->wr_cnt++;
|
||||
@ -467,8 +468,8 @@ ftl_band_set_state(struct ftl_band *band, enum ftl_band_state state)
|
||||
_ftl_band_set_free(band);
|
||||
break;
|
||||
|
||||
case FTL_BAND_STATE_OPENING:
|
||||
_ftl_band_set_opening(band);
|
||||
case FTL_BAND_STATE_PREP:
|
||||
_ftl_band_set_preparing(band);
|
||||
break;
|
||||
|
||||
case FTL_BAND_STATE_CLOSED:
|
||||
|
Loading…
Reference in New Issue
Block a user