From patchwork Tue Feb 28 14:57:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9595927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15D36601D7 for ; Tue, 28 Feb 2017 14:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BAA128497 for ; Tue, 28 Feb 2017 14:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00957284FF; Tue, 28 Feb 2017 14:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC08A28497 for ; Tue, 28 Feb 2017 14:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbdB1O6X (ORCPT ); Tue, 28 Feb 2017 09:58:23 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:56221 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752175AbdB1O6E (ORCPT ); Tue, 28 Feb 2017 09:58:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=L8uc7xLIiMBBws0zaWX2vkapMyzdpErgcmV/GgpEMKQ=; b=HUsf5uWySqrY4Z+YBZ2A9I+5w GYGskPh8Ezp6ER+x/ZoZJAIS0LvNPaEUsDQXSlij9Mrz/8kUMj6MqqA4Q3zJ3XMAJjCPsCRPelCZK JQT3KeISD5tw+R1d/rx98Uc5F/7JiN2qrRFRBAgKIh7+U63vcZf6h7BgZ18JsLV9bHpuKX5dBXhXX TdHj3D1uFzKdSfF+LyvnxLkAAJ9d74doRemS+745zbXRW9KMYOigCdULaoptJ7JsZbglYJNR4/5b4 1PVQ4YW7R4J5beXsle45ZVqP4OrSR0UeiVlGJP2xBA7ERUP+d4yR3Hpec0oaIurfZF8RBtudwRDPV OgngNLdjw==; Received: from [8.25.222.2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cijDf-0006SJ-73; Tue, 28 Feb 2017 14:57:39 +0000 From: Christoph Hellwig To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 12/12] nvme: export the atomic write limit Date: Tue, 28 Feb 2017 06:57:37 -0800 Message-Id: <20170228145737.19016-13-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170228145737.19016-1-hch@lst.de> References: <20170228145737.19016-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 10 ++++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 8a3c3e32a704..e86d07589f18 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -926,6 +926,15 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) ns->pi_type = pi_type; blk_queue_logical_block_size(ns->queue, bs); + /* + * Advertisze the maximum atomic write size. Don't bother with the + * per-namespace values due to their alignment constraints. + */ + if (ns->ctrl->awupf > 1) { + blk_queue_max_atomic_write_sectors(ns->queue, + (ns->ctrl->awupf + 1) << (ns->lba_shift - 9)); + } + if (ns->ms && !blk_get_integrity(disk) && !ns->ext) nvme_init_integrity(ns); if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk)) @@ -1232,6 +1241,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->vid = le16_to_cpu(id->vid); ctrl->oncs = le16_to_cpup(&id->oncs); + ctrl->awupf = le16_to_cpu(id->awupf); atomic_set(&ctrl->abort_limit, id->acl + 1); ctrl->vwc = id->vwc; ctrl->cntlid = le16_to_cpup(&id->cntlid); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index aead6d08ed2c..020ffd6f7863 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -143,6 +143,7 @@ struct nvme_ctrl { u32 vs; u32 sgls; u16 kas; + u16 awupf; unsigned int kato; bool subsystem; unsigned long quirks;