Re: [PATCH v2 5/7] nvme: set discard_granularity from NPDG/NPDA

From: Caleb Sander Mateos

Date: Tue Feb 24 2026 - 11:08:23 EST


On Tue, Feb 24, 2026 at 7:15 AM Keith Busch <kbusch@xxxxxxxxxx> wrote:
>
> On Fri, Feb 20, 2026 at 08:33:00PM -0700, Caleb Sander Mateos wrote:
> > @@ -2113,11 +2114,27 @@ static bool nvme_update_disk_info(struct nvme_ns *ns, struct nvme_id_ns *id,
> > else if (ctrl->oncs & NVME_CTRL_ONCS_DSM)
> > lim->max_hw_discard_sectors = UINT_MAX;
> > else
> > lim->max_hw_discard_sectors = 0;
> >
> > - lim->discard_granularity = lim->logical_block_size;
> > + if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns->head, UINT_MAX))
> > + lim->max_hw_discard_sectors =
> > + nvme_lba_to_sect(ns->head, ctrl->dmrsl);
> > + else if (ctrl->oncs & NVME_CTRL_ONCS_DSM)
> > + lim->max_hw_discard_sectors = UINT_MAX;
> > + else
> > + lim->max_hw_discard_sectors = 0;
>
> Something seems off about this patch: these last four new lines added
> here are the same as the unmodified lines preceding it.

Good catch, looks like I bungled the conflict resolution when rebasing
these patches. Will remove the duplicated lines.

Thanks,
Caleb