diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index e0618b7f9..9d6bf5e60 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -136,7 +136,9 @@ ftl_io_cmpl_cb(void *arg, const struct spdk_nvme_cpl *status) ftl_trace_completion(io->dev, io, FTL_TRACE_COMPLETION_DISK); - if (!ftl_io_dec_req(io)) { + ftl_io_dec_req(io); + + if (ftl_io_done(io)) { ftl_io_complete(io); } } diff --git a/lib/ftl/ftl_io.c b/lib/ftl/ftl_io.c index 894e1ceb0..10bdf2065 100644 --- a/lib/ftl/ftl_io.c +++ b/lib/ftl/ftl_io.c @@ -39,7 +39,7 @@ #include "ftl_rwb.h" #include "ftl_band.h" -size_t +void ftl_io_inc_req(struct ftl_io *io) { struct ftl_band *band = io->band; @@ -50,10 +50,10 @@ ftl_io_inc_req(struct ftl_io *io) __atomic_fetch_add(&io->dev->num_inflight, 1, __ATOMIC_SEQ_CST); - return ++io->req_cnt; + ++io->req_cnt; } -size_t +void ftl_io_dec_req(struct ftl_io *io) { struct ftl_band *band = io->band; @@ -68,7 +68,7 @@ ftl_io_dec_req(struct ftl_io *io) assert(num_inflight > 0); assert(io->req_cnt > 0); - return --io->req_cnt; + --io->req_cnt; } struct iovec * diff --git a/lib/ftl/ftl_io.h b/lib/ftl/ftl_io.h index f0e5565f2..b2325fb55 100644 --- a/lib/ftl/ftl_io.h +++ b/lib/ftl/ftl_io.h @@ -241,8 +241,8 @@ struct ftl_io *ftl_io_init_internal(const struct ftl_io_init_opts *opts); void ftl_io_reinit(struct ftl_io *io, spdk_ftl_fn cb, void *ctx, int flags, int type); void ftl_io_clear(struct ftl_io *io); -size_t ftl_io_inc_req(struct ftl_io *io); -size_t ftl_io_dec_req(struct ftl_io *io); +void ftl_io_inc_req(struct ftl_io *io); +void ftl_io_dec_req(struct ftl_io *io); struct iovec *ftl_io_iovec(struct ftl_io *io); uint64_t ftl_io_current_lba(struct ftl_io *io); void ftl_io_update_iovec(struct ftl_io *io, size_t lbk_cnt); diff --git a/test/unit/lib/ftl/ftl_wptr/ftl_wptr_ut.c b/test/unit/lib/ftl/ftl_wptr/ftl_wptr_ut.c index 778352743..b6cda88e2 100644 --- a/test/unit/lib/ftl/ftl_wptr/ftl_wptr_ut.c +++ b/test/unit/lib/ftl/ftl_wptr/ftl_wptr_ut.c @@ -57,8 +57,8 @@ static struct spdk_ftl_punit_range g_range = { #if defined(DEBUG) DEFINE_STUB(ftl_band_validate_md, bool, (struct ftl_band *band, const uint64_t *lba_map), true); #endif -DEFINE_STUB(ftl_io_dec_req, size_t, (struct ftl_io *io), 0); -DEFINE_STUB(ftl_io_inc_req, size_t, (struct ftl_io *io), 0); +DEFINE_STUB_V(ftl_io_dec_req, (struct ftl_io *io)); +DEFINE_STUB_V(ftl_io_inc_req, (struct ftl_io *io)); DEFINE_STUB_V(ftl_trace_completion, (struct spdk_ftl_dev *dev, const struct ftl_io *io, enum ftl_trace_completion completion)); DEFINE_STUB_V(ftl_reloc_add, (struct ftl_reloc *reloc, struct ftl_band *band, size_t offset,