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 <[email protected]>
---
 drivers/lightnvm/pblk-recovery.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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);
-- 
1.8.3.1

Reply via email to