From patchwork Tue Oct 9 11:11:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74506112B for ; Tue, 9 Oct 2018 11:17:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 543FB28A45 for ; Tue, 9 Oct 2018 11:17:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 485F528A6E; Tue, 9 Oct 2018 11:17:40 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 BCBEC28A45 for ; Tue, 9 Oct 2018 11:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbeJISaF (ORCPT ); Tue, 9 Oct 2018 14:30:05 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41377 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726883AbeJISaE (ORCPT ); Tue, 9 Oct 2018 14:30:04 -0400 Received: by mail-pf1-f195.google.com with SMTP id m77-v6so670276pfi.8 for ; Tue, 09 Oct 2018 04:13:37 -0700 (PDT) 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=7UHDRbJu2krwJl4P+tfllamaJ+ZZlOnQhWkW8p/OkPA=; b=Zygh9Xj0fLAAKKW3scbSdrGDUl1RZPYgYGsXsWmI2QnplFsMHbdyYMw2lJ01DWBua/ evtXql2GxHjgmfel/HmH0UHp7SO/TRODjaumI0aKpIZ3g3a2+o0ijoB5MdO7ruR20+0+ SHuXUmXRYcWE/jJmCK+3VDdU0ArhJB0h2XK0xQpbeGB/XvDW3T98/8B+hSFAcmDGhmJB MEbGE7Hzhv/LLNq972UNpMJ5JGXQtDvoIAI3UV0AWzQztSymX7bY5u9z11itGgT73Dep vX1b4U+bh3qo5cx3EjnnFXpDFAjHYE9DNOreyF5DC0x0x+iHU1CZRmnBbj9SclqNJ/OS 6zrg== 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=7UHDRbJu2krwJl4P+tfllamaJ+ZZlOnQhWkW8p/OkPA=; b=k81CI+hbyy9YYoHZZ4MIiK230f2FidqvaQyNwhJ7HLZWGQnktjqAMqUHmukcqBd02Z c31jL8LyBGDnEbKO5VWptgGFHorUjPczfFjKGaaPBtZx9QrIHjhnzdWYHaB7FzrwjzYm nd5lgRw0u113SpN0tJqbbk/uOIbv+bhq7qYjTiBtfIoxF/AuIrTZddWDF+cCPyyVNpXl 7VhlqTDHW7wp7UhaXjjgRU3ggCnHawuqfW2D+QVsqrteOCPm5enF/6tJugfHlYXr6w/R oV52qnx4NiQrW4GDRAUnzVraQ/D0XZRyQLikWZ+U74x9BZFcnufFoUDKLIG7hvtN9Cfb UvTw== X-Gm-Message-State: ABuFfohb8SCBwwpWOXCnZc06ZAZt4l3/ntak4j/82K3f2F1haY3+rboi CKYas6YWPw+VV08aSWvFkoB7Jg== X-Google-Smtp-Source: ACcGV615ZRt8m0ayIa4FfR9Te0CN99oyoibLkVNmnAh0FVQvIn2gaZfSfnkEwXZh3bRklWspt1EAHg== X-Received: by 2002:a63:a40a:: with SMTP id c10-v6mr25504851pgf.140.1539083617223; Tue, 09 Oct 2018 04:13:37 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.13.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:13:36 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mat?= =?utf-8?q?ias_Bj=C3=B8rling?= Subject: [GIT PULL 07/45] lightnvm: pblk: unify vector max req constants Date: Tue, 9 Oct 2018 13:11:37 +0200 Message-Id: <20181009111215.7653-8-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-1-mb@lightnvm.io> 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 Both NVM_MAX_VLBA and PBLK_MAX_REQ_ADDRS define how many LBAs that are available in a vector command. pblk uses them interchangeably in its implementation. Use NVM_MAX_VLBA as the main one and remove usages of PBLK_MAX_REQ_ADDRS. Also remove the power representation that only has one user, and instead calculate it at runtime. Signed-off-by: Matias Bjørling Reviewed-by: Javier González --- drivers/lightnvm/pblk-init.c | 6 ------ drivers/lightnvm/pblk-read.c | 6 +++--- drivers/lightnvm/pblk-rl.c | 4 ++-- drivers/lightnvm/pblk.h | 10 ++++------ 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 53bd52114aee..9119c64d6f62 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -376,12 +376,6 @@ static int pblk_core_init(struct pblk *pblk) pblk->max_write_pgs = min_t(int, max_write_ppas, NVM_MAX_VLBA); pblk_set_sec_per_write(pblk, pblk->min_write_pgs); - if (pblk->max_write_pgs > PBLK_MAX_REQ_ADDRS) { - pblk_err(pblk, "vector list too big(%u > %u)\n", - pblk->max_write_pgs, PBLK_MAX_REQ_ADDRS); - return -EINVAL; - } - pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t), GFP_KERNEL); if (!pblk->pad_dist) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 07b7f82c7595..9c61c19be5dc 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -43,7 +43,7 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd, unsigned long *read_bitmap) { struct pblk_sec_meta *meta_list = rqd->meta_list; - struct ppa_addr ppas[PBLK_MAX_REQ_ADDRS]; + struct ppa_addr ppas[NVM_MAX_VLBA]; int nr_secs = rqd->nr_ppas; bool advanced_bio = false; int i, j = 0; @@ -450,7 +450,7 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) int ret = NVM_IO_ERR; /* logic error: lba out-of-bounds. Ignore read request */ - if (blba >= pblk->rl.nr_secs || nr_secs > PBLK_MAX_REQ_ADDRS) { + if (blba >= pblk->rl.nr_secs || nr_secs > NVM_MAX_VLBA) { WARN(1, "pblk: read lba out of bounds (lba:%llu, nr:%d)\n", (unsigned long long)blba, nr_secs); return NVM_IO_ERR; @@ -547,7 +547,7 @@ static int read_ppalist_rq_gc(struct pblk *pblk, struct nvm_rq *rqd, struct pblk_line *line, u64 *lba_list, u64 *paddr_list_gc, unsigned int nr_secs) { - struct ppa_addr ppa_list_l2p[PBLK_MAX_REQ_ADDRS]; + struct ppa_addr ppa_list_l2p[NVM_MAX_VLBA]; struct ppa_addr ppa_gc; int valid_secs = 0; int i; diff --git a/drivers/lightnvm/pblk-rl.c b/drivers/lightnvm/pblk-rl.c index 6a0616a6fcaf..a32790f7b7fc 100644 --- a/drivers/lightnvm/pblk-rl.c +++ b/drivers/lightnvm/pblk-rl.c @@ -127,7 +127,7 @@ static void __pblk_rl_update_rates(struct pblk_rl *rl, } else if (free_blocks < rl->high) { int shift = rl->high_pw - rl->rb_windows_pw; int user_windows = free_blocks >> shift; - int user_max = user_windows << PBLK_MAX_REQ_ADDRS_PW; + int user_max = user_windows << ilog2(NVM_MAX_VLBA); rl->rb_user_max = user_max; rl->rb_gc_max = max - user_max; @@ -228,7 +228,7 @@ void pblk_rl_init(struct pblk_rl *rl, int budget) rl->rsv_blocks = min_blocks; /* This will always be a power-of-2 */ - rb_windows = budget / PBLK_MAX_REQ_ADDRS; + rb_windows = budget / NVM_MAX_VLBA; rl->rb_windows_pw = get_count_order(rb_windows); /* To start with, all buffer is available to user I/O writers */ diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h index 579b4ea9716c..64ae0c7ed3bb 100644 --- a/drivers/lightnvm/pblk.h +++ b/drivers/lightnvm/pblk.h @@ -37,8 +37,6 @@ #define PBLK_SECTOR (512) #define PBLK_EXPOSED_PAGE_SIZE (4096) -#define PBLK_MAX_REQ_ADDRS (64) -#define PBLK_MAX_REQ_ADDRS_PW (6) #define PBLK_NR_CLOSE_JOBS (4) @@ -99,8 +97,8 @@ enum { PBLK_RL_LOW = 4 }; -#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * PBLK_MAX_REQ_ADDRS) -#define pblk_dma_ppa_size (sizeof(u64) * PBLK_MAX_REQ_ADDRS) +#define pblk_dma_meta_size (sizeof(struct pblk_sec_meta) * NVM_MAX_VLBA) +#define pblk_dma_ppa_size (sizeof(u64) * NVM_MAX_VLBA) /* write buffer completion context */ struct pblk_c_ctx { @@ -218,8 +216,8 @@ struct pblk_lun { struct pblk_gc_rq { struct pblk_line *line; void *data; - u64 paddr_list[PBLK_MAX_REQ_ADDRS]; - u64 lba_list[PBLK_MAX_REQ_ADDRS]; + u64 paddr_list[NVM_MAX_VLBA]; + u64 lba_list[NVM_MAX_VLBA]; int nr_secs; int secs_to_gc; struct list_head list;