diff --git a/lib/ftl/ftl_band.c b/lib/ftl/ftl_band.c index 47eb88ad8..6654bafa8 100644 --- a/lib/ftl/ftl_band.c +++ b/lib/ftl/ftl_band.c @@ -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 diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index d1906bb17..a938d8163 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -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 * diff --git a/lib/ftl/ftl_core.h b/lib/ftl/ftl_core.h index af07bcfc7..f0f1eb912 100644 --- a/lib/ftl/ftl_core.h +++ b/lib/ftl/ftl_core.h @@ -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); diff --git a/lib/ftl/ftl_io.c b/lib/ftl/ftl_io.c index 3e031c0a2..894e1ceb0 100644 --- a/lib/ftl/ftl_io.c +++ b/lib/ftl/ftl_io.c @@ -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 * diff --git a/lib/ftl/ftl_reloc.c b/lib/ftl/ftl_reloc.c index 756c7003f..a4e22e4a0 100644 --- a/lib/ftl/ftl_reloc.c +++ b/lib/ftl/ftl_reloc.c @@ -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 diff --git a/test/unit/lib/ftl/ftl_reloc.c/ftl_reloc_ut.c b/test/unit/lib/ftl/ftl_reloc.c/ftl_reloc_ut.c index 20d2e8eb0..fd800b0e7 100644 --- a/test/unit/lib/ftl/ftl_reloc.c/ftl_reloc_ut.c +++ b/test/unit/lib/ftl/ftl_reloc.c/ftl_reloc_ut.c @@ -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