Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3866735imm; Mon, 15 Oct 2018 05:36:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Hpr18S+HuvQFsZHifT9F9e7P+/J+k/o/QrigQ30C1yv9nPD3t4mI/vDwY9cCfU0sANo9W X-Received: by 2002:a17:902:6b4b:: with SMTP id g11-v6mr17184980plt.34.1539606981370; Mon, 15 Oct 2018 05:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539606981; cv=none; d=google.com; s=arc-20160816; b=uX6+I+MkPN5etG+xl5dfKg/EKlcQfiYQlDcU7Q4Z0ka21fAAn2Qwp3YEvxpXyBtkdm 04bpa1r2VQ8Czj6BGpe/dL4epgoOD6gITrAsjs2Np/B73h0G6ViMwlad9mYAPNov+HpW 9Lsvm8GTpepxguv5q5kfWK+pZ83ruFd5ijwWv2vBJCet0GbX2kZRpFph6gWJ1nAxqF39 8aX9z2S3YTOKxId341QtuMaSyCMtiBqeZZZIutncJnKfPxMYpocbrCiJe6q3iFFZP0kx ALcKPb++L3Y4k+1xI7NusJdOG+8+LLrk4+OTv0vi66XFB8UAgAC0bvEMw194byGTa2Lc hwbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=NjSvDpo32ME6xqmGwKhaNJFqoliAX1mJzkc48Jv0JSM=; b=irAxxktkfw5SyoxfN1Q5n5wEy5t6ZaJGrWbdX5/Oifs4yUWy0hbjnonhx6brqG3MKa +CrjBPjrMYWJb4U/NQyzAPJYQqSyvvHfmltM7aoBjmYxiZZJ4rnH3GTqqKPDeQyQdXVj p8AIFj+0cMFepQWgWWQpiwOk4Tq6gt/MHpr+1I5jQHhovZF6S9usQSYY+NbgV57XOg4+ 9omFnuOSW9m5zl/dWJFEBqrHh9Uu9QwFOV58Ha29DfwfaDNNyC8zOxSno+LxmoqgbgtV u8uqosKfyWtydr6BTgHQs5H0E27hFu2PUfhMjfsrNZLY4myWX2eNMhj4VCkgfD4tYkaQ SSdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4-v6si9423838pgj.39.2018.10.15.05.36.06; Mon, 15 Oct 2018 05:36:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbeJOUUY (ORCPT + 99 others); Mon, 15 Oct 2018 16:20:24 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13655 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726400AbeJOUUX (ORCPT ); Mon, 15 Oct 2018 16:20:23 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 86041D112B84F; Mon, 15 Oct 2018 20:35:14 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.399.0; Mon, 15 Oct 2018 20:35:08 +0800 Subject: Re: [PATCH] f2fs: fix count of seg_freed to make sec_freed correct To: Yunlong Song , , , CC: , , , , , References: <1539168739-79848-1-git-send-email-yunlong.song@huawei.com> From: Chao Yu Message-ID: <2d4c379a-77c2-4408-2f23-36753afb95bd@huawei.com> Date: Mon, 15 Oct 2018 20:35:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1539168739-79848-1-git-send-email-yunlong.song@huawei.com> 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/10 18:52, Yunlong Song wrote: > When sbi->segs_per_sec > 1, and if some segno has 0 valid blocks before > gc starts, do_garbage_collect will skip counting seg_freed++, and this > will cause seg_freed < sbi->segs_per_sec and finally skip sec_freed++. > > Signed-off-by: Yunlong Song > --- > fs/f2fs/gc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index a07241f..dc63cd5 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1160,10 +1160,10 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, > > stat_inc_seg_count(sbi, type, gc_type); > > +next: > if (gc_type == FG_GC && > get_valid_blocks(sbi, segno, false) == 0) > seg_freed++; > -next: How about: if (get_valid_blocks(sbi, segno, false) == 0) goto freed; if (!PageUptodate(sum_page) || unlikely(f2fs_cp_error(sbi)) goto next; freed: if (gc_type == FG_GC && get_valid_blocks(sbi, segno, false) == 0) seg_freed++; next: > f2fs_put_page(sum_page, 0); > } > >