lib/ftl: Pass errors from nvme layer only in completion callback
FTL should pass IO errors to upper layer only in completion callback to be consistent on sync and async error paths. Change-Id: I29c81af477b476c1e10b7933126737a222553ffa Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447176 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
3816651f4b
commit
5d82fa6af7
@ -817,7 +817,8 @@ ftl_band_read_md(struct ftl_band *band, struct ftl_md *md, void *data, size_t lb
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return ftl_io_read((struct ftl_io *)io);
|
||||
ftl_io_read((struct ftl_io *)io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -699,7 +699,7 @@ ftl_read_canceled(int rc)
|
||||
return rc == 0;
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
ftl_submit_read(struct ftl_io *io, ftl_next_ppa_fn next_ppa,
|
||||
void *ctx)
|
||||
{
|
||||
@ -734,12 +734,12 @@ ftl_submit_read(struct ftl_io *io, ftl_next_ppa_fn next_ppa,
|
||||
ftl_ppa_addr_pack(io->dev, ppa), lbk_cnt,
|
||||
ftl_io_cmpl_cb, io, 0);
|
||||
|
||||
if (rc != 0 && rc != -ENOMEM) {
|
||||
SPDK_ERRLOG("spdk_nvme_ns_cmd_read failed with status: %d\n", rc);
|
||||
io->status = -EIO;
|
||||
break;
|
||||
} else if (rc == -ENOMEM) {
|
||||
if (rc) {
|
||||
io->status = rc;
|
||||
|
||||
if (rc != -ENOMEM) {
|
||||
SPDK_ERRLOG("spdk_nvme_ns_cmd_read failed with status: %d\n", rc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -753,8 +753,6 @@ ftl_submit_read(struct ftl_io *io, ftl_next_ppa_fn next_ppa,
|
||||
if (ftl_io_done(io)) {
|
||||
ftl_io_complete(io);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1322,7 +1320,6 @@ ftl_io_write(struct ftl_io *io)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
_spdk_ftl_write(struct ftl_io *io)
|
||||
{
|
||||
@ -1379,7 +1376,7 @@ spdk_ftl_write(struct spdk_ftl_dev *dev, struct spdk_io_channel *ch, uint64_t lb
|
||||
return _spdk_ftl_write(io);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
ftl_io_read(struct ftl_io *io)
|
||||
{
|
||||
struct spdk_ftl_dev *dev = io->dev;
|
||||
@ -1392,11 +1389,11 @@ ftl_io_read(struct ftl_io *io)
|
||||
next_ppa = ftl_lba_read_next_ppa;
|
||||
}
|
||||
|
||||
return ftl_submit_read(io, next_ppa, NULL);
|
||||
ftl_submit_read(io, next_ppa, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
spdk_thread_send_msg(ftl_get_read_thread(dev), _ftl_read, io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1433,7 +1430,8 @@ spdk_ftl_read(struct spdk_ftl_dev *dev, struct spdk_io_channel *ch, uint64_t lba
|
||||
}
|
||||
|
||||
ftl_io_user_init(dev, io, lba, lba_cnt, iov, iov_cnt, cb_fn, cb_arg, FTL_IO_READ);
|
||||
return ftl_io_read(io);
|
||||
ftl_io_read(io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ftl_flush *
|
||||
|
@ -215,7 +215,7 @@ struct spdk_ftl_dev {
|
||||
typedef void (*ftl_restore_fn)(struct spdk_ftl_dev *, struct ftl_restore *, int);
|
||||
|
||||
void ftl_apply_limits(struct spdk_ftl_dev *dev);
|
||||
int ftl_io_read(struct ftl_io *io);
|
||||
void ftl_io_read(struct ftl_io *io);
|
||||
int ftl_io_write(struct ftl_io *io);
|
||||
int ftl_io_erase(struct ftl_io *io);
|
||||
int ftl_io_flush(struct ftl_io *io);
|
||||
|
@ -299,13 +299,13 @@ ftl_io_complete(struct ftl_io *io)
|
||||
void
|
||||
ftl_io_process_error(struct ftl_io *io, const struct spdk_nvme_cpl *status)
|
||||
{
|
||||
io->status = -EIO;
|
||||
|
||||
/* TODO: add error handling for specifc cases */
|
||||
if (status->status.sct == SPDK_NVME_SCT_MEDIA_ERROR &&
|
||||
status->status.sc == SPDK_OCSSD_SC_READ_HIGH_ECC) {
|
||||
io->status = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
io->status = -EIO;
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -486,7 +486,8 @@ ftl_reloc_read(struct ftl_band_reloc *breloc, struct ftl_io *io)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ftl_io_read(io);
|
||||
ftl_io_read(io);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -125,11 +125,10 @@ ftl_band_ppa_from_lbkoff(struct ftl_band *band, uint64_t lbkoff)
|
||||
return ppa;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
ftl_io_read(struct ftl_io *io)
|
||||
{
|
||||
io->cb.fn(io->cb.ctx, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user