From patchwork Fri Oct 13 12:45:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004661 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 0D00460360 for ; Fri, 13 Oct 2017 13:02:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3FE92905C for ; Fri, 13 Oct 2017 13:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8E2329066; Fri, 13 Oct 2017 13:02:12 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM 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 023392905C for ; Fri, 13 Oct 2017 13:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753337AbdJMNCJ (ORCPT ); Fri, 13 Oct 2017 09:02:09 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:46066 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758090AbdJMMrR (ORCPT ); Fri, 13 Oct 2017 08:47:17 -0400 Received: by mail-wm0-f67.google.com with SMTP id q124so21259168wmb.0 for ; Fri, 13 Oct 2017 05:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PilM4znwZ6ZhwSIjmfIYAw6kva4US8cZpNBC23AJxUU=; b=KQHyqFXPsJXlwz5UXdDnS50LaOh/J+M7yT6Vaul3kS1z6tQecdlrLNDtuEq0dwqlpY DAsgPuEiMgZXvE+XqlBddVWQFmDT5Ko4jt+TVvnoSFG7eBoqcrYG1xCLfAD5vH3T9sCP D30XzCOtw8Rt/F0opOYiNlSREkr2Q9OcLdfQA= 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=PilM4znwZ6ZhwSIjmfIYAw6kva4US8cZpNBC23AJxUU=; b=py5G41DWv/cNBJ3Fes4cf2M/wkcv5B/3520POwCKxccFhQciLA5Ig35ds2WbKRc6n0 oIGWGl8ZT+iEiQFBgGdDtWybLLaABbBjJB7L00Sq3OPfqY8kp8fR7xk/X2zxZbBgIAIi 2JxqCGp/0bfRhp9Og/jmr1W3r78+628NDEv5/7hNg18tFapnPlrfx4G2uG84nkbwjr/u +gshpIKTFhTXaK2chCjyr12zpvlGpBOvt7FcuMSXTo2YD4iw3grOZqs6rYfpN2li4zY5 QcMi007ZDYRePg5zPbNQgTLk2+RMKX/K80bse/Ajg9X8OZlM5VOwratrB1vQuCtR8/Ha oSSA== X-Gm-Message-State: AMCzsaXLz1R3FAIHIIzKiAtNrPLiOCcjpr3NIqzQiEG74q8lDE6Q58cp MnYtsd7V57Y/iD6SsgkowsCzlx51 X-Google-Smtp-Source: AOwi7QDHyIB/BS038rpZvugqzNYvGsp336Dp7HQquecyhTj67PI2D7jodz0dEd4WYzP+cB8605z1DA== X-Received: by 10.80.240.136 with SMTP id v8mr2059755edl.52.1507898836166; Fri, 13 Oct 2017 05:47:16 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:15 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Rakesh Pandit , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 10/58] lightnvm: pblk: print incompatible line version correctly Date: Fri, 13 Oct 2017 14:45:59 +0200 Message-Id: <20171013124647.32668-11-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> 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 From: Rakesh Pandit Correct it by converting little endian to cpu endian and also define a macro for line version so that maintenance is easy. Signed-off-by: Rakesh Pandit Reviewed-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-core.c | 2 +- drivers/lightnvm/pblk-recovery.c | 4 ++-- drivers/lightnvm/pblk.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 027c42b..8536d38 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -978,7 +978,7 @@ static int pblk_line_init_metadata(struct pblk *pblk, struct pblk_line *line, memcpy(smeta_buf->header.uuid, pblk->instance_uuid, 16); smeta_buf->header.id = cpu_to_le32(line->id); smeta_buf->header.type = cpu_to_le16(line->type); - smeta_buf->header.version = cpu_to_le16(1); + smeta_buf->header.version = SMETA_VERSION; /* Start metadata */ smeta_buf->seq_nr = cpu_to_le64(line->seq_nr); diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index cb556e0..caf1242 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -900,9 +900,9 @@ struct pblk_line *pblk_recov_l2p(struct pblk *pblk) if (le32_to_cpu(smeta_buf->header.identifier) != PBLK_MAGIC) continue; - if (le16_to_cpu(smeta_buf->header.version) != 1) { + if (smeta_buf->header.version != SMETA_VERSION) { pr_err("pblk: found incompatible line version %u\n", - smeta_buf->header.version); + le16_to_cpu(smeta_buf->header.version)); return ERR_PTR(-EINVAL); } diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 67e623b..9ece409 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -310,6 +310,7 @@ enum { }; #define PBLK_MAGIC 0x70626c6b /*pblk*/ +#define SMETA_VERSION cpu_to_le16(1) struct line_header { __le32 crc;