Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6764725imm; Tue, 24 Jul 2018 02:38:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdDY+fnEXS7qNOM5+5W5bgMPjJ5xC277vh+mWbR2gDyPBcsFe4QO0gydDqdAyfy6csQZssB X-Received: by 2002:a17:902:8a95:: with SMTP id p21-v6mr16284442plo.91.1532425095198; Tue, 24 Jul 2018 02:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532425095; cv=none; d=google.com; s=arc-20160816; b=hi+Wgo3GhB3K5Ns2c98H3M2KYFNvyZXBVIuRev7ZmA5ZAS0uVr5BwjZNGiXym6k+yM 94B7lCk1uOftyYPSVZjbPbP4PqKTDQGO9+g0XgIddw1z/x591nklxIAiIWXBW9CEhuw/ K8GU6d9HDM0eHOW2f4cAxJYyuPXfiqBzaOE2Asqg2uENBtLQ46T41QvYyMOJSK+o7WAP hEpTQMbQrGuc5SUqxpnJ7b3xgY6BU8xtaT7og0/EpyAtdOZm5LarOrQvBuz4EJTTEBxP Pkc7/ck0aF0es2ZQAh6wM9CZjfG7f+6K1bZkSbbZyMJZgqHREFzdGKTvDsz7eScLE4eZ XZ3A== 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:arc-authentication-results; bh=EvHq84nYGiqgEsKZvwgBuzMu0cQUqxZ79bPvRkoBfdU=; b=TXLTrOIJBdfY6ydGc1WbKJRa6ubeUazaX1D03i0LyW+jyRy90QVeJo6ceGwL/8Jox5 QbsczXu4BGUFhHWiWPNkNDbqhDMMXKzZP19w6PwgeH38HcSqjfPdJ/VIbh7UhVLa9VxP 71aOrxSP8dq82Bd/a0GtHxrwXtAw7hS4/CgF5qxvjz0STOddimB+jr3ruRuVvloPOXtP w5LaqnwhdVayVShmmhQUI5fGVuKyHxdioZ+dMt+H93QToSWADDIqfv1KSxP+H69pP1Vp wkp9mn2srRkcTE3h9KLboBK6u9AmsNdi+JeBV71Go5k+jJTBB6vr53FFNxVCS9Swi4a1 oenw== 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 b205-v6si11636555pfb.358.2018.07.24.02.38.00; Tue, 24 Jul 2018 02:38:15 -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 S2388400AbeGXKm3 (ORCPT + 99 others); Tue, 24 Jul 2018 06:42:29 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:59286 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726457AbeGXKm3 (ORCPT ); Tue, 24 Jul 2018 06:42:29 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 027DB728B47E8; Tue, 24 Jul 2018 17:36:50 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.382.0; Tue, 24 Jul 2018 17:36:44 +0800 Subject: Re: [PATCH v2] f2fs: clear victim_secmap when section has full valid blocks To: Yunlong Song , , , CC: , , , , , References: <1532355022-163029-1-git-send-email-yunlong.song@huawei.com> <1532424442-9867-1-git-send-email-yunlong.song@huawei.com> From: Chao Yu Message-ID: <8026538e-2a8b-fad4-82b1-9bb2c04e097d@huawei.com> Date: Tue, 24 Jul 2018 17:36:44 +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: <1532424442-9867-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/7/24 17:27, Yunlong Song wrote: > Without this patch, f2fs only clears victim_secmap when it finds out > that the section has no valid blocks at all, but forgets to clear the > victim_secmap when the whole section has full valid blocks. Look this patch again, I have a question, why bggc selected section can get back to full state? Thanks, > > Signed-off-by: Yunlong Song > --- > fs/f2fs/segment.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index cfff7cf..0a79554 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -776,7 +776,8 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, > if (test_and_clear_bit(segno, dirty_i->dirty_segmap[t])) > dirty_i->nr_dirty[t]--; > > - if (get_valid_blocks(sbi, segno, true) == 0) > + if (get_valid_blocks(sbi, segno, true) == 0 || > + get_valid_blocks(sbi, segno, true) == BLKS_PER_SEC(sbi)) > clear_bit(GET_SEC_FROM_SEG(sbi, segno), > dirty_i->victim_secmap); > } >