]> www.infradead.org Git - users/hch/block.git/commitdiff
nvme-loop: initialize max_hw_sectors earlier
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Feb 2024 18:10:45 +0000 (13:10 -0500)
committerChristoph Hellwig <hch@lst.de>
Thu, 29 Feb 2024 15:23:08 +0000 (07:23 -0800)
Initialize max_hw_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/target/loop.c

index e589915ddef85cf5f67fcba50deed724b37616d3..d8e33427a921bb982b2f2626c5961afc2c177a96 100644 (file)
@@ -351,6 +351,8 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
        if (error)
                return error;
        ctrl->ctrl.queue_count = 1;
+       ctrl->ctrl.max_hw_sectors =
+               (NVME_LOOP_MAX_SEGMENTS - 1) << PAGE_SECTORS_SHIFT;
 
        error = nvme_alloc_admin_tag_set(&ctrl->ctrl, &ctrl->admin_tag_set,
                        &nvme_loop_admin_mq_ops,
@@ -372,9 +374,6 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
        if (error)
                goto out_cleanup_tagset;
 
-       ctrl->ctrl.max_hw_sectors =
-               (NVME_LOOP_MAX_SEGMENTS - 1) << PAGE_SECTORS_SHIFT;
-
        nvme_unquiesce_admin_queue(&ctrl->ctrl);
 
        error = nvme_init_ctrl_finish(&ctrl->ctrl, false);