Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp380752ima; Wed, 24 Oct 2018 02:55:57 -0700 (PDT) X-Google-Smtp-Source: AJdET5eFQph0feAG9sB7kZuduh39Xa5fEnq9HEsMOvxVDshRXpa2rgz65VHyKsRZfx0beWIzSpyS X-Received: by 2002:a17:902:930a:: with SMTP id bc10-v6mr1926617plb.17.1540374957890; Wed, 24 Oct 2018 02:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540374957; cv=none; d=google.com; s=arc-20160816; b=slTREzcL2UCi8yeE80G/E9MKw8wEWqJvLKI2gkpS6U2qfiR3taM/OT5wfCMuJOeHiF Yp1WaiFRlbU6F4oxOuotLKFm5VnEKNXUTD32pAFsI5I1DsahHJaeJZ3Hf1bLPH3vO3CE tSEcOYpLUM85tWAR3Nq3Jv9jAX/wRjf1d9AH7RxoxaGvHGYc/F1hfK4REHOvdcWaNZIf C8RpFz6kdrmSb7WAvpjm6EuWmaQX8OvaOCPJDQmokaOG30VUvA3Xynn1oLnmYoJ/utZl bWXCP17f75z61NFX0WCQTbvQHNtsAuIja14jRY9D9h5bnpkGj6uCYsAFqpJzfYhJ7AMx kWuA== 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=3ipY7AaDM/TIkPZqrpQhVXjaagBvONpSAjymN0smHMM=; b=Lf+tOdlPCbwIs3FwZ5mv2VxzML+JA6QGf0gAFmk4198g6OM1LJSyi6+BGsBlU92I6i JGjBg8qWCq7ou+n0nOyU4MYElqogTdNhvXfwy31hMD1/Vx400QRnnv1fbLLiItnaWEux 5+OLjwpkLh94YDbPEaqfuCr3SDOVjRcHTngyLUTjKyip8LfC779seGpPt/m3ulz+IrIr s7hqY83USkt1dBf3vCDlR5bu5EU7wUp9I2JDJ9X8XJ53ar/qmR6DZ+zJwzoR7LUvLpWD mdBA+MP24+EeTU+vIdGZ1TvODSidYr0HbwgCbdSNjO4hAjSBuPeCGWTNIrFYxRWuAHwo Fs7g== 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 h18-v6si3910335pgv.47.2018.10.24.02.55.42; Wed, 24 Oct 2018 02:55:57 -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 S1727112AbeJXSWp (ORCPT + 99 others); Wed, 24 Oct 2018 14:22:45 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43083 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726258AbeJXSWo (ORCPT ); Wed, 24 Oct 2018 14:22:44 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E24B051D74681; Wed, 24 Oct 2018 17:55:16 +0800 (CST) Received: from [127.0.0.1] (10.134.22.195) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.408.0; Wed, 24 Oct 2018 17:55:09 +0800 Subject: Re: [PATCH] f2fs: only flush the single temp bio cache which owns the target page To: Yunlong Song , , , CC: , , , , , References: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com> From: Chao Yu Message-ID: <5a92fd67-5a36-b14e-0c4d-820bcaa86568@huawei.com> Date: Wed, 24 Oct 2018 17:55:08 +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: <1540368651-14353-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 Hi Yunlong, On 2018/10/24 16:10, Yunlong Song wrote: > Previously, when f2fs finds which temp bio cache owns the target page, > it will flush all the three temp bio caches, but we only need to flush > one single bio cache indeed, which can help to keep bio merged. > > Signed-off-by: Yunlong Song > --- > fs/f2fs/data.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 106f116..04ebbad 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -374,7 +374,7 @@ static bool __has_merged_page(struct f2fs_bio_info *io, struct inode *inode, > > static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, > struct page *page, nid_t ino, > - enum page_type type) > + enum page_type type, enum temp_type *owner) > { > enum page_type btype = PAGE_TYPE_OF_BIO(type); > enum temp_type temp; > @@ -392,6 +392,10 @@ static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, > if (ret || btype == META) > break; > } > + if (!ret || (!inode && !page && !ino)) > + *owner = NR_TEMP_TYPE; > + else > + *owner = temp; > return ret; > } > > @@ -421,9 +425,14 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, > { > enum temp_type temp; > > - if (!force && !has_merged_page(sbi, inode, page, ino, type)) > + if (!force && !has_merged_page(sbi, inode, page, ino, type, &temp)) > return; > > + if (!force && temp != NR_TEMP_TYPE) { > + __f2fs_submit_merged_write(sbi, type, temp); I think we need to add has_merged_page into __f2fs_submit_merged_write to check whether we should submit bio from different log, otherwise we will missed to submit bio in below condition: - f2fs_write_cache_pages - add page into bio cache of cold log - add page into bio cache of warm log - f2fs_submit_merged_write_cond(inode) - __f2fs_submit_merged_write(warm) -- missed to submit bio of cold log Thanks, > + return; > + } > + > for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { > > __f2fs_submit_merged_write(sbi, type, temp); >