Message ID | 1548291314-27225-1-git-send-email-zjwu@marvell.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | lightnvm: pblk: ignore bad block wp for pblk_line_wp_is_unbalanced | expand |
> On 24 Jan 2019, at 01.55, Zhoujie Wu <zjwu@marvell.com> wrote: > > The write pointer of the bad block could be 0 or undefined, ignore > the checking of the bad block wp for pblk_line_wp_is_unbalanced to > avoid fake warning. > > Signed-off-by: Zhoujie Wu <zjwu@marvell.com> > --- > drivers/lightnvm/pblk-recovery.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c > index 5ee20da..e1fba98 100644 > --- a/drivers/lightnvm/pblk-recovery.c > +++ b/drivers/lightnvm/pblk-recovery.c > @@ -312,21 +312,27 @@ static int pblk_line_wp_is_unbalanced(struct pblk *pblk, > struct nvm_chk_meta *chunk; > struct ppa_addr ppa; > u64 line_wp; > - int pos, i; > + int pos, i, v_blk; > v_blk is a bit confusing as it looks like the virtual block abstraction we use in liblightnvm. In other places we call this simply 'bit'. > - rlun = &pblk->luns[0]; > + v_blk = find_first_zero_bit(line->blk_bitmap, lm->blk_per_line); > + if (v_blk > lm->blk_per_line) > + return 0; > + rlun = &pblk->luns[v_blk]; > ppa = rlun->bppa; > pos = pblk_ppa_to_pos(geo, ppa); > chunk = &line->chks[pos]; > > line_wp = chunk->wp; > > - for (i = 1; i < lm->blk_per_line; i++) { > + for (i = v_blk + 1; i < lm->blk_per_line; i++) { > rlun = &pblk->luns[i]; > ppa = rlun->bppa; > pos = pblk_ppa_to_pos(geo, ppa); > chunk = &line->chks[pos]; > > + if (test_bit(pos, line->blk_bitmap)) > + continue; > + Instead, why not simply check for chunk->state in the loop? This is in the end the ground truth for a bad chunk. > if (chunk->wp > line_wp) > return 1; > else if (chunk->wp < line_wp) > -- > 1.9.1 Javier
diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 5ee20da..e1fba98 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -312,21 +312,27 @@ static int pblk_line_wp_is_unbalanced(struct pblk *pblk, struct nvm_chk_meta *chunk; struct ppa_addr ppa; u64 line_wp; - int pos, i; + int pos, i, v_blk; - rlun = &pblk->luns[0]; + v_blk = find_first_zero_bit(line->blk_bitmap, lm->blk_per_line); + if (v_blk > lm->blk_per_line) + return 0; + rlun = &pblk->luns[v_blk]; ppa = rlun->bppa; pos = pblk_ppa_to_pos(geo, ppa); chunk = &line->chks[pos]; line_wp = chunk->wp; - for (i = 1; i < lm->blk_per_line; i++) { + for (i = v_blk + 1; i < lm->blk_per_line; i++) { rlun = &pblk->luns[i]; ppa = rlun->bppa; pos = pblk_ppa_to_pos(geo, ppa); chunk = &line->chks[pos]; + if (test_bit(pos, line->blk_bitmap)) + continue; + if (chunk->wp > line_wp) return 1; else if (chunk->wp < line_wp)
The write pointer of the bad block could be 0 or undefined, ignore the checking of the bad block wp for pblk_line_wp_is_unbalanced to avoid fake warning. Signed-off-by: Zhoujie Wu <zjwu@marvell.com> --- drivers/lightnvm/pblk-recovery.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)