From mboxrd@z Thu Jan 1 00:00:00 1970 From: maxg@mellanox.com (Max Gurtovoy) Date: Thu, 7 Jun 2018 16:02:23 +0300 Subject: [PATCH 08/17] nvme: limit integrity segments to be <= data segments In-Reply-To: <19c8562a-8478-196c-c9f5-385d2076448e@grimberg.me> References: <1527436222-15494-1-git-send-email-maxg@mellanox.com> <1527436222-15494-9-git-send-email-maxg@mellanox.com> <19c8562a-8478-196c-c9f5-385d2076448e@grimberg.me> Message-ID: On 5/31/2018 1:09 AM, Sagi Grimberg wrote: > >> There is no reason for setting max_integrity_segments to be greater than >> max_segments. >> >> Signed-off-by: Max Gurtovoy >> --- >> ? drivers/nvme/host/core.c | 4 ++++ >> ? 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c >> index 197208a..e81e898 100644 >> --- a/drivers/nvme/host/core.c >> +++ b/drivers/nvme/host/core.c >> @@ -1795,6 +1795,10 @@ static void nvme_set_queue_limits(struct >> nvme_ctrl *ctrl, >> ????????? u32 max_segments = >> ????????????? (ctrl->max_hw_sectors / (ctrl->page_size >> 9)) + 1; >> +??????? if (ctrl->max_integrity_segments) >> +??????????? ctrl->max_integrity_segments = >> min(ctrl->max_integrity_segments, >> +?????????????????????????????? max_segments); >> + > > What is this protecting against? This is for good practice, I don't think the block layer will/can send us more integrity_segments than data_segments. but seems weird to have more max_integrity_segments than max_data_segments, isn't it ?