[PATCH rfc 03/30] nvme-rdma: reuse configure/destroy admin queue

Christoph Hellwig hch at lst.de
Mon Jun 19 00:20:04 PDT 2017


On Sun, Jun 18, 2017 at 06:21:37PM +0300, Sagi Grimberg wrote:
> We have all we need in these functions now that these
> are aware if we are doing a full instantiation/removal.
> 
> For that we move nvme_rdma_configure_admin_queue to avoid
> a forward declaration, and we add blk_mq_ops forward declaration.
> 
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
>  drivers/nvme/host/rdma.c | 253 ++++++++++++++++++++++-------------------------
>  1 file changed, 119 insertions(+), 134 deletions(-)
> 
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 3e4c6aa119ee..5fef5545e365 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -140,6 +140,9 @@ static DEFINE_MUTEX(device_list_mutex);
>  static LIST_HEAD(nvme_rdma_ctrl_list);
>  static DEFINE_MUTEX(nvme_rdma_ctrl_mutex);
>  
> +static const struct blk_mq_ops nvme_rdma_mq_ops;
> +static const struct blk_mq_ops nvme_rdma_admin_mq_ops;
> +
>  /*
>   * Disabling this option makes small I/O goes faster, but is fundamentally
>   * unsafe.  With it turned off we will have to register a global rkey that
> @@ -562,20 +565,22 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl,
>  
>  static void nvme_rdma_stop_queue(struct nvme_rdma_queue *queue)
>  {
> +	if (test_bit(NVME_RDMA_Q_DELETING, &queue->flags))
> +		return;
>  	rdma_disconnect(queue->cm_id);
>  	ib_drain_qp(queue->qp);
>  }
>  
>  static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue)
>  {
> +	if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags))
> +		return;
>  	nvme_rdma_destroy_queue_ib(queue);
>  	rdma_destroy_id(queue->cm_id);
>  }
>  
>  static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue)
>  {
> -	if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags))
> -		return;
>  	nvme_rdma_stop_queue(queue);
>  	nvme_rdma_free_queue(queue);
>  }
> @@ -671,6 +676,116 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, bool remo
>  	nvme_rdma_free_queue(&ctrl->queues[0]);
>  }
>  
static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, bool new)

Too long line..

Also what about moving the helpers into the right place in the
previous patch that already re-indented most of this?



More information about the Linux-nvme mailing list