lib/ftl: Fix lba_map cleanup during restore
Band's lba_map needs to be set to NULL before restore completes, as it's not allocated on a per band basis and instead uses a pool from restore struct itself. Without the fix initializing a band for writing would hit an assert during proper allocation in ftl_band_alloc_lba_map. Signed-off-by: Mateusz Kozlowski <mateusz.kozlowski@intel.com> Change-Id: Icff4f54cbe722cb6030b9dfd55726b9b0d6c1e27 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458422 Reviewed-by: Konrad Sztyber <konrad.sztyber@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> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
8c69654d5a
commit
67d027ece9
@ -353,7 +353,6 @@ ftl_restore_l2p(struct ftl_band *band)
|
|||||||
ftl_l2p_set(dev, lba, ppa);
|
ftl_l2p_set(dev, lba, ppa);
|
||||||
}
|
}
|
||||||
|
|
||||||
band->lba_map.map = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,13 +504,13 @@ ftl_restore_pad_band(struct ftl_restore_band *rband)
|
|||||||
|
|
||||||
/* Check if some chunks are not closed */
|
/* Check if some chunks are not closed */
|
||||||
if (ftl_pad_chunk_pad_finish(rband, false)) {
|
if (ftl_pad_chunk_pad_finish(rband, false)) {
|
||||||
/* If we're here, end meta wasn't recognized, but the whole band is written */
|
/*
|
||||||
/* Assume the band was padded and ignore it */
|
* If we're here, end meta wasn't recognized, but the whole band is written
|
||||||
|
* Assume the band was padded and ignore it
|
||||||
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The LBA map was assigned from restore pool */
|
|
||||||
band->lba_map.map = NULL;
|
|
||||||
band->state = FTL_BAND_STATE_OPEN;
|
band->state = FTL_BAND_STATE_OPEN;
|
||||||
rc = ftl_band_set_direct_access(band, true);
|
rc = ftl_band_set_direct_access(band, true);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@ -591,6 +590,13 @@ ftl_restore_tail_md_cb(struct ftl_io *io, void *ctx, int status)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The LBA map for bands is assigned from ftl_restore->lba_map and needs to be set to NULL
|
||||||
|
* before successful restore, otherwise ftl_band_alloc_lba_map will fail after
|
||||||
|
* initialization finalizes.
|
||||||
|
*/
|
||||||
|
rband->band->lba_map.map = NULL;
|
||||||
|
|
||||||
rband = ftl_restore_next_band(restore);
|
rband = ftl_restore_next_band(restore);
|
||||||
if (!rband) {
|
if (!rband) {
|
||||||
if (!STAILQ_EMPTY(&restore->pad_bands)) {
|
if (!STAILQ_EMPTY(&restore->pad_bands)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user