diff --git a/lib/ftl/ftl_reloc.c b/lib/ftl/ftl_reloc.c index a4e22e4a09..cdc4a57b46 100644 --- a/lib/ftl/ftl_reloc.c +++ b/lib/ftl/ftl_reloc.c @@ -624,10 +624,26 @@ ftl_band_reloc_init(struct ftl_reloc *reloc, struct ftl_band_reloc *breloc, static void ftl_band_reloc_free(struct ftl_band_reloc *breloc) { + struct ftl_reloc *reloc = breloc->parent; + struct ftl_io *io; + size_t i, num_ios; + if (!breloc) { return; } + if (breloc->active) { + num_ios = spdk_ring_dequeue(breloc->write_queue, (void **)reloc->io, reloc->max_qdepth); + for (i = 0; i < num_ios; ++i) { + io = reloc->io[i]; + if (io->flags & FTL_IO_INITIALIZED) { + ftl_reloc_free_io(breloc, io); + } + } + + ftl_reloc_release_io(breloc); + } + spdk_ring_free(breloc->free_queue); spdk_ring_free(breloc->write_queue); spdk_bit_array_free(&breloc->reloc_map);