All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: axboe@fb.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Matias Bjørling" <mb@lightnvm.io>
Subject: [GIT PULL 21/45] lightnvm: pblk: remove debug from pblk_[down/up]_page
Date: Tue,  9 Oct 2018 13:11:51 +0200	[thread overview]
Message-ID: <20181009111215.7653-22-mb@lightnvm.io> (raw)
In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io>

Remove the debug only iteration within __pblk_down_page, which
then allows us to reduce the number of arguments down to pblk and
the parallel unit from the functions that calls it. Simplifying the
callers logic considerably.

Also, rename the functions pblk_[down/up]_page to
pblk_[down/up]_chunk, to communicate that it manages the write
pointer of the chunk. Note that it also protects the parallel unit
such that at most one chunk is active per parallel unit.

Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Reviewed-by: Javier González <javier@cnexlabs.com>
---
 drivers/lightnvm/pblk-core.c     | 34 +++++++++-----------------------
 drivers/lightnvm/pblk-map.c      |  2 +-
 drivers/lightnvm/pblk-recovery.c |  6 +++---
 drivers/lightnvm/pblk-write.c    |  6 +++---
 drivers/lightnvm/pblk.h          |  6 +++---
 5 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index bb1a7cc24cbb..968597d10cc2 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1861,8 +1861,7 @@ void pblk_gen_run_ws(struct pblk *pblk, struct pblk_line *line, void *priv,
 	queue_work(wq, &line_ws->ws);
 }
 
-static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
-			     int nr_ppas, int pos)
+static void __pblk_down_chunk(struct pblk *pblk, int pos)
 {
 	struct pblk_lun *rlun = &pblk->luns[pos];
 	int ret;
@@ -1871,13 +1870,6 @@ static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
 	 * Only send one inflight I/O per LUN. Since we map at a page
 	 * granurality, all ppas in the I/O will map to the same LUN
 	 */
-#ifdef CONFIG_NVM_PBLK_DEBUG
-	int i;
-
-	for (i = 1; i < nr_ppas; i++)
-		WARN_ON(ppa_list[0].a.lun != ppa_list[i].a.lun ||
-				ppa_list[0].a.ch != ppa_list[i].a.ch);
-#endif
 
 	ret = down_timeout(&rlun->wr_sem, msecs_to_jiffies(30000));
 	if (ret == -ETIME || ret == -EINTR)
@@ -1885,21 +1877,21 @@ static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
 				-ret);
 }
 
-void pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)
+void pblk_down_chunk(struct pblk *pblk, struct ppa_addr ppa)
 {
 	struct nvm_tgt_dev *dev = pblk->dev;
 	struct nvm_geo *geo = &dev->geo;
-	int pos = pblk_ppa_to_pos(geo, ppa_list[0]);
+	int pos = pblk_ppa_to_pos(geo, ppa);
 
-	__pblk_down_page(pblk, ppa_list, nr_ppas, pos);
+	__pblk_down_chunk(pblk, pos);
 }
 
-void pblk_down_rq(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas,
+void pblk_down_rq(struct pblk *pblk, struct ppa_addr ppa,
 		  unsigned long *lun_bitmap)
 {
 	struct nvm_tgt_dev *dev = pblk->dev;
 	struct nvm_geo *geo = &dev->geo;
-	int pos = pblk_ppa_to_pos(geo, ppa_list[0]);
+	int pos = pblk_ppa_to_pos(geo, ppa);
 
 	/* If the LUN has been locked for this same request, do no attempt to
 	 * lock it again
@@ -1907,23 +1899,15 @@ void pblk_down_rq(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas,
 	if (test_and_set_bit(pos, lun_bitmap))
 		return;
 
-	__pblk_down_page(pblk, ppa_list, nr_ppas, pos);
+	__pblk_down_chunk(pblk, pos);
 }
 
-void pblk_up_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)
+void pblk_up_chunk(struct pblk *pblk, struct ppa_addr ppa)
 {
 	struct nvm_tgt_dev *dev = pblk->dev;
 	struct nvm_geo *geo = &dev->geo;
 	struct pblk_lun *rlun;
-	int pos = pblk_ppa_to_pos(geo, ppa_list[0]);
-
-#ifdef CONFIG_NVM_PBLK_DEBUG
-	int i;
-
-	for (i = 1; i < nr_ppas; i++)
-		WARN_ON(ppa_list[0].a.lun != ppa_list[i].a.lun ||
-				ppa_list[0].a.ch != ppa_list[i].a.ch);
-#endif
+	int pos = pblk_ppa_to_pos(geo, ppa);
 
 	rlun = &pblk->luns[pos];
 	up(&rlun->wr_sem);
diff --git a/drivers/lightnvm/pblk-map.c b/drivers/lightnvm/pblk-map.c
index dc0efb852475..ff677ca6e4e1 100644
--- a/drivers/lightnvm/pblk-map.c
+++ b/drivers/lightnvm/pblk-map.c
@@ -79,7 +79,7 @@ static int pblk_map_page_data(struct pblk *pblk, unsigned int sentry,
 		}
 	}
 
-	pblk_down_rq(pblk, ppa_list, nr_secs, lun_bitmap);
+	pblk_down_rq(pblk, ppa_list[0], lun_bitmap);
 	return 0;
 }
 
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index eea901d7cebc..cbcc0828517e 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -227,7 +227,7 @@ static void pblk_end_io_recov(struct nvm_rq *rqd)
 	struct pblk_pad_rq *pad_rq = rqd->private;
 	struct pblk *pblk = pad_rq->pblk;
 
-	pblk_up_page(pblk, ppa_list, rqd->nr_ppas);
+	pblk_up_chunk(pblk, ppa_list[0]);
 
 	pblk_free_rqd(pblk, rqd, PBLK_WRITE_INT);
 
@@ -339,12 +339,12 @@ static int pblk_recov_pad_oob(struct pblk *pblk, struct pblk_line *line,
 	}
 
 	kref_get(&pad_rq->ref);
-	pblk_down_page(pblk, rqd->ppa_list, rqd->nr_ppas);
+	pblk_down_chunk(pblk, rqd->ppa_list[0]);
 
 	ret = pblk_submit_io(pblk, rqd);
 	if (ret) {
 		pblk_err(pblk, "I/O submission failed: %d\n", ret);
-		pblk_up_page(pblk, rqd->ppa_list, rqd->nr_ppas);
+		pblk_up_chunk(pblk, rqd->ppa_list[0]);
 		goto fail_free_bio;
 	}
 
diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c
index cd579b440b56..674ba4d1a9f4 100644
--- a/drivers/lightnvm/pblk-write.c
+++ b/drivers/lightnvm/pblk-write.c
@@ -270,7 +270,7 @@ static void pblk_end_io_write_meta(struct nvm_rq *rqd)
 	struct ppa_addr *ppa_list = nvm_rq_to_ppa_list(rqd);
 	int sync;
 
-	pblk_up_page(pblk, ppa_list, rqd->nr_ppas);
+	pblk_up_chunk(pblk, ppa_list[0]);
 
 	if (rqd->error) {
 		pblk_log_write_err(pblk, rqd);
@@ -420,7 +420,7 @@ int pblk_submit_meta_io(struct pblk *pblk, struct pblk_line *meta_line)
 		list_del(&meta_line->list);
 	spin_unlock(&l_mg->close_lock);
 
-	pblk_down_page(pblk, ppa_list, rqd->nr_ppas);
+	pblk_down_chunk(pblk, ppa_list[0]);
 
 	ret = pblk_submit_io(pblk, rqd);
 	if (ret) {
@@ -431,7 +431,7 @@ int pblk_submit_meta_io(struct pblk *pblk, struct pblk_line *meta_line)
 	return NVM_IO_OK;
 
 fail_rollback:
-	pblk_up_page(pblk, ppa_list, rqd->nr_ppas);
+	pblk_up_chunk(pblk, ppa_list[0]);
 	spin_lock(&l_mg->close_lock);
 	pblk_dealloc_page(pblk, meta_line, rq_ppas);
 	list_add(&meta_line->list, &meta_line->list);
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 0ca67e8f99d5..429347bcd1fa 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -823,10 +823,10 @@ u64 pblk_alloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs);
 u64 __pblk_alloc_page(struct pblk *pblk, struct pblk_line *line, int nr_secs);
 int pblk_calc_secs(struct pblk *pblk, unsigned long secs_avail,
 		   unsigned long secs_to_flush);
-void pblk_up_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas);
-void pblk_down_rq(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas,
+void pblk_down_rq(struct pblk *pblk, struct ppa_addr ppa,
 		  unsigned long *lun_bitmap);
-void pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas);
+void pblk_down_chunk(struct pblk *pblk, struct ppa_addr ppa);
+void pblk_up_chunk(struct pblk *pblk, struct ppa_addr ppa);
 void pblk_up_rq(struct pblk *pblk, unsigned long *lun_bitmap);
 int pblk_bio_add_pages(struct pblk *pblk, struct bio *bio, gfp_t flags,
 		       int nr_pages);
-- 
2.17.1

  parent reply	other threads:[~2018-10-09 18:30 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 11:11 [GIT PULL 00/45] lightnvm updates for 4.20 Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 01/45] lightnvm: remove dependencies on BLK_DEV_NVME and PCI Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 02/45] lightnvm: combine 1.2 and 2.0 command flags Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 03/45] lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 04/45] lightnvm: move device L2P detection to core Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 05/45] lightnvm: pblk: fix race condition on metadata I/O Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 06/45] lightnvm: move bad block and chunk state logic to core Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 07/45] lightnvm: pblk: unify vector max req constants Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 08/45] lightnvm: pblk: fix incorrect min_write_pgs Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 09/45] lightnvm: pblk: remove size and out of bounds read check Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 10/45] lightnvm: pblk: refactor put line fn on read completion Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 11/45] lightnvm: pblk: add helpers for chunk addresses Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 12/45] lightnvm: pblk: improve line helpers Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 13/45] lightnvm: pblk: fix comment typo Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 14/45] lightnvm: pblk: remove unused variable Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 15/45] lightnvm: pblk: guarantee emeta on line close Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 16/45] lightnvm: introduce nvm_rq_to_ppa_list Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 17/45] lightnvm: pblk: allocate line map bitmaps using a mempool Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 18/45] lightnvm: pblk: remove unused parameters in pblk_up_rq Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 19/45] lightnvm: pblk: fix up prints in pblk_read_check_rand Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 20/45] lightnvm: pblk: fix write amplificiation calculation Matias Bjørling
2018-10-09 11:11 ` Matias Bjørling [this message]
2018-10-09 11:11 ` [GIT PULL 22/45] lightnvm: pblk: add trace events for chunk states Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 23/45] lightnvm: pblk: add trace events for line state changes Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 24/45] lightnvm: pblk: add trace events for pblk " Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 25/45] lightnvm: pblk: add tracing for chunk resets Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 26/45] lightnvm: move ppa transformations to core Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 27/45] lightnvm: pblk: calculate line pad distance in helper Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 28/45] lightnvm: pblk: stop recreating global caches Matias Bjørling
2018-10-09 11:11 ` [GIT PULL 29/45] lightnvm: pblk: fix mapping issue on failed writes Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 30/45] lightnvm: pblk: fix two sleep-in-atomic-context bugs Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 31/45] lightnvm: use internal allocation for chunk log page Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 32/45] lightnvm: pblk: encapsulate rqd dma allocations Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 33/45] lightnvm: pblk: refactor metadata paths Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 34/45] lightnvm: pblk: take write semaphore on metadata Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 35/45] lightnvm: pblk: recover open lines on 2.0 devices Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 36/45] lightnvm: pblk: add SPDX license tag Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 37/45] lightnvm: pblk: fix race on sysfs line state Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 38/45] lightnvm: pblk: remove unused function Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 39/45] lightnvm: pblk: encapsulate rb pointer operations Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 40/45] lightnvm: pblk: move ring buffer alloc/free rb init Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 41/45] lightnvm: pblk: guarantee mw_cunits on read buffer Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 42/45] lightnvm: do no update csecs and sos on 1.2 Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 43/45] lightnvm: pblk: fix error handling of pblk_lines_init() Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 44/45] lightnvm: pblk: consider max hw sectors supported for max_write_pgs Matias Bjørling
2018-10-09 11:12 ` [GIT PULL 45/45] lightnvm: pblk: guarantee that backpointer is respected on writer stall Matias Bjørling
2018-10-09 14:25 ` [GIT PULL 00/45] lightnvm updates for 4.20 Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181009111215.7653-22-mb@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=axboe@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.