Received: by 10.223.164.202 with SMTP id h10csp385742wrb; Fri, 17 Nov 2017 02:13:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMb2WHf6JMtPpMw8O8huKYBktXzGm+xkkVelTR0VVV+X+oBG6gKV1TJq+T++KaY/Y0+MVrE+ X-Received: by 10.99.143.87 with SMTP id r23mr4572414pgn.224.1510913619437; Fri, 17 Nov 2017 02:13:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510913619; cv=none; d=google.com; s=arc-20160816; b=PhRuXXQN+y5fwULIqd10h4p10Y8Bs+cY5gjYQd2dHhjGIOX89yVBuhiQ1g+P4ybMA3 C2MjQDHMFgrc1N11v1RfNCO7h2NwoF61J2GH46oZf8lyv8WmWU1grcMQUgB3kMoAoBYc XGGtZCyOdNZNM68AHQnT6UIa9y+nRCn5RzLXYIklVSyW2Ljats9UAruP34w8TD+ZwHr3 PJTtPLHRncO+XT3blnI+J+MjiHDzTtbD5/c7J8xaWJ3BsElQCHQw1197uwPp4Pm221N/ yUCGN3vbQv3FD/a5zfMhdul8DSOaUVLo5Ey+pO/ergpbuApsja2tMRSc704baK2r5Gpe wUwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=+t3SYavOn+y0KCNDlm6q1wU9hvuCG1+4BqbyN3GxNHU=; b=nP9mQjZMfrDBOprsNO7TowTS3zjIj1n8lS0f+3YYcKXw9DhOMMSaOjEP+/BcIQF4Ze gAqY457WVl90BBkJF3GtFGai0z6EZDOjmzFmvQcYkTaqMuw/rag6lBOFElNKF5Owwjri 2gIFeXft2q7nTdxWtHuGgdMAqLRn3Glecu7o7o6xGaeFoI1P5G8K2uiAIJQlm+6urIRB N51eF8rVfNB+TnU+1MFTAdLkK/yfoJOZaZlAIx4R7SSqtFCJXOr5Ax4iDCdK50cAVdGp DbN4f9/bxKuVVNeF3G6J/70flMJtBkLFM6L43NyfSTx+DNnfGkY38RHUr7MAzeIYASde aEdA== 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 h9si2343161pli.42.2017.11.17.02.13.26; Fri, 17 Nov 2017 02:13:39 -0800 (PST) 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 S1756188AbdKQDGP (ORCPT + 91 others); Thu, 16 Nov 2017 22:06:15 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10938 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755738AbdKQDGG (ORCPT ); Thu, 16 Nov 2017 22:06:06 -0500 Received: from 172.30.72.60 (EHLO DGGEMS409-HUB.china.huawei.com) ([172.30.72.60]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKZ66798; Fri, 17 Nov 2017 11:05:54 +0800 (CST) Received: from [127.0.0.1] (10.111.220.140) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Fri, 17 Nov 2017 11:05:45 +0800 Subject: Re: [PATCH] f2fs: let f2fs also gc atomic file to avoid loop gc To: Chao Yu , , , CC: , , , , References: <1510108497-58331-1-git-send-email-yunlong.song@huawei.com> <239f770e-53f0-69c6-fc1d-67aeb9a1065a@huawei.com> From: Yunlong Song Message-ID: <383339b7-528d-3085-1399-1f1694178c15@huawei.com> Date: Fri, 17 Nov 2017 11:04:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.111.220.140] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5A0E5212.004D,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: 98205335c7ba22f4eaa5a6bd33a4556d Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The atomic commit will trigger: -f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true) -file_write_and_wait_range(file, 0, LLONG_MAX) -fsync_node_pages -__write_node_page -REQ_PREFLUSH | REQ_FUA So data is flushed to non-volatile before last node write with REQ_PREFLUSH | REQ_FUA, we do not need to worry about the inconsistent problem. Right? On 2017/11/17 10:49, Chao Yu wrote: > On 2017/11/17 8:58, Yunlong Song wrote: >> Is there any problem if just deleting the judgement condition in this patch? > IIRC, dirty node comes from data segment GC can be writebacked & flushed during > atomic commit, but related data will still be in inner bio cache, after later > SPOR, data would be inconsistent. > > Thanks, > >> On 2017/11/8 17:28, Chao Yu wrote: >>> On 2017/11/8 10:34, Yunlong Song wrote: >>>> If some files are opened with atomic flag and have not commited yet, at >>>> the same time, if all the target victim segments have at least one page >>>> of these atomic files, then f2fs gc will fail to do gc and hangs in the >>>> process of go to gc_more, since gc_date_segment will not move any data >>>> and get_valid_blocks will never be 0, then do_garbage_collect will >>>> always return 0. >>> Oh, I added this judgment condition to avoid ruining atomic write by data >>> GC, could we find another way to solve this issue? BTW, if there is direct >>> IO, we will also skip data segment GC. >>> >>> Thanks, >>> >>>> Signed-off-by: Yunlong Song >>>> --- >>>> fs/f2fs/gc.c | 6 ------ >>>> 1 file changed, 6 deletions(-) >>>> >>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >>>> index 5d5bba4..3fdcd04 100644 >>>> --- a/fs/f2fs/gc.c >>>> +++ b/fs/f2fs/gc.c >>>> @@ -621,9 +621,6 @@ static void move_data_block(struct inode *inode, block_t bidx, >>>> if (!check_valid_map(F2FS_I_SB(inode), segno, off)) >>>> goto out; >>>> >>>> - if (f2fs_is_atomic_file(inode)) >>>> - goto out; >>>> - >>>> set_new_dnode(&dn, inode, NULL, NULL, 0); >>>> err = get_dnode_of_data(&dn, bidx, LOOKUP_NODE); >>>> if (err) >>>> @@ -718,9 +715,6 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type, >>>> if (!check_valid_map(F2FS_I_SB(inode), segno, off)) >>>> goto out; >>>> >>>> - if (f2fs_is_atomic_file(inode)) >>>> - goto out; >>>> - >>>> if (gc_type == BG_GC) { >>>> if (PageWriteback(page)) >>>> goto out; >>>> >>> . >>> > > . > -- Thanks, Yunlong Song From 1584307758154174969@xxx Fri Nov 17 10:13:38 +0000 2017 X-GM-THRID: 1583469797370502209 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread