nvme-fc: initialize max_hw_sectors earlier
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Feb 2024 18:11:29 +0000 (13:11 -0500)
committerChristoph Hellwig <hch@lst.de>
Thu, 29 Feb 2024 15:23:09 +0000 (07:23 -0800)
Initialize max_hw_sectors and max_sectors a little earlier so that
nvme_alloc_admin_tag_set can rely on it to set the initial queue limits.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fc.c

index 68a5d971657bb5080f717f5ae1ec5645830aadd5..537008dd2c616cc46bac5a2eef2ebe39fe648dab 100644 (file)
@@ -3113,10 +3113,6 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
        if (ret)
                goto out_disconnect_admin_queue;
 
-       ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
-       ctrl->ctrl.max_hw_sectors = ctrl->ctrl.max_segments <<
-                                               (ilog2(SZ_4K) - 9);
-
        nvme_unquiesce_admin_queue(&ctrl->ctrl);
 
        ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);
@@ -3542,6 +3538,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
 
        /* at this point, teardown path changes to ref counting on nvme ctrl */
 
+       ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
+       ctrl->ctrl.max_hw_sectors =
+               ctrl->ctrl.max_segments << (ilog2(SZ_4K) - 9);
+
        ret = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
                        &nvme_fc_admin_mq_ops,
                        struct_size_t(struct nvme_fcp_op_w_sgl, priv,