From patchwork Wed Mar 30 14:28:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenwei Tao X-Patchwork-Id: 8697241 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D633D9F3D1 for ; Wed, 30 Mar 2016 14:29:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0301B20384 for ; Wed, 30 Mar 2016 14:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3202020383 for ; Wed, 30 Mar 2016 14:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753797AbcC3O33 (ORCPT ); Wed, 30 Mar 2016 10:29:29 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:34251 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753745AbcC3O32 (ORCPT ); Wed, 30 Mar 2016 10:29:28 -0400 Received: by mail-pa0-f67.google.com with SMTP id hj7so6745662pac.1; Wed, 30 Mar 2016 07:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5U/vmEkwYMmkPdUbgX28Tow7FsLREhH8OUBpPTL42LE=; b=SDRre9NDK63IscdOAy4mQT5If31JGgkzIidNyP8g4cHOkPXpbiZAITy0YvzwT5herS cgPZpfEY/Fb+G9lPjDoBPbZVbIceyrIaMPfXMx+T0M/IQ2zPu7hXsp4gXE3BP/++kBOr NHRfBdlF8nf1qcYKRcfJMaJn6sbCGG0iN3dhVAPPWX2lxAcNb6k0W+Zuy/TAZOv44yqx fKMcjvbEwFwxSxycpkEggUiCpTQpOQMhPDiZ8pJYDYZGLc56/fEsNDnp4fy7ztcdVy+H fdA7hTZMNxK0OAwrksLOwcXUtvdDpDpu90bSZ9znVnyD0DiIpp4FbURCTCEuannBjoX9 xFwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5U/vmEkwYMmkPdUbgX28Tow7FsLREhH8OUBpPTL42LE=; b=HQCovTCtleXwydiqL5QIOcgiBatqM5e1mcVeKHFjbuR4QxUOTLMQxzuw8otm2oYJE+ hOkz+2YAwQajwblh1YLI43MaxFlO9QWWuejETD8K3N8SKV1typKPJeo0xfOupokJTvJd X1hHt2SOfJ8Q1H1zecJX4HxuQjXFRlhIZFKBYRBT3CYQ7uoBO41KyICG75PbPpvuz8Vc /k6JfcuvFdV4UOxopBeY6ZKsrY7bj0ImO5d86SOKQv1XJVcdierSj+O3/6+QJ4ka+3PN 6u4XM4/6gZyMux36+sTvQ40MSVf3SM8WjCxlQDqFryULscWpTxiodEJfXgK8sRspAC27 ImjA== X-Gm-Message-State: AD7BkJJmBvHA7EPDq7kP0HyMXbfPwKRUw2H39vTd/MCbkd5sXfRVGi14iaQ++4vJQDkMmw== X-Received: by 10.66.122.3 with SMTP id lo3mr13526222pab.25.1459348162983; Wed, 30 Mar 2016 07:29:22 -0700 (PDT) Received: from localhost.localdomain ([114.250.87.194]) by smtp.gmail.com with ESMTPSA id k65sm6507975pfb.30.2016.03.30.07.29.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 07:29:22 -0700 (PDT) From: Wenwei Tao To: mb@lightnvm.io Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 2/2] lightnvm: use relative logical address in rrpc_l2p_update Date: Wed, 30 Mar 2016 22:28:35 +0800 Message-Id: <1459348115-6072-2-git-send-email-ww.tao0320@gmail.com> X-Mailer: git-send-email 2.7.0.windows.2 In-Reply-To: <1459348115-6072-1-git-send-email-ww.tao0320@gmail.com> References: <1459348115-6072-1-git-send-email-ww.tao0320@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since every target now has their own logical address area, we should deal trans_map and rev_trans_map with relative logical address instead of the global one. Signed-off-by: Wenwei Tao --- drivers/lightnvm/rrpc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 516a045..2279bd7 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -998,10 +998,14 @@ static int rrpc_l2p_update(u64 slba, u32 nlb, __le64 *entries, void *private) { struct rrpc *rrpc = (struct rrpc *)private; struct nvm_dev *dev = rrpc->dev; - struct rrpc_addr *addr = rrpc->trans_map + slba; - struct rrpc_rev_addr *raddr = rrpc->rev_trans_map; - u64 elba = slba + nlb; - u64 i; + struct rrpc_addr *addr; + struct rrpc_rev_addr *raddr; + u64 elba, i; + + slba -= rrpc->soffset >> (ilog2(dev->sec_size) - 9); + addr = rrpc->trans_map + slba; + raddr = rrpc->rev_trans_map; + elba = slba + nlb; if (unlikely(elba > dev->total_secs)) { pr_err("nvm: L2P data from device is out of bounds!\n");