From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56E681A2C0B for ; Tue, 24 Feb 2026 15:15:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771946124; cv=none; b=APe+rlI+4mGAjESd0UTSjlW6fd4CnuoboXXxc1UCnXVyd2NbeYeEMhfOJeKFmPBCJZ8n9IZkIITz/IkBH0USdHgn9Kq80qy2GqY+DQNq0+W7J4H1mX51wZm0krN+dF/nBbWQY/+KEI3RxQvwmqU4MP1tk9YnlunA6ig66Rwczpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771946124; c=relaxed/simple; bh=k3H/rEVnqAMIHs4Z1Gzb9bMIEAMLvti+HKdykL/Uktc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fAoct+CnKVh/yTWEmuOgj72tK4BkrWpzJlZM2GX/eBwJxMC3/uniLk0ndLjgvqGWC1qL/CtLJ4I54jF2Y2ypjIFw/AW7cRgt3Vh+NHyZCXPYcj2K7qKaoJexXquvryHLjLJsFD723HcFu9e7egpopJ9VM2ifCzGTVcm+4yvz9Mg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bvVmugzb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bvVmugzb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 916D0C116D0; Tue, 24 Feb 2026 15:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1771946123; bh=k3H/rEVnqAMIHs4Z1Gzb9bMIEAMLvti+HKdykL/Uktc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bvVmugzbOfLJt+KIQCbC1slHVUUEo8DJQAdpw9r561nCKeC1cSvkokK/RwSgfxg5z zN1/ue20RAzMHQXNx6uEJScdDQt/N7og91IH/kAAIEQfH8LuKH6vc1ouOhLwMHf7R1 dQPPB7FrCcPS/ujKoLBZLod4/Zh6x0oRT6LwkLvLjX/ydqpfMIGbdfxgZL3wbpNEX+ JE2h+vH039tBZSX9mcG113L35Y6kkLeXZLBbK7gKVSdeGetVJqtZIwyfD8CCliwXZK jy5KFcYKgMWUngeKEc1+QY+gInagmEvlH9bmtgs2aBg3ci9WTT1ZUJhEtt4mlybQbR 6h1BV9pNKvykw== Date: Tue, 24 Feb 2026 08:15:21 -0700 From: Keith Busch To: Caleb Sander Mateos Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/7] nvme: set discard_granularity from NPDG/NPDA Message-ID: References: <20260221033302.1451669-1-csander@purestorage.com> <20260221033302.1451669-6-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260221033302.1451669-6-csander@purestorage.com> 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.