Skip to content

Commit

Permalink
Merge tag 'nvme-6.3-2023-04-06' of git://git.infradead.org/nvme into …
Browse files Browse the repository at this point in the history
…block-6.3

Pull NVMe fix from Christoph:

"nvme fixes for Linux 6.3

 - fix discard support without oncs (Keith Busch)"

* tag 'nvme-6.3-2023-04-06' of git://git.infradead.org/nvme:
  nvme: fix discard support without oncs
  • Loading branch information
Jens Axboe committed Apr 6, 2023
2 parents 1d16652 + d3205ab commit 5b3b919
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,9 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
struct request_queue *queue = disk->queue;
u32 size = queue_logical_block_size(queue);

if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX))
ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl);

if (ctrl->max_discard_sectors == 0) {
blk_queue_max_discard_sectors(queue, 0);
return;
Expand All @@ -1688,9 +1691,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
if (queue->limits.max_discard_sectors)
return;

if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX))
ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl);

blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors);
blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);

Expand Down

0 comments on commit 5b3b919

Please sign in to comment.