bcache: gc does not work when triggering by manualcommand
Quoted 6 lines · On 2017/6/9 上午8:59, [email protected] wrote:
Hello Coly,
> First we need to know why
> when writeback cashe is full butsectors_to_gc< 0
Quoted 7 lines
Some times, the writeback cashe is not full, we just wanna execute
this commands to get more available buckets, but this command
"echo 1 >
trigger_gc" does not works, this is the issue that the patchfixed.
Oh I see the point! Yes it's useful.
A question is, this patch changes expected behavior of trigger_gc. This modification may change I/O load to existing installations. How about add a new sysfs entry like trigger_gc_force ? And add comments in source code to explain this change is necessary.
IMHO this is quite an important fix, thanks for your effort :-)
Coly
Quoted 70 lines
原始邮件
*发件人:*<[email protected]>; *收件人:*唐军辉10074136;<[email protected]>; <[email protected]>; *抄送人:*<[email protected]>;
*日 期 :*2017年06月08日 23:54
*主 题 :**Re: [PATCH] bcache: gc does not work when triggering by manualcommand*On 2017/6/8 下午2:39, [email protected] wrote:
> From: Tang Junhui <[email protected]>
>
> I try to execute the following command to trigger gc thread:
> [root@localhost internal]# echo 1 >trigger_gc
> But it does not work, I debug the code ingc_should_run(), It works only > if in invalidating orsectors_to_gc< 0. So setsectors_to_gcto -1 to > meet the condition when we trigger gc by manual command.
>
> Signed-off-by: Tang Junhui <[email protected]>This fix may make things more complicated. First we need to know why when writeback cashe is full but
sectors_to_gc< 0 ? If we don't find out the root reason, this fix is not convinced.Thanks.
Coly
> ---
> drivers/md/bcache/btree.h | 6 ++++++ > drivers/md/bcache/sysfs.c | 2 +- > 2 files changed, 7 insertions(+), 1 deletion(-)>
> diff --gita/drivers/md/bcache/btree.hb/drivers/md/bcache/btree.h> index 9b80417..bab07d4 100644
> ---a/drivers/md/bcache/btree.h
> +++b/drivers/md/bcache/btree.h
> @@ -263,6 +263,12 @@ static inline voidwake_up_gc(struct cache_set *c)
>wake_up(&c->gc_wait);
> }
>
> +static inline voidwake_up_gc_force(struct cache_set *c)
> +{
> +atomic_set(&c->sectors_to_gc, -1);
> +wake_up(&c->gc_wait);
> +}
> +
> #defineMAP_DONE0
> #defineMAP_CONTINUE1
>
> diff --gita/drivers/md/bcache/sysfs.cb/drivers/md/bcache/sysfs.c> index b3ff57d..5fdb86c 100644
> ---a/drivers/md/bcache/sysfs.c
> +++b/drivers/md/bcache/sysfs.c
> @@ -615,7 +615,7 @@STORE(__bch_cache_set)
> }
>
> if (attr ==&sysfs_trigger_gc)
> -wake_up_gc(c);
> +wake_up_gc_force(c);
>
> if (attr ==&sysfs_prune_cache) {
> structshrink_controlsc;
>
Signature · 1 line
Coly Li