Commit e27f64fb authored by Wojciech Malikowski's avatar Wojciech Malikowski Committed by Jim Harris
Browse files

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

parent 23d7ff31
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
	}
}
+4 −4
Original line number Diff line number Diff line
@@ -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 *
+2 −2
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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,