lib/ftl: Drain retry queue before shutdown

Requests that still reside on retry queue should be
submitted to disk before shutdown.

Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Change-Id: Id2d020fcaef6443d01cfd8628686e9b0f34a1cfa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6771
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Wojciech Malikowski 2020-04-23 08:53:20 +02:00 committed by Tomasz Zawadzki
parent 4642d7b264
commit 180d281c7f

View File

@ -966,11 +966,18 @@ ftl_wptr_pad_band(struct ftl_wptr *wptr)
struct spdk_ftl_dev *dev = wptr->dev;
struct ftl_batch *batch = dev->current_batch;
struct ftl_io_channel *ioch;
struct ftl_io *io;
size_t size, pad_size, blocks_left;
size = batch != NULL ? batch->num_entries : 0;
TAILQ_FOREACH(ioch, &dev->ioch_queue, tailq) {
size += spdk_ring_count(ioch->submit_queue);
TAILQ_FOREACH(io, &ioch->retry_queue, ioch_entry) {
if (io->type == FTL_IO_WRITE) {
size += io->num_blocks - io->pos;
}
}
}
ioch = ftl_io_channel_get_ctx(ftl_get_io_channel(dev));
@ -989,11 +996,18 @@ ftl_wptr_process_shutdown(struct ftl_wptr *wptr)
struct spdk_ftl_dev *dev = wptr->dev;
struct ftl_batch *batch = dev->current_batch;
struct ftl_io_channel *ioch;
struct ftl_io *io;
size_t size;
size = batch != NULL ? batch->num_entries : 0;
TAILQ_FOREACH(ioch, &dev->ioch_queue, tailq) {
size += spdk_ring_count(ioch->submit_queue);
TAILQ_FOREACH(io, &ioch->retry_queue, ioch_entry) {
if (io->type == FTL_IO_WRITE) {
size += io->num_blocks - io->pos;
}
}
}
if (size >= dev->xfer_size) {