From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F834C54FC9 for ; Tue, 21 Apr 2020 12:08:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FD6C206A5 for ; Tue, 21 Apr 2020 12:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728316AbgDUMIb (ORCPT ); Tue, 21 Apr 2020 08:08:31 -0400 Received: from verein.lst.de ([213.95.11.211]:46309 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgDUMIb (ORCPT ); Tue, 21 Apr 2020 08:08:31 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 16BF668C4E; Tue, 21 Apr 2020 14:08:28 +0200 (CEST) Date: Tue, 21 Apr 2020 14:08:27 +0200 From: Christoph Hellwig To: Max Gurtovoy Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, martin.petersen@oracle.com, jsmart2021@gmail.com, linux-rdma@vger.kernel.org, idanb@mellanox.com, axboe@kernel.dk, vladimirk@mellanox.com, oren@mellanox.com, shlomin@mellanox.com, israelr@mellanox.com, jgg@mellanox.com Subject: Re: [PATCH 03/17] nvme: Enforce extended LBA format for fabrics metadata Message-ID: <20200421120827.GD26432@lst.de> References: <20200327171545.98970-1-maxg@mellanox.com> <20200327171545.98970-5-maxg@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200327171545.98970-5-maxg@mellanox.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Fri, Mar 27, 2020 at 08:15:31PM +0300, Max Gurtovoy wrote: > /* > + * For Fabrics, only metadata as part of extended data LBA is > + * supported. Fail in case of a spec violation. > + */ > + if (ns->ctrl->ops->flags & NVME_F_FABRICS) { > + if (WARN_ON_ONCE(!(ns->features & NVME_NS_EXT_LBAS))) > + return -EINVAL; > + } > + > + /* > * For PCI, Extended logical block will be generated by the > * controller. > */ > if (ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED) { > + if (ns->ctrl->ops->flags & NVME_F_FABRICS || > + !(ns->features & NVME_NS_EXT_LBAS)) > ns->features |= NVME_NS_MD_HOST_SUPPORTED; This looks a little confusing. I think it might make more sense struct nvme_ctrl *ctrl = ns->ctrl; ... if (ns->ms) { /* * For PCIe only the separate metadata pointer is supported, * as the block layer supplies metadata in a separate * bio_vec chain. For Fabrics, only metadata as part of * extended data LBA is supported on the wire per the Fabrics * specification, but the HBA/HCA will do the remapping from * the separate metadata buffers for us. */ if (id->flbas & NVME_NS_FLBAS_META_EXT) { ns->features |= NVME_NS_EXT_LBAS; if ((ctrl->ops->flags & NVME_F_FABRICS) && (ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) ns->features |= NVME_NS_METADATA_SUPPORTED; } else { if (WARN_ON_ONCE(ctrl->ops->flags & NVME_F_FABRICS)) return -EINVAL; if (ctrl->ops->flags & NVME_F_METADATA_SUPPORTED) ns->features |= NVME_NS_METADATA_SUPPORTED; }