[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1535533313-29944-2-git-send-email-javier@cnexlabs.com>
Date: Wed, 29 Aug 2018 11:01:50 +0200
From: "Javier González" <javier@...igon.com>
To: mb@...htnvm.io
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Javier González <javier@...xlabs.com>
Subject: [PATCH 1/4] lightnvm: pblk: calculate line pad distance in helper
If a line is padded, calculate the pad distance directly on the helper
being used for this purpose.
Signed-off-by: Javier González <javier@...xlabs.com>
---
drivers/lightnvm/pblk-recovery.c | 2 --
drivers/lightnvm/pblk.h | 5 +++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index fdc770f2545f..188c89819a40 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -487,8 +487,6 @@ static int pblk_recov_scan_all_oob(struct pblk *pblk, struct pblk_line *line,
bitmap_clear(line->map_bitmap, line->cur_sec, nr_error_bits);
pad_secs = pblk_pad_distance(pblk);
- if (pad_secs > line->left_msecs)
- pad_secs = line->left_msecs;
ret = pblk_recov_pad_oob(pblk, line, pad_secs);
if (ret)
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 54f937c1fb62..994a081994fb 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -990,12 +990,13 @@ static inline int pblk_line_vsc(struct pblk_line *line)
return le32_to_cpu(*line->vsc);
}
-static inline int pblk_pad_distance(struct pblk *pblk)
+static inline int pblk_pad_distance(struct pblk *pblk, struct pblk_line *line)
{
struct nvm_tgt_dev *dev = pblk->dev;
struct nvm_geo *geo = &dev->geo;
+ int distance = geo->mw_cunits * geo->all_luns * geo->ws_opt;
- return geo->mw_cunits * geo->all_luns * geo->ws_opt;
+ return (distance > line->left_msecs) ? line->left_msecs : distance;
}
static inline int pblk_ppa_to_line_id(struct ppa_addr p)
--
2.7.4
Powered by blists - more mailing lists