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: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1177 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
49e70693c6
commit
a6b53af161
@ -2144,6 +2144,13 @@ void
|
|||||||
ftl_io_write(struct ftl_io *io)
|
ftl_io_write(struct ftl_io *io)
|
||||||
{
|
{
|
||||||
struct spdk_ftl_dev *dev = io->dev;
|
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 */
|
/* For normal IOs we just need to copy the data onto the write buffer */
|
||||||
if (!(io->flags & FTL_IO_MD)) {
|
if (!(io->flags & FTL_IO_MD)) {
|
||||||
|
@ -1110,6 +1110,7 @@ ftl_io_channel_create_cb(void *io_device, void *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ioch->cache_ioch = NULL;
|
ioch->cache_ioch = NULL;
|
||||||
|
ioch->index = FTL_IO_CHANNEL_INDEX_INVALID;
|
||||||
ioch->dev = dev;
|
ioch->dev = dev;
|
||||||
ioch->elem_size = sizeof(struct ftl_md_io);
|
ioch->elem_size = sizeof(struct ftl_md_io);
|
||||||
ioch->io_pool = spdk_mempool_create(mempool_name,
|
ioch->io_pool = spdk_mempool_create(mempool_name,
|
||||||
|
@ -157,6 +157,8 @@ struct ftl_wbuf_entry {
|
|||||||
TAILQ_ENTRY(ftl_wbuf_entry) tailq;
|
TAILQ_ENTRY(ftl_wbuf_entry) tailq;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FTL_IO_CHANNEL_INDEX_INVALID ((uint64_t)-1)
|
||||||
|
|
||||||
struct ftl_io_channel {
|
struct ftl_io_channel {
|
||||||
/* Device */
|
/* Device */
|
||||||
struct spdk_ftl_dev *dev;
|
struct spdk_ftl_dev *dev;
|
||||||
|
Loading…
Reference in New Issue
Block a user