Re: [PATCH 04/13] lightnvm: pblk: Rollback in gc read

Javier González
2019-03-04T07:38:22Z

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

> On 27 Feb 2019, at 18.14, Igor Konopko <igor.j.konopko@intel.com> wrote:
>
> Currently in case of error returned by pblk_gc_line
> to pblk_gc_read we leave current line unassigned
> from all the lists. This patch fixes that issue.
>
> Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
> ---
> drivers/lightnvm/pblk-gc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/lightnvm/pblk-gc.c b/drivers/lightnvm/pblk-gc.c
> index 511ed0d5333c..533da6ea3e15 100644
> --- a/drivers/lightnvm/pblk-gc.c
> +++ b/drivers/lightnvm/pblk-gc.c
> @@ -361,8 +361,13 @@ static int pblk_gc_read(struct pblk *pblk)
>
> pblk_gc_kick(pblk);
>
> - if (pblk_gc_line(pblk, line))
> + if (pblk_gc_line(pblk, line)) {
> pblk_err(pblk, "failed to GC line %d\n", line->id);
> + /* rollback */
> + spin_lock(&gc->r_lock);
> + list_add_tail(&line->list, &gc->r_list);
> + spin_unlock(&gc->r_lock);
> + }
>
> return 0;
> }
> --
> 2.17.1

Looks good to me.

Reviewed-by: Javier González <javier@javigon.com>

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]