Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp753400imm; Wed, 10 Oct 2018 03:53:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV62hN5pEmdj7I1eNwPq5savBgNbkbGcVytReZr0jyA5vDbVZyzTpBYGS8lBALiYUqEZArjwe X-Received: by 2002:a63:da57:: with SMTP id l23-v6mr29718592pgj.179.1539168804501; Wed, 10 Oct 2018 03:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539168804; cv=none; d=google.com; s=arc-20160816; b=yl58VGFiQfS8C2ldOTA4a8WZO4MNdc7120xqbFihQjQ57480SdEYbb88Z2WnZAqEdE JRSd2Lf6afJu+PSC05EHZqmf5pz93/8SiMa9kn+yv9Kf6xAgtmOqob75Z57ngz3BMn2z MMsy6SMwCmqq5tk7oH3vAeHKi3/TDYZKpAtEZ2lTRjhulF5NeYXv93uENXr2qrCvLikx cF2lSyiA6gF2u5lAIlHRdRxpCh75YhlSP/rOlsJF0RIf5v5TMt5tcOMXeMpyf47ud1ue 6DgNot4m2M3hsBSP3XUO1NyGvcAVzdu7i6aqivuskqVpDpS3Wsa3W8BSjN//nkCj4E6K 9HlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=qch1hzzvIA+Up2+uIk+a6hR6q8J9yogGmN9CIDv21FM=; b=oP70Aw8MxEdS3Y5BHmVp0tc8I/VE63Olk2fCtPeb0tJteXiWz/leXM3RKPuNlgbjUM iPlFLjxb1OWbyg5meQ88BcvrksO4wc8QfyL1jw7mJGV2oD3TajAnIdCjirp+/GjEdArW djo02OoritHEkSeG1X5xE9KIpQGuz9sXFuNR0RFukTQ5+vqUf25oDoVYGe/HPeOp+TPO PLQZ/ofZtC9Bddmo3W3upi61jG0TyGip1nxbSPeb92cPsasTcm6V0Tvlpwhn3ZqRdwgi 3LC54yzPMAIgnC03xSQYhW1Us6AZ32E9k1G6KcuAncS8OKus8YFuzJxRpOFSJuqMFDfc bhcg== 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 g13-v6si23887384plq.373.2018.10.10.03.53.10; Wed, 10 Oct 2018 03:53:24 -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 S1726836AbeJJSOQ (ORCPT + 99 others); Wed, 10 Oct 2018 14:14:16 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43641 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726206AbeJJSOQ (ORCPT ); Wed, 10 Oct 2018 14:14:16 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 34176E06B9635; Wed, 10 Oct 2018 18:52:37 +0800 (CST) Received: from huawei.com (10.113.189.234) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.399.0; Wed, 10 Oct 2018 18:52:31 +0800 From: Yunlong Song To: , , , , CC: , , , , , Subject: [PATCH] f2fs: fix count of seg_freed to make sec_freed correct Date: Wed, 10 Oct 2018 18:52:19 +0800 Message-ID: <1539168739-79848-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.113.189.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: f2fs_put_page(sum_page, 0); } -- 1.8.5.2