bdev/compress: Update error handling of compress operation

In case of any error (except of device one) the compression
operation is queued for further resubmission. However in some
cases (e.g. mbufs config error or compress driver error) this
resubmission doesn't have any sense since we'll hit the same
problem later. This patch enqueues operations when there were
no mbufs or comp_operation descriptors or the compress operation
was not processed.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I1e0eab5e4ea80f84d969814a916b6cd783a77fe1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11971
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Alexey Marchuk 2022-03-15 20:12:31 +04:00 committed by Tomasz Zawadzki
parent 42f59f5006
commit bfd7fcb8fe

View File

@ -459,7 +459,7 @@ reduce_rw_blocks_cb(void *arg, int reduce_errno)
spdk_thread_exec_msg(orig_thread, _reduce_rw_blocks_cb, io_ctx); spdk_thread_exec_msg(orig_thread, _reduce_rw_blocks_cb, io_ctx);
} }
static uint64_t static int
_setup_compress_mbuf(struct rte_mbuf **mbufs, int *mbuf_total, uint64_t *total_length, _setup_compress_mbuf(struct rte_mbuf **mbufs, int *mbuf_total, uint64_t *total_length,
struct iovec *iovs, int iovcnt, void *reduce_cb_arg) struct iovec *iovs, int iovcnt, void *reduce_cb_arg)
{ {
@ -555,6 +555,7 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
comp_op = rte_comp_op_alloc(g_comp_op_mp); comp_op = rte_comp_op_alloc(g_comp_op_mp);
if (!comp_op) { if (!comp_op) {
SPDK_ERRLOG("trying to get a comp op!\n"); SPDK_ERRLOG("trying to get a comp op!\n");
rc = -ENOMEM;
goto error_get_op; goto error_get_op;
} }
@ -562,12 +563,14 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&src_mbufs[0], src_iovcnt); rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&src_mbufs[0], src_iovcnt);
if (rc) { if (rc) {
SPDK_ERRLOG("ERROR trying to get src_mbufs!\n"); SPDK_ERRLOG("ERROR trying to get src_mbufs!\n");
rc = -ENOMEM;
goto error_get_src; goto error_get_src;
} }
rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&dst_mbufs[0], dst_iovcnt); rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&dst_mbufs[0], dst_iovcnt);
if (rc) { if (rc) {
SPDK_ERRLOG("ERROR trying to get dst_mbufs!\n"); SPDK_ERRLOG("ERROR trying to get dst_mbufs!\n");
rc = -ENOMEM;
goto error_get_dst; goto error_get_dst;
} }
@ -615,6 +618,7 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
/* we free mbufs differently depending on whether they were chained or not */ /* we free mbufs differently depending on whether they were chained or not */
rte_pktmbuf_free(comp_op->m_src); rte_pktmbuf_free(comp_op->m_src);
rte_pktmbuf_free(comp_op->m_dst); rte_pktmbuf_free(comp_op->m_dst);
rc = -EAGAIN;
goto error_enqueue; goto error_enqueue;
} else { } else {
device_error = true; device_error = true;
@ -642,6 +646,9 @@ error_get_op:
SPDK_ERRLOG("Compression API returned 0x%x\n", comp_op->status); SPDK_ERRLOG("Compression API returned 0x%x\n", comp_op->status);
return -EINVAL; return -EINVAL;
} }
if (rc != -ENOMEM && rc != -EAGAIN) {
return rc;
}
op_to_queue = calloc(1, sizeof(struct vbdev_comp_op)); op_to_queue = calloc(1, sizeof(struct vbdev_comp_op));
if (op_to_queue == NULL) { if (op_to_queue == NULL) {