Commit bf497308 authored by Wojciech Malikowski's avatar Wojciech Malikowski Committed by Darek Stojaczyk
Browse files

lib/ftl: Allow for relocating open band



In case ANM event occurs on open band
reloc need to be able to process such
event.

If band is not in closed sate do not
alloc lba map for it and do not set
it to free state after relocation.

Change-Id: I2f4a5770fef08271d222936ca19f3cc98e5e5be1
Signed-off-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457612


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent f8a91122
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -204,9 +204,13 @@ ftl_reloc_prep(struct ftl_band_reloc *breloc)
	reloc->num_active++;

	if (!band->high_prio) {
		if (band->lba_map.ref_cnt == 0) {
			if (ftl_band_alloc_lba_map(band)) {
				assert(false);
			}
		} else {
			ftl_band_acquire_lba_map(band);
		}
	}

	for (i = 0; i < reloc->max_qdepth; ++i) {
@@ -551,7 +555,7 @@ ftl_reloc_release(struct ftl_band_reloc *breloc)
		return;
	}

	if (ftl_band_empty(band)) {
	if (ftl_band_empty(band) && band->state == FTL_BAND_STATE_CLOSED) {
		ftl_band_set_state(breloc->band, FTL_BAND_STATE_FREE);
	}
}
@@ -749,6 +753,7 @@ ftl_reloc(struct ftl_reloc *reloc)
		if (reloc->num_active == reloc->max_active) {
			break;
		}

		ftl_reloc_add_active_queue(breloc);
	}

+3 −0
Original line number Diff line number Diff line
@@ -415,6 +415,9 @@ test_reloc_chunk(void)

	breloc = &reloc->brelocs[0];
	band = breloc->band;
	/* High priority band have allocated lba map */
	band->high_prio = 1;
	ftl_band_alloc_lba_map(band);
	num_io = MAX_RELOC_QDEPTH * reloc->xfer_size;
	num_iters = ftl_dev_lbks_in_chunk(dev) / num_io;