From patchwork Fri May 6 18:03:15 2016 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: 9035371 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 1518D9F1D3 for ; Fri, 6 May 2016 18:08:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 371752035B for ; Fri, 6 May 2016 18:08:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BB5F20274 for ; Fri, 6 May 2016 18:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758811AbcEFSHs (ORCPT ); Fri, 6 May 2016 14:07:48 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:38444 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932257AbcEFSDz (ORCPT ); Fri, 6 May 2016 14:03:55 -0400 Received: by mail-wm0-f49.google.com with SMTP id g17so89900356wme.1 for ; Fri, 06 May 2016 11:03:55 -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=LJQOHUe0R8NE4E9j+wCzXl+AggBxLDTt963YjzOX4bM=; b=dD5TtppH0j/sSIWiXvyqH+9Tt9o2R9lvTG7dK9hhBaJPI1nmbaH4w8sEQuXGV3vcNN VqrdGoiZGm2vQypH8A3FVLBoolXf4J8ctk/GKIpQkSy4zmMDYvFMTO+eaNZ6azq0hmdj /SsmFffYdIzRpP0D28yjZTH0t/o0OnQXgNhic= 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:mime-version:content-transfer-encoding; bh=LJQOHUe0R8NE4E9j+wCzXl+AggBxLDTt963YjzOX4bM=; b=lGylzfIAdONp2vACH67Qxw7iBeWEv4X4Sw/Bu+AIsKkUMW0QXIJDgiYT0AWxcE4Emb nbFMG+NnxJCNBiUk4PM98fy/Ttr6yQNPQpk3agbAt6xdWMdr++oFMJ9tSGiAMEVNsVs0 1669vXghesOlHpNKztn6u6AERoszIyD9yd3MyeQxaz5W/nOPl9kyOz9i1DBXBL9z+PSz D+D/oniND3DoSycMyd3DHqpC9cOvgGKxV579k9KvcpxrSE4JJcv8COzDmPQP94RnlNAT oSS8EgBBeFdj/ZqFpd15Yy65BVC5ytEgjipH/XCnASJRI3zQz2okm3jPmUB8/BeajSGn 1OEA== X-Gm-Message-State: AOPr4FXwXp++bSzJNDFd1snjur+zNtYnWNSNR8SbNaLN5AtFZa3BL/tpXvffHjlMcsLy5Q== X-Received: by 10.28.169.69 with SMTP id s66mr10584168wme.83.1462557834602; Fri, 06 May 2016 11:03:54 -0700 (PDT) Received: from Macroninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id kz1sm16076559wjc.46.2016.05.06.11.03.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 May 2016 11:03:53 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 22/28] lightnvm: do not assume sequential lun alloc. Date: Fri, 6 May 2016 20:03:15 +0200 Message-Id: <1462557801-24974-23-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1462557801-24974-1-git-send-email-m@bjorling.me> References: <1462557801-24974-1-git-send-email-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-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 From: Javier González When doing GC, rrpc calculates the physical LUN to which the rrpc block belongs too. This calculation is based on the assumption that LUNs are assigned sequentially to the LUN list. Use the reference to the LUN instead. This saves us the calculation and allows us to align LUNs in a different manner to, for example, take advantage of devide parallelism. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/rrpc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index ffcfee6..48862ead 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -405,9 +405,8 @@ static void rrpc_block_gc(struct work_struct *work) ws_gc); struct rrpc *rrpc = gcb->rrpc; struct rrpc_block *rblk = gcb->rblk; + struct rrpc_lun *rlun = rblk->rlun; struct nvm_dev *dev = rrpc->dev; - struct nvm_lun *lun = rblk->parent->lun; - struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset]; mempool_free(gcb, rrpc->gcb_pool); pr_debug("nvm: block '%lu' being reclaimed\n", rblk->parent->id); @@ -508,9 +507,9 @@ static void rrpc_gc_queue(struct work_struct *work) ws_gc); struct rrpc *rrpc = gcb->rrpc; struct rrpc_block *rblk = gcb->rblk; + struct rrpc_lun *rlun = rblk->rlun; struct nvm_lun *lun = rblk->parent->lun; struct nvm_block *blk = rblk->parent; - struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset]; spin_lock(&rlun->lock); list_add_tail(&rblk->prio, &rlun->prio_list);