lib/ftl: Mark all lba map segments as cached for open bands

Open bands need to have lba map segments
set to cached state to prevent read lba
map from disk during relocation events.

Change-Id: Ib4f1ed19131fad174c1d2f70e4c02e83701e2a0a
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457853
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Wojciech Malikowski 2019-06-12 13:24:24 -04:00 committed by Darek Stojaczyk
parent bfd67f9405
commit f8a9112292
2 changed files with 18 additions and 11 deletions

View File

@ -147,17 +147,6 @@ ftl_band_write_failed(struct ftl_band *band)
ftl_band_set_state(band, FTL_BAND_STATE_CLOSED);
}
void
ftl_band_clear_lba_map(struct ftl_band *band)
{
struct ftl_lba_map *lba_map = &band->lba_map;
spdk_bit_array_clear_mask(lba_map->vld);
memset(lba_map->map, 0, ftl_lba_map_pool_elem_size(band->dev));
lba_map->num_vld = 0;
}
static void
ftl_band_free_lba_map(struct ftl_band *band)
{
@ -1187,6 +1176,23 @@ ftl_band_next_operational_chunk(struct ftl_band *band, struct ftl_chunk *chunk)
return result;
}
void
ftl_band_clear_lba_map(struct ftl_band *band)
{
struct ftl_lba_map *lba_map = &band->lba_map;
size_t num_segments;
spdk_bit_array_clear_mask(lba_map->vld);
memset(lba_map->map, 0, ftl_lba_map_pool_elem_size(band->dev));
/* For open band all lba map segments are already cached */
assert(band->state == FTL_BAND_STATE_PREP);
num_segments = spdk_divide_round_up(ftl_num_band_lbks(band->dev), FTL_NUM_LBA_IN_BLOCK);
ftl_lba_map_set_segment_state(&band->lba_map, 0, num_segments, FTL_LBA_MAP_SEG_CACHED);
lba_map->num_vld = 0;
}
size_t
ftl_lba_map_pool_elem_size(struct spdk_ftl_dev *dev)
{

View File

@ -64,6 +64,7 @@ setup_band(struct ftl_band **band, const struct spdk_ocssd_geometry_data *geo,
*band = test_init_ftl_band(dev, 0);
rc = ftl_band_alloc_lba_map(*band);
SPDK_CU_ASSERT_FATAL(rc == 0);
(*band)->state = FTL_BAND_STATE_PREP;
ftl_band_clear_lba_map(*band);
}