linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2 05/13] svcrdma: Introduce local rdma_rw API helpers
Date: Thu, 30 Mar 2017 05:30:14 -0700	[thread overview]
Message-ID: <20170330123014.GA32364@infradead.org> (raw)
In-Reply-To: <20170327134835.5585.76603.stgit@klimt.1015granger.net>

> +	spinlock_t	     sc_rw_ctxt_lock;
> +	struct list_head     sc_rw_ctxts;

It's a little sad that we always need a list and a spinlock when
most requests should need a single context only.

> + * Each WR chain handles a single contiguous server-side buffer,
> + * because some registration modes (eg. FRWR) do not support a
> + * discontiguous scatterlist.

Both FRWR and FMR have no problem with a discontiguous page list,
they only have a problem with any segment but the first not starting
page aligned.  For NFS you'll need vectored direct I/O to hit that
case.

> +	spin_lock(&rdma->sc_rw_ctxt_lock);
> +	if (list_empty(&rdma->sc_rw_ctxts))
> +		goto out_empty;
> +
> +	ctxt = list_first_entry(&rdma->sc_rw_ctxts,
> +				struct svc_rdma_rw_ctxt, rw_list);

Use list_first_entry_or_null?

> +	struct svc_rdma_rw_ctxt *ctxt;
> +
> +	while (!list_empty(&rdma->sc_rw_ctxts)) {
> +		ctxt = list_first_entry(&rdma->sc_rw_ctxts,
> +					struct svc_rdma_rw_ctxt, rw_list);

Same here.


> +	if (wc->status != IB_WC_SUCCESS)
> +		goto flush;
> +
> +out:
> +	rdma_rw_ctx_destroy(&ctxt->rw_ctx, rdma->sc_qp, rdma->sc_port_num,
> +			    ctxt->rw_sg_table.sgl, ctxt->rw_nents,
> +			    DMA_TO_DEVICE);
> +	svc_rdma_put_rw_ctxt(ctxt);
> +	return;
> +
> +flush:
> +	set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
> +	if (wc->status != IB_WC_WR_FLUSH_ERR)
> +		pr_err("svcrdma: write ctx: %s (%u/0x%x)\n",
> +		       ib_wc_status_msg(wc->status),
> +		       wc->status, wc->vendor_err);
> +	goto out;

This would seem cleaner without the gotos (but maybe an unlikely
for the if above).

> +	struct svc_xprt *xprt = &rdma->sc_xprt;
> +	struct ib_send_wr *bad_wr;
> +	int ret;
> +
> +	do {
> +		if ((atomic_sub_return(num_wrs, &rdma->sc_sq_avail) > 0)) {

No need for the inner braces.


Except for these minor nitpicks the patch looks fine to me:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2017-03-30 12:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 13:47 [PATCH v2 00/13] Server-side NFS/RDMA changes proposed for v4.12 Chuck Lever
2017-03-27 13:48 ` [PATCH v2 01/13] svcrdma: Move send_wr to svc_rdma_op_ctxt Chuck Lever
2017-03-30 12:06   ` Christoph Hellwig
2017-03-27 13:48 ` [PATCH v2 02/13] svcrdma: Add svc_rdma_map_reply_hdr() Chuck Lever
2017-03-30 12:07   ` Christoph Hellwig
2017-03-27 13:48 ` [PATCH v2 03/13] svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT Chuck Lever
2017-03-30 12:07   ` Christoph Hellwig
2017-03-27 13:48 ` [PATCH v2 04/13] svcrdma: Add helper to save pages under I/O Chuck Lever
2017-03-30 12:08   ` Christoph Hellwig
2017-03-27 13:48 ` [PATCH v2 05/13] svcrdma: Introduce local rdma_rw API helpers Chuck Lever
2017-03-30 12:30   ` Christoph Hellwig [this message]
2017-03-30 15:29     ` Chuck Lever
2017-03-27 13:48 ` [PATCH v2 06/13] svcrdma: Use rdma_rw API in RPC reply path Chuck Lever
2017-03-27 13:48 ` [PATCH v2 07/13] svcrdma: Clean up RDMA_ERROR path Chuck Lever
2017-03-27 13:48 ` [PATCH v2 08/13] svcrdma: Report Write/Reply chunk overruns Chuck Lever
2017-03-27 13:49 ` [PATCH v2 09/13] svcrdma: Clean up RPC-over-RDMA backchannel reply processing Chuck Lever
2017-03-27 13:49 ` [PATCH v2 10/13] svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt Chuck Lever
2017-03-27 13:49 ` [PATCH v2 11/13] svcrdma: Remove unused RDMA Write completion handler Chuck Lever
2017-03-27 13:49 ` [PATCH v2 12/13] svcrdma: Remove the req_map cache Chuck Lever
2017-03-27 13:49 ` [PATCH v2 13/13] svcrdma: Clean out old XDR encoders Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170330123014.GA32364@infradead.org \
    --to=hch@infradead.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).