diff mbox series

lightnvm: pblk: do not pad line when there are no left_msecs

Message ID 1552919917-12846-1-git-send-email-marcin.dziegielewski@intel.com (mailing list archive)
State New, archived
Headers show
Series lightnvm: pblk: do not pad line when there are no left_msecs | expand

Commit Message

Marcin Dziegielewski March 18, 2019, 2:38 p.m. UTC
When there are no left msecs in line, despite it, we are
trying to pad line. In such case, pblk_recov_pad_line function
returns error, we don't write end meta to this line and
in consequence we need to scan whole line on next pblk load.

This patch fixes this issue, now when there is no left_msecs
we skip padding, write end meta and return success.

Signed-off-by: Marcin Dziegielewski <marcin.dziegielewski@intel.com>
---
 drivers/lightnvm/pblk-recovery.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c
index 83b467b..b9d7d7f 100644
--- a/drivers/lightnvm/pblk-recovery.c
+++ b/drivers/lightnvm/pblk-recovery.c
@@ -880,10 +880,12 @@  int pblk_recov_pad(struct pblk *pblk)
 	left_msecs = line->left_msecs;
 	spin_unlock(&l_mg->free_lock);
 
-	ret = pblk_recov_pad_line(pblk, line, left_msecs);
-	if (ret) {
-		pblk_err(pblk, "tear down padding failed (%d)\n", ret);
-		return ret;
+	if (left_msecs) {
+		ret = pblk_recov_pad_line(pblk, line, left_msecs);
+		if (ret) {
+			pblk_err(pblk, "tear down padding failed (%d)\n", ret);
+			return ret;
+		}
 	}
 
 	pblk_line_close_meta(pblk, line);