From: "Matias Bjørling" <mb@lightnvm.io>
To: Wenwei Tao <ww.tao0320@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH v2] lightnvm: fix rrpc_lun_gc
Date: Mon, 4 Jan 2016 11:18:03 +0100 [thread overview]
Message-ID: <568A46DB.5000702@lightnvm.io> (raw)
In-Reply-To: <1451536841-20494-1-git-send-email-ww.tao0320@gmail.com>
On 12/31/2015 05:40 AM, Wenwei Tao wrote:
> This patch fix two issues in rrpc_lun_gc
>
> 1. prio_list is protected by rrpc_lun's lock not nvm_lun's, so
> acquire rlun's lock instead of lun's before operate on the list.
>
> 2. we delete block from prio_list before allocating gcb, but gcb
> allocation may fail, we end without putting it back to the list,
> this makes the block won't get reclaimed in the future. To solve
> this issue, delete block after gcb allocation.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
>
> Changed in v2:
> -Advance the gcb allocation, make the debug log deliver
> the correct message.
>
> drivers/lightnvm/rrpc.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
> index 67b14d4..40b0309 100644
> --- a/drivers/lightnvm/rrpc.c
> +++ b/drivers/lightnvm/rrpc.c
> @@ -443,7 +443,7 @@ static void rrpc_lun_gc(struct work_struct *work)
> if (nr_blocks_need < rrpc->nr_luns)
> nr_blocks_need = rrpc->nr_luns;
>
> - spin_lock(&lun->lock);
> + spin_lock(&rlun->lock);
> while (nr_blocks_need > lun->nr_free_blocks &&
> !list_empty(&rlun->prio_list)) {
> struct rrpc_block *rblock = block_prio_find_max(rlun);
> @@ -452,16 +452,16 @@ static void rrpc_lun_gc(struct work_struct *work)
> if (!rblock->nr_invalid_pages)
> break;
>
> + gcb = mempool_alloc(rrpc->gcb_pool, GFP_ATOMIC);
> + if (!gcb)
> + break;
> +
> list_del_init(&rblock->prio);
>
> BUG_ON(!block_is_full(rrpc, rblock));
>
> pr_debug("rrpc: selected block '%lu' for GC\n", block->id);
>
> - gcb = mempool_alloc(rrpc->gcb_pool, GFP_ATOMIC);
> - if (!gcb)
> - break;
> -
> gcb->rrpc = rrpc;
> gcb->rblk = rblock;
> INIT_WORK(&gcb->ws_gc, rrpc_block_gc);
> @@ -470,7 +470,7 @@ static void rrpc_lun_gc(struct work_struct *work)
>
> nr_blocks_need--;
> }
> - spin_unlock(&lun->lock);
> + spin_unlock(&rlun->lock);
>
> /* TODO: Hint that request queue can be started again */
> }
>
Thanks, applied for 4.5. I've changed the title a bit.
prev parent reply other threads:[~2016-01-04 10:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-31 4:40 [PATCH v2] lightnvm: fix rrpc_lun_gc Wenwei Tao
2016-01-04 10:18 ` Matias Bjørling [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568A46DB.5000702@lightnvm.io \
--to=mb@lightnvm.io \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ww.tao0320@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.