From patchwork Fri Jan 5 13:15:59 2018 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: 10146543 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 C8F6A601A1 for ; Fri, 5 Jan 2018 13:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B914526E97 for ; Fri, 5 Jan 2018 13:22:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADCE927F89; Fri, 5 Jan 2018 13:22:06 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 5B84226E97 for ; Fri, 5 Jan 2018 13:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751863AbeAENQs (ORCPT ); Fri, 5 Jan 2018 08:16:48 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:37937 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbeAENQn (ORCPT ); Fri, 5 Jan 2018 08:16:43 -0500 Received: by mail-wm0-f67.google.com with SMTP id 64so2415147wme.3 for ; Fri, 05 Jan 2018 05:16:42 -0800 (PST) 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=CdfafoMRg5NV/UnLG9Czv1KasRUrFzBxGEUdXi9h6Vc=; b=yQOInWd+2KfRz8BonP9eBnBYIoxHma244pjDLGb45Rx7IsqjtmYFjaocMWt0FsGt3M wc1j7KEcs5DDw57brP47X1UmdmS0lEo89XA/3nToFlZHowmtgk/q4qX5ii1A0smYIz9C os3bixGeqeMcikOLLvEkBwomft8fyws03cCBw= 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=CdfafoMRg5NV/UnLG9Czv1KasRUrFzBxGEUdXi9h6Vc=; b=bkIkdk+zFsbmEVlLS7vNSmoTTTGa27q6W9JRB3a25pWZSseqAaylDNey9a0PrVN/Q/ P6Hz3UOZITcDDNaRrkhbb5hNk3BTkrwNxwrc2w8Pn/k91XGwO/UseLivOiUu9vS2Vw89 1MXlfVbkNDSGlWbUyOYCABAOWq537kSr/pdQ6982zu+K2xlIzLdeVMkJumtdggc4S80R U6otxCC9kQktB6Ien60575fL/fneVh4gNJ56jDpEE5TojMVgYYRf7eSB+xXEaPDeoXex ZC5SOJ34aKn/G0ofAzq28ySIa5FvOZ8+2X3SnrZ4JP3g3rTyi92PAP3VVwunlYLj/pPj jA5A== X-Gm-Message-State: AKGB3mJMhX2QUry0nfoHZKu8dHu21mrBigsmwBlasS36vQQqOEb/7Jjg 88eHCep7CpkxkoyYSAzDNnXQfQ== X-Google-Smtp-Source: ACJfBovehQigv+jfnbaWCAwnPQ2eadNIjKUFB+rgqoeul4iFvMqylri4wmmM9cOAYcSSLkmpVn8oRQ== X-Received: by 10.80.170.200 with SMTP id r8mr4066083edc.230.1515158201903; Fri, 05 Jan 2018 05:16:41 -0800 (PST) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id e46sm4228940edb.93.2018.01.05.05.16.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 05:16:41 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 03/25] lightnvm: use internal pblk methods Date: Fri, 5 Jan 2018 14:15:59 +0100 Message-Id: <20180105131621.20808-4-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180105131621.20808-1-m@bjorling.me> References: <20180105131621.20808-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 Now that rrpc has been removed, the only users of the ppa helpers is pblk. However, pblk already defines similar functions. Switch pblk to use the internal ones, and remove the generic ppa helpers. Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-map.c | 2 +- drivers/lightnvm/pblk-write.c | 4 ++-- include/linux/lightnvm.h | 19 ------------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/lightnvm/pblk-map.c b/drivers/lightnvm/pblk-map.c index 6f3ecde..7445e64 100644 --- a/drivers/lightnvm/pblk-map.c +++ b/drivers/lightnvm/pblk-map.c @@ -146,7 +146,7 @@ void pblk_map_erase_rq(struct pblk *pblk, struct nvm_rq *rqd, return; /* Erase blocks that are bad in this line but might not be in next */ - if (unlikely(ppa_empty(*erase_ppa)) && + if (unlikely(pblk_ppa_empty(*erase_ppa)) && bitmap_weight(d_line->blk_bitmap, lm->blk_per_line)) { int bit = -1; diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index 6c1cafa..6c30b7a 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -439,7 +439,7 @@ static int pblk_submit_io_set(struct pblk *pblk, struct nvm_rq *rqd) struct pblk_line *meta_line; int err; - ppa_set_empty(&erase_ppa); + pblk_ppa_set_empty(&erase_ppa); /* Assign lbas to ppas and populate request structure */ err = pblk_setup_w_rq(pblk, rqd, &erase_ppa); @@ -457,7 +457,7 @@ static int pblk_submit_io_set(struct pblk *pblk, struct nvm_rq *rqd) return NVM_IO_ERR; } - if (!ppa_empty(erase_ppa)) { + if (!pblk_ppa_empty(erase_ppa)) { /* Submit erase for next data line */ if (pblk_blk_erase_async(pblk, erase_ppa)) { struct pblk_line *e_line = pblk_line_get_erase(pblk); diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 2d1d9de..14e274b 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -418,25 +418,6 @@ static inline struct ppa_addr dev_to_generic_addr(struct nvm_tgt_dev *tgt_dev, return l; } -static inline int ppa_empty(struct ppa_addr ppa_addr) -{ - return (ppa_addr.ppa == ADDR_EMPTY); -} - -static inline void ppa_set_empty(struct ppa_addr *ppa_addr) -{ - ppa_addr->ppa = ADDR_EMPTY; -} - -static inline int ppa_cmp_blk(struct ppa_addr ppa1, struct ppa_addr ppa2) -{ - if (ppa_empty(ppa1) || ppa_empty(ppa2)) - return 0; - - return ((ppa1.g.ch == ppa2.g.ch) && (ppa1.g.lun == ppa2.g.lun) && - (ppa1.g.blk == ppa2.g.blk)); -} - typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *); typedef sector_t (nvm_tgt_capacity_fn)(void *); typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *,