From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751911AbdH1JU4 (ORCPT ); Mon, 28 Aug 2017 05:20:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5474 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbdH1JUx (ORCPT ); Mon, 28 Aug 2017 05:20:53 -0400 Subject: Re: [PATCH] f2fs: issue discard commands if gc_urgent is set To: Jaegeuk Kim , , , References: <20170821205647.67775-1-jaegeuk@kernel.org> From: Chao Yu Message-ID: Date: Mon, 28 Aug 2017 17:20:35 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170821205647.67775-1-jaegeuk@kernel.org> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59A3E06F.00C7,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 0363bb24968610aba044a88c972bc5a8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/8/22 4:56, Jaegeuk Kim wrote: > It's time to issue all the discard commands, if user sets the idle time. > > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu > --- > fs/f2fs/segment.c | 6 +++++- > fs/f2fs/sysfs.c | 5 +++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index 1387925a0d83..e3922f902c8c 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -21,6 +21,7 @@ > #include "f2fs.h" > #include "segment.h" > #include "node.h" > +#include "gc.h" > #include "trace.h" > #include > > @@ -1194,8 +1195,11 @@ static int issue_discard_thread(void *data) > if (kthread_should_stop()) > return 0; > > - if (dcc->discard_wake) > + if (dcc->discard_wake) { > dcc->discard_wake = 0; > + if (sbi->gc_thread && sbi->gc_thread->gc_urgent) > + mark_discard_range_all(sbi); > + } > > sb_start_intwrite(sbi->sb); > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > index 4bcaa9059026..b9ad9041559f 100644 > --- a/fs/f2fs/sysfs.c > +++ b/fs/f2fs/sysfs.c > @@ -178,8 +178,13 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a, > if (!strcmp(a->attr.name, "iostat_enable") && *ui == 0) > f2fs_reset_iostat(sbi); > if (!strcmp(a->attr.name, "gc_urgent") && t == 1 && sbi->gc_thread) { > + struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; > + > sbi->gc_thread->gc_wake = 1; > wake_up_interruptible_all(&sbi->gc_thread->gc_wait_queue_head); > + > + dcc->discard_wake = 1; > + wake_up_interruptible_all(&dcc->discard_wait_queue); > } > > return count; >