lib/ftl: Use ftl_io_done() to determine if IO is completed

Change-Id: I76b58764153793f26b167071041ee17673fec63f
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449160
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Wojciech Malikowski 2019-03-26 06:12:18 -04:00 committed by Jim Harris
parent 23d7ff31fc
commit e27f64fb98
4 changed files with 11 additions and 9 deletions

View File

@ -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); 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); ftl_io_complete(io);
} }
} }

View File

@ -39,7 +39,7 @@
#include "ftl_rwb.h" #include "ftl_rwb.h"
#include "ftl_band.h" #include "ftl_band.h"
size_t void
ftl_io_inc_req(struct ftl_io *io) ftl_io_inc_req(struct ftl_io *io)
{ {
struct ftl_band *band = io->band; 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); __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) ftl_io_dec_req(struct ftl_io *io)
{ {
struct ftl_band *band = io->band; struct ftl_band *band = io->band;
@ -68,7 +68,7 @@ ftl_io_dec_req(struct ftl_io *io)
assert(num_inflight > 0); assert(num_inflight > 0);
assert(io->req_cnt > 0); assert(io->req_cnt > 0);
return --io->req_cnt; --io->req_cnt;
} }
struct iovec * struct iovec *

View File

@ -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 ftl_io_reinit(struct ftl_io *io, spdk_ftl_fn cb,
void *ctx, int flags, int type); void *ctx, int flags, int type);
void ftl_io_clear(struct ftl_io *io); void ftl_io_clear(struct ftl_io *io);
size_t ftl_io_inc_req(struct ftl_io *io); void ftl_io_inc_req(struct ftl_io *io);
size_t ftl_io_dec_req(struct ftl_io *io); void ftl_io_dec_req(struct ftl_io *io);
struct iovec *ftl_io_iovec(struct ftl_io *io); struct iovec *ftl_io_iovec(struct ftl_io *io);
uint64_t ftl_io_current_lba(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); void ftl_io_update_iovec(struct ftl_io *io, size_t lbk_cnt);

View File

@ -57,8 +57,8 @@ static struct spdk_ftl_punit_range g_range = {
#if defined(DEBUG) #if defined(DEBUG)
DEFINE_STUB(ftl_band_validate_md, bool, (struct ftl_band *band, const uint64_t *lba_map), true); DEFINE_STUB(ftl_band_validate_md, bool, (struct ftl_band *band, const uint64_t *lba_map), true);
#endif #endif
DEFINE_STUB(ftl_io_dec_req, size_t, (struct ftl_io *io), 0); DEFINE_STUB_V(ftl_io_dec_req, (struct ftl_io *io));
DEFINE_STUB(ftl_io_inc_req, size_t, (struct ftl_io *io), 0); 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, DEFINE_STUB_V(ftl_trace_completion, (struct spdk_ftl_dev *dev, const struct ftl_io *io,
enum ftl_trace_completion completion)); enum ftl_trace_completion completion));
DEFINE_STUB_V(ftl_reloc_add, (struct ftl_reloc *reloc, struct ftl_band *band, size_t offset, DEFINE_STUB_V(ftl_reloc_add, (struct ftl_reloc *reloc, struct ftl_band *band, size_t offset,