summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-gc.c
diff options
context:
space:
mode:
authorHans Holmberg <hans.holmberg@cnexlabs.com>2018-01-05 14:16:08 +0100
committerJens Axboe <axboe@kernel.dk>2018-01-05 08:50:12 -0700
commit06bc072b3fb1d08898b96118ab428ea33a8da0a6 (patch)
treea5ddfad7ac8585d490d60c8983b56ddadaac73fc /drivers/lightnvm/pblk-gc.c
parentd6d3ec2a3be37ca5309013b46ede37b2aa09ced1 (diff)
downloadlinux-06bc072b3fb1d08898b96118ab428ea33a8da0a6.tar.gz
linux-06bc072b3fb1d08898b96118ab428ea33a8da0a6.tar.bz2
linux-06bc072b3fb1d08898b96118ab428ea33a8da0a6.zip
lightnvm: pblk: refactor emeta consistency check
Currently pblk_recov_get_lba list does two separate things: it checks the consistency of the emeta and extracts the lba list. This patch separates the consistency check to make the code easier to read and to prepare for version checks of the line emeta persistent data format version. Signed-off-by: Hans Holmberg <hans.holmberg@cnexlabs.com> Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-gc.c')
-rw-r--r--drivers/lightnvm/pblk-gc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
index 9c8e114c8a54..cec9a56dda14 100644
--- a/drivers/lightnvm/pblk-gc.c
+++ b/drivers/lightnvm/pblk-gc.c
@@ -169,7 +169,14 @@ static void pblk_gc_line_prepare_ws(struct work_struct *work)
* the line untouched. TODO: Implement a recovery routine that scans and
* moves all sectors on the line.
*/
- lba_list = pblk_recov_get_lba_list(pblk, emeta_buf);
+
+ ret = pblk_recov_check_emeta(pblk, emeta_buf);
+ if (ret) {
+ pr_err("pblk: inconsistent emeta (line %d)\n", line->id);
+ goto fail_free_emeta;
+ }
+
+ lba_list = emeta_to_lbas(pblk, emeta_buf);
if (!lba_list) {
pr_err("pblk: could not interpret emeta (line %d)\n", line->id);
goto fail_free_emeta;