From patchwork Wed Feb 21 09:26:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10231625 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 5978560392 for ; Wed, 21 Feb 2018 09:29:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61C7828AA5 for ; Wed, 21 Feb 2018 09:29:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56C5D28AA8; Wed, 21 Feb 2018 09:29:33 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 060EB28AA6 for ; Wed, 21 Feb 2018 09:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932351AbeBUJ3I (ORCPT ); Wed, 21 Feb 2018 04:29:08 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:40593 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbeBUJ1j (ORCPT ); Wed, 21 Feb 2018 04:27:39 -0500 Received: by mail-wr0-f195.google.com with SMTP id o76so2436013wrb.7 for ; Wed, 21 Feb 2018 01:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BWVPGl30wdUn3+0/bEK14uElrn3AD+ZeK4wtA4uE8PU=; b=zsT5yJvcUrIQ7rQRhAr1ANA4J2WeGidhfm4gIjTinkhOFGLnSocjIgdhU+giveuUR/ 7gY2cCmbMNw6Rh3DPPUkKG98/nXhiR8L89rJpffs7hxJs32dsVyHODSjAc5jgn4Hf3DS 7RPFOG7MrKcYsqaOBlaCrIpI/b7tuUh7gWgVOGGRP2p3g4V5Js3aKbdYqA278AEJvmuu frV2bGKos9yjX6vPx1Ap/XZHovFJp95iKKJweFWvWT2Rn0Nvve8oXFWnCv3P3Y9+hddp h5MQsa/4Uu7aOxBn37h82uncBxRtNuY4IZhAXviid7ElYxjfBpHMrnDpaHF2CyEQ4DT9 F18g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BWVPGl30wdUn3+0/bEK14uElrn3AD+ZeK4wtA4uE8PU=; b=qSSRtToPBGFWSToly/4u2E6C9/ypwZM0m5dnkecpZ5+lIdoaYlfOlPVKrFFsEwicTs ZLQ9FroDChgJTIkAd0uhRFqvQGmEPvnqf2/65h1dLQSuKvQiqjHwMiQPHL+Sw3kItfPS mlRj+D61R5UFJJfA+sQP3Z6x+peYgdPsDoSJ7jZsUOq2IiqZzTuJPxuY+JpkM22jo4Ll BBbf2PjNAZi0zH8+lTzx0bIzLzH1DKN8hxgNMSekm407HOSDHTfKLtrgk8SwrB6f1OgL 3eaQILABdObbaKIy07LpmIFRAfZMD/8y6EgZROiOjKcZHT1FAXDxWv/9fmWjvF46n7dM inOw== X-Gm-Message-State: APf1xPAQriCJld6L3BZwV2lQJBGnEEowRPZ4ij3vIkeuoR8H9psjkh8G kdO+Nu8SKcex5LjmwVsTZgigCQ== X-Google-Smtp-Source: AH8x225gHA0kAFGW1VSaYxXnucy8uIlcwfh+6oBpZIIq+Hgs8t3JQXkSOaGH9xa3CTJZdrUJLA3O9w== X-Received: by 10.80.202.75 with SMTP id e11mr4005828edi.32.1519205258795; Wed, 21 Feb 2018 01:27:38 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id a17sm3389955eda.42.2018.02.21.01.27.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 01:27:38 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 17/20] lightnvm: define chunk states Date: Wed, 21 Feb 2018 10:26:55 +0100 Message-Id: <1519205218-26994-18-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> References: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 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 Define chunk states as given in the 2.0 spec. Also, add an extra chunk state that signals that the chunk is in use by the host. This allows for the chunk metadata to be "owned" by a target when active, thus completing the chunk state machine from the host perspective and facilitating sanity checks. This state is transparent for the device. Signed-off-by: Javier González --- include/linux/lightnvm.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index bc43700c37ec..4dfb85d08ab5 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -297,6 +297,20 @@ struct nvm_dev_geo { struct nvm_common_geo c; }; +enum { + /* Chunk states */ + NVM_CHK_ST_FREE = 1 << 0, + NVM_CHK_ST_CLOSED = 1 << 1, + NVM_CHK_ST_OPEN = 1 << 2, + NVM_CHK_ST_OFFLINE = 1 << 3, + NVM_CHK_ST_HOST_USE = 1 << 7, + + /* Chunk types */ + NVM_CHK_TP_W_SEQ = 1 << 0, + NVM_CHK_TP_W_RAN = 1 << 1, + NVM_CHK_TP_SZ_SPEC = 1 << 4, +}; + /* * Note: The structure size is linked to nvme_nvm_chk_meta such that the same * buffer can be used when converting from little endian to cpu addressing.