Commit a6b53af1 authored by Wojciech Malikowski's avatar Wojciech Malikowski Committed by Tomasz Zawadzki
Browse files

lib/ftl: Check if IO channel is fully initialized



Since part of FTL IO channel initialization is done
asynchronously we need to check if IO channel is fully
initialized before write.

Change-Id: I0dff6a057024ffeb16b57ca5d7484f148b6fee82
Signed-off-by: default avatarWojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1177


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 49e70693
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2144,6 +2144,13 @@ void
ftl_io_write(struct ftl_io *io)
{
	struct spdk_ftl_dev *dev = io->dev;
	struct ftl_io_channel *ioch = ftl_io_channel_get_ctx(io->ioch);

	/* Put the IO on retry queue in case IO channel is not initialized */
	if (spdk_unlikely(ioch->index == FTL_IO_CHANNEL_INDEX_INVALID)) {
		TAILQ_INSERT_TAIL(&ioch->retry_queue, io, ioch_entry);
		return;
	}

	/* For normal IOs we just need to copy the data onto the write buffer */
	if (!(io->flags & FTL_IO_MD)) {
+1 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,7 @@ ftl_io_channel_create_cb(void *io_device, void *ctx)
	}

	ioch->cache_ioch = NULL;
	ioch->index = FTL_IO_CHANNEL_INDEX_INVALID;
	ioch->dev = dev;
	ioch->elem_size = sizeof(struct ftl_md_io);
	ioch->io_pool = spdk_mempool_create(mempool_name,
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ struct ftl_wbuf_entry {
	TAILQ_ENTRY(ftl_wbuf_entry)		tailq;
};

#define FTL_IO_CHANNEL_INDEX_INVALID ((uint64_t)-1)

struct ftl_io_channel {
	/* Device */
	struct spdk_ftl_dev			*dev;