From patchwork Mon Feb 26 13:17:15 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: 10242307 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 02170602DC for ; Mon, 26 Feb 2018 13:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EABEF29205 for ; Mon, 26 Feb 2018 13:22:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF78129267; Mon, 26 Feb 2018 13:22:52 +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 8584C29205 for ; Mon, 26 Feb 2018 13:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbeBZNWP (ORCPT ); Mon, 26 Feb 2018 08:22:15 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38059 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753287AbeBZNRr (ORCPT ); Mon, 26 Feb 2018 08:17:47 -0500 Received: by mail-wm0-f65.google.com with SMTP id z9so17093537wmb.3 for ; Mon, 26 Feb 2018 05:17:47 -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=yT7B6jOkNXg0OhyZWevD+eEl+91y8RKTd3jVQvCq+AI=; b=xMURbYrsznWQKrFD0OxJgd+/fIWF3EG8/AQJ7VEvqlekFKYhrU9j/x2XmzzLS0ACqM /c8Kb6jfSrOxJtlTIlR7U3MSJ4OtTjfi72aQfL6AZc2sHn+ky2A6vcAlJfU41r7kiksY JkppQW2IUfiUfk9Kq9KacO3C6edzhqzsKkJaSY9x2iBSalqlkDYhUeXfw0+gS/JmAHxw kZm9jkkCuSzzeBHY0Wg3qrOQX4O3qTg8BvS+WRSWU79psXXjjhtcHmbamWN5kbpeKVad dfxBpOGldkbgRbJlS8Z+PiUpx6K+TxLgiDAGNmUNsant4/SFUxy57qimvOBiezjNoOiD Gy9g== 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=yT7B6jOkNXg0OhyZWevD+eEl+91y8RKTd3jVQvCq+AI=; b=Pay4gvG+fc4gv4E3LLA1EFAecRYyAOyarcnwydKB2uCat6KsImnH+XePgff/NsqriF IIvI0z8gU+NfzdxcUvPlVHC0VEFsPVmCVTTzjvc8ibNLGYcn06M7YdPtQOUi62Sn6V4E RyM5eVrwRyTRIHcXSEhvOXwc0C2TsUoBlrvI6LYxE8hvRn/I14gXj9XauXwiigdv3GZn 3Ufq/wYQ1wVEcAJYH3sT3au+rs5mlLgogxAn8SzYqae0V6wJvZZz5AGpMMUlt+Ne2Z93 OqtNYgTffPHEnxuWUJc6DKlKpgD5uzctqcfbs8v9IjXPhy12ZFxAcHeJFbfM3HUPF0mj 7Etg== X-Gm-Message-State: APf1xPC22n0qUHQnLSaqs35rtJNTzS1wuSggG8GYMg03ZSAJSvvqIyZ4 A1R2ZR1QL9k+mdcY0eKAStxjxA== X-Google-Smtp-Source: AH8x225LdUjScVWo6Rbk5Umlu8qaHhIJzhL9T/9TJiUCfONLF/i1opEcoJvdh8dsDaH54QWx5hnVvw== X-Received: by 10.80.184.58 with SMTP id j55mr14657059ede.45.1519651066733; Mon, 26 Feb 2018 05:17:46 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id g59sm7097451ede.19.2018.02.26.05.17.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 05:17:46 -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 16/19] lightnvm: define chunk states Date: Mon, 26 Feb 2018 14:17:15 +0100 Message-Id: <1519651038-16845-17-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519651038-16845-1-git-send-email-javier@cnexlabs.com> References: <1519651038-16845-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 776ffdc2e137..74830d5dbd6e 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -232,6 +232,20 @@ struct nvm_addr_format { u64 rsv_mask[2]; }; +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.