Commit f4e53e1c authored by Chuck Lever's avatar Chuck Lever

svcrdma: Clean up handling of get_rw_ctx errors

Clean up: Replace two dprintk call sites with a tracepoint.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 2abfbe7e
...@@ -1612,6 +1612,31 @@ TRACE_EVENT(svcrdma_dma_map_rw_err, ...@@ -1612,6 +1612,31 @@ TRACE_EVENT(svcrdma_dma_map_rw_err,
) )
); );
TRACE_EVENT(svcrdma_no_rwctx_err,
TP_PROTO(
const struct svcxprt_rdma *rdma,
unsigned int num_sges
),
TP_ARGS(rdma, num_sges),
TP_STRUCT__entry(
__field(unsigned int, num_sges)
__string(device, rdma->sc_cm_id->device->name)
__string(addr, rdma->sc_xprt.xpt_remotebuf)
),
TP_fast_assign(
__entry->num_sges = num_sges;
__assign_str(device, rdma->sc_cm_id->device->name);
__assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
),
TP_printk("addr=%s device=%s num_sges=%d",
__get_str(addr), __get_str(device), __entry->num_sges
)
);
TRACE_EVENT(svcrdma_send_pullup, TRACE_EVENT(svcrdma_send_pullup,
TP_PROTO( TP_PROTO(
unsigned int len unsigned int len
......
...@@ -67,19 +67,22 @@ svc_rdma_get_rw_ctxt(struct svcxprt_rdma *rdma, unsigned int sges) ...@@ -67,19 +67,22 @@ svc_rdma_get_rw_ctxt(struct svcxprt_rdma *rdma, unsigned int sges)
ctxt = kmalloc(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE), ctxt = kmalloc(struct_size(ctxt, rw_first_sgl, SG_CHUNK_SIZE),
GFP_KERNEL); GFP_KERNEL);
if (!ctxt) if (!ctxt)
goto out; goto out_noctx;
INIT_LIST_HEAD(&ctxt->rw_list); INIT_LIST_HEAD(&ctxt->rw_list);
} }
ctxt->rw_sg_table.sgl = ctxt->rw_first_sgl; ctxt->rw_sg_table.sgl = ctxt->rw_first_sgl;
if (sg_alloc_table_chained(&ctxt->rw_sg_table, sges, if (sg_alloc_table_chained(&ctxt->rw_sg_table, sges,
ctxt->rw_sg_table.sgl, ctxt->rw_sg_table.sgl,
SG_CHUNK_SIZE)) { SG_CHUNK_SIZE))
kfree(ctxt); goto out_free;
ctxt = NULL;
}
out:
return ctxt; return ctxt;
out_free:
kfree(ctxt);
out_noctx:
trace_svcrdma_no_rwctx_err(rdma, sges);
return NULL;
} }
static void svc_rdma_put_rw_ctxt(struct svcxprt_rdma *rdma, static void svc_rdma_put_rw_ctxt(struct svcxprt_rdma *rdma,
...@@ -456,7 +459,7 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info, ...@@ -456,7 +459,7 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info,
ctxt = svc_rdma_get_rw_ctxt(rdma, ctxt = svc_rdma_get_rw_ctxt(rdma,
(write_len >> PAGE_SHIFT) + 2); (write_len >> PAGE_SHIFT) + 2);
if (!ctxt) if (!ctxt)
goto out_noctx; return -ENOMEM;
constructor(info, write_len, ctxt); constructor(info, write_len, ctxt);
ret = svc_rdma_rw_ctx_init(rdma, ctxt, seg_offset, seg_handle, ret = svc_rdma_rw_ctx_init(rdma, ctxt, seg_offset, seg_handle,
...@@ -484,10 +487,6 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info, ...@@ -484,10 +487,6 @@ svc_rdma_build_writes(struct svc_rdma_write_info *info,
dprintk("svcrdma: inadequate space in Write chunk (%u)\n", dprintk("svcrdma: inadequate space in Write chunk (%u)\n",
info->wi_nsegs); info->wi_nsegs);
return -E2BIG; return -E2BIG;
out_noctx:
dprintk("svcrdma: no R/W ctxs available\n");
return -ENOMEM;
} }
/* Send one of an xdr_buf's kvecs by itself. To send a Reply /* Send one of an xdr_buf's kvecs by itself. To send a Reply
...@@ -637,7 +636,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -637,7 +636,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT; sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT;
ctxt = svc_rdma_get_rw_ctxt(cc->cc_rdma, sge_no); ctxt = svc_rdma_get_rw_ctxt(cc->cc_rdma, sge_no);
if (!ctxt) if (!ctxt)
goto out_noctx; return -ENOMEM;
ctxt->rw_nents = sge_no; ctxt->rw_nents = sge_no;
sg = ctxt->rw_sg_table.sgl; sg = ctxt->rw_sg_table.sgl;
...@@ -676,10 +675,6 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, ...@@ -676,10 +675,6 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info,
cc->cc_sqecount += ret; cc->cc_sqecount += ret;
return 0; return 0;
out_noctx:
dprintk("svcrdma: no R/W ctxs available\n");
return -ENOMEM;
out_overrun: out_overrun:
dprintk("svcrdma: request overruns rq_pages\n"); dprintk("svcrdma: request overruns rq_pages\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment