diff options
author | Javier González <javier@javigon.com> | 2018-10-09 14:11:57 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-10-09 17:25:07 +0300 |
commit | 63dee3a6c39a5bfa5f299ebb314f2e3e0273092b (patch) | |
tree | a27e58c5925b271de2fd70e09f4b75819cbd2c88 /drivers/lightnvm/pblk-recovery.c | |
parent | 7f985f9a691dc25ddcfc9dc7ff21199f5ee1569c (diff) | |
download | linux-63dee3a6c39a5bfa5f299ebb314f2e3e0273092b.tar.xz |
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@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-recovery.c')
-rw-r--r-- | drivers/lightnvm/pblk-recovery.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 0322ab915ddc..8036c3eb6372 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -380,6 +380,15 @@ fail_free_pad: return ret; } +static 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 (distance > line->left_msecs) ? line->left_msecs : distance; +} + /* When this function is called, it means that not all upper pages have been * written in a page that contains valid data. In order to recover this data, we * first find the write pointer on the device, then we pad all necessary @@ -495,9 +504,7 @@ next_rq: line->left_msecs += nr_error_bits; 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; + pad_secs = pblk_pad_distance(pblk, line); ret = pblk_recov_pad_oob(pblk, line, pad_secs); if (ret) |