lib/ftl: Added assert checks to ftl_band_set_state()
Change-Id: I142ea5be2e5d03b29dc17896fe590a1af798b11f Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451873 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
fcd2364c6a
commit
2646670781
@ -185,9 +185,6 @@ _ftl_band_set_free(struct ftl_band *band)
|
||||
struct spdk_ftl_dev *dev = band->dev;
|
||||
struct ftl_band *lband, *prev;
|
||||
|
||||
/* Verify band's previous state */
|
||||
assert(band->state == FTL_BAND_STATE_CLOSED);
|
||||
|
||||
if (band == dev->df_band) {
|
||||
dev->df_band = NULL;
|
||||
}
|
||||
@ -231,8 +228,6 @@ _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_FREE);
|
||||
/* Remove band from free list */
|
||||
LIST_REMOVE(band, list_entry);
|
||||
|
||||
@ -250,11 +245,6 @@ _ftl_band_set_closed(struct ftl_band *band)
|
||||
struct spdk_ftl_dev *dev = band->dev;
|
||||
struct ftl_chunk *chunk;
|
||||
|
||||
/* TODO: add this kind of check in band_set_state() */
|
||||
if (band->state == FTL_BAND_STATE_CLOSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the state as free_md() checks for that */
|
||||
band->state = FTL_BAND_STATE_CLOSED;
|
||||
|
||||
@ -460,15 +450,20 @@ ftl_band_set_state(struct ftl_band *band, enum ftl_band_state state)
|
||||
{
|
||||
switch (state) {
|
||||
case FTL_BAND_STATE_FREE:
|
||||
assert(band->state == FTL_BAND_STATE_CLOSED);
|
||||
_ftl_band_set_free(band);
|
||||
break;
|
||||
|
||||
case FTL_BAND_STATE_PREP:
|
||||
assert(band->state == FTL_BAND_STATE_FREE);
|
||||
_ftl_band_set_preparing(band);
|
||||
break;
|
||||
|
||||
case FTL_BAND_STATE_CLOSED:
|
||||
_ftl_band_set_closed(band);
|
||||
if (band->state != FTL_BAND_STATE_CLOSED) {
|
||||
assert(band->state == FTL_BAND_STATE_CLOSING);
|
||||
_ftl_band_set_closed(band);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user