Re: [PATCHv2] nvme: implement non-mdts command limits
From: Christoph Hellwig <hch@lst.de>
Date: 2021-03-18 04:43:26
static void nvme_config_write_zeroes(struct request_queue *q,
struct nvme_ctrl *ctrl)
{
+ blk_queue_max_write_zeroes_sectors(q, ctrl->max_zeroes_sectors);I think at this point we can kill nvme_config_write_zeroes :)
+static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
+{
+ struct nvme_command c = { };
+ struct nvme_id_ctrl_nvm *id;
+ int ret;
+
+ if (!(ctrl->oncs & NVME_CTRL_ONCS_DSM)) {
+ ctrl->max_discard_sectors = 0;
+ ctrl->max_discard_segments = 0;
+ } else {
+ ctrl->max_discard_sectors = UINT_MAX;
+ ctrl->max_discard_segments = NVME_DSM_MAX_RANGES;
+ }Can you switch the polarity here, that is avoid the pointless negation in the if?
+ if (ctrl->vs < NVME_VS(1, 2, 0)) + return 0;
This check doesn't make much sense to me, as new TPs can always apply to older spec versions as well. Instead this probably should be a nvme_ctrl_limited_cns() check. _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme