From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 24C542E6CB6 for ; Fri, 20 Feb 2026 16:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771603840; cv=none; b=nJy90eSyF4/Sj077XDKTaPn7cHl+xXvtcryRQ+d7K+FBsMISIDG5mitrJBajsNB4BPSyadU8G5D1DcnKaNCj4kW+bTS4AhGxhM5HkbMFWj3aEWpyJsdjF3yGgBz+Brc0lcrtGpuM1q0LqvGYEV9jQzSX9EDmY6MLrR2NGywz84Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771603840; c=relaxed/simple; bh=OzM7DojgjCEW9EAXbZ+Skm30Ky7MvKzgJf1wBZfc7sQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iuLbSn5STn/HAkI8tOF95WenajD3wK6qWAOotlG9laZgzt0QbIxAbfJnu3rce40AT/OIHqEHnDOx4SxFmK9gjsJTgp1R0jCqP5gGccyKpz4zglPuSZDFcka2uWLdjHVxP4SAwq2j/1aPX2IvnS6/5xdkRzCJfRYLWMElhgQT7ko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 29FB268B05; Fri, 20 Feb 2026 17:10:36 +0100 (CET) Date: Fri, 20 Feb 2026 17:10:36 +0100 From: Christoph Hellwig To: Caleb Sander Mateos Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] nvme: set discard_granularity from NPDG/NPDA Message-ID: <20260220161035.GE15071@lst.de> References: <20260220032809.758089-1-csander@purestorage.com> <20260220032809.758089-5-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: <20260220032809.758089-5-csander@purestorage.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Thu, Feb 19, 2026 at 08:28:07PM -0700, Caleb Sander Mateos wrote: > -static void nvme_config_discard(struct nvme_ns *ns, struct queue_limits *lim) > +static void nvme_config_discard(struct nvme_ns *ns, struct nvme_id_ns *id, > + struct nvme_id_ns_nvm *nvm, > + struct queue_limits *lim) The indentation here looks weird, this should be just two tabs. > - lim->discard_granularity = lim->logical_block_size; > + optperf = id->nsfeat >> NVME_NS_FEAT_OPTPERF_SHIFT & > + NVME_NS_FEAT_OPTPERF_MASK; > + npdg = optperf & 0x2 && nvm && nvm->npdgl ? le32_to_cpu(nvm->npdgl) : > + optperf & 0x1 ? le16_to_cpu(id->npdg) + 1 : 1; > + npda = optperf & 0x2 && nvm && nvm->npdal ? le32_to_cpu(nvm->npdal) : > + optperf ? le16_to_cpu(id->npda) + 1 : 1; Please undinw this into a few if statemens. (And I really with the spec would given the bits names..)