[PATCH 2/3] nvme: introduce max_segments controller attribute
Sagi Grimberg
sagi at grimberg.me
Wed Aug 16 06:29:39 PDT 2017
> Each ctrl will limit max_segments according to it's hardware
> restrictions. Implement the restriction for RDMA transport.
>
> Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
> ---
> drivers/nvme/host/core.c | 4 ++--
> drivers/nvme/host/nvme.h | 1 +
> drivers/nvme/host/rdma.c | 1 +
> 3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 8cf37e7..cc0681e 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1495,8 +1495,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
> bool vwc = false;
>
> if (ctrl->max_hw_sectors) {
> - u32 max_segments =
> - (ctrl->max_hw_sectors / (ctrl->page_size >> 9)) + 1;
> + u32 max_segments = min_not_zero(ctrl->max_segments,
> + (ctrl->max_hw_sectors / (ctrl->page_size >> 9)) + 1);
Why is this needed with patches 1,3 applied?
We set the page_size and we set max_hw_sectors accordingly.
More information about the Linux-nvme
mailing list