Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4724778imu; Mon, 12 Nov 2018 16:16:01 -0800 (PST) X-Google-Smtp-Source: AJdET5fi573mHsZBOmHVtSYXSG11bCfyZpWGX/DtuR0HvTalDUDWnlSv74frJYb9iMyRZHZI+xAe X-Received: by 2002:a63:f959:: with SMTP id q25mr2725262pgk.315.1542068161261; Mon, 12 Nov 2018 16:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542068161; cv=none; d=google.com; s=arc-20160816; b=P3SawVTz+E9YBVk8PhEFZWEnk/5deLs4upjiiacHAhpHXTHYa5g+RshrvWhFT5fiR3 jGQ1epSfDS2qLhToOG8+LF3nmGTXSWmdI1MtHNI8l1S5HfRCySfNjqI+JffNh7W1gRcx QtcmfNejxzfHmup+149ynkjav4wEiDnvbqBcueNVri+yCtlRhXJSUdACG3lpvFbrlJyU Nvq6voq+cqd8cpdW5qQKn05ijqoyC8NAE01MdBtZY6HF4IKV4jUnS2jYlgwK1Y7Ag/2f 6SLQA2tZhIUZvNq3jHMDWXRNLovn4sGcQXq8kU/m0j0fnkjR+c01X1iErNHZZs4wDW/b p+hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0bLyPJVcLXvpW8rVIAmXl7Hv0uSaMEV5+rlQBvw1LMc=; b=mXigx8qzLvLUHaDzH5AsFtbSycBlHToepESATMR5Ac0n9UnZpoLlNwwTZhgVCFwJh4 afFl2zgpAWB+MNtn4eQsSn/idw+obK6Puh5AQI1Slw0izxRpphlKz267hopcihLGn320 UXSAHBbQtk/h3NNHAy25aQkHqrvnTa6mjpxj+wET6rFfoRhQFlm0wNW7R6DVYKgZlmyV lXipvQGYJNTVygiPSYMvgIZR9M2G2jAgwaVnOguM90zIGkEuCgYslJKzl7Iy1oujy3pG RJxp0hzmHRJqWAJGWM1C6H+6UzAKhz1mn8BvPfVNr+wNkQXefryp0QtnzxzDJdb2+aus EOtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UdC94+D0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si20749760pfi.134.2018.11.12.16.15.44; Mon, 12 Nov 2018 16:16:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=UdC94+D0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729244AbeKMKKs (ORCPT + 99 others); Tue, 13 Nov 2018 05:10:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:47300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbeKMKKs (ORCPT ); Tue, 13 Nov 2018 05:10:48 -0500 Received: from localhost (unknown [64.114.255.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73804224E0; Tue, 13 Nov 2018 00:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542068119; bh=mzbjpKU9Vg741DbBOW8tnJ+52nAuVvvIrY1PneRqDt0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UdC94+D0Frl08eKsQBi9rvG5wRJPWDmhbvd1ANtlICk7IhQTpRNUtsSccOsRj8eAT 2rCZgsBjoUZxtjTIwxo7dtrwS8vi2O+tF4JzdwZppLOBSNiBCGIfOWZtfPVz9suvnA 3ZOhiEEm3dY7ImcYEelT2jVZqyNObmft8chgsFVQ= Date: Mon, 12 Nov 2018 16:15:17 -0800 From: Jaegeuk Kim To: Yunlong Song Cc: chao@kernel.org, yuchao0@huawei.com, yunlong.song@icloud.com, miaoxie@huawei.com, bintian.wang@huawei.com, shengyong1@huawei.com, heyunlei@huawei.com, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] f2fs: only flush the single temp bio cache which owns the target page Message-ID: <20181112013003.GA83294@jaegeuk-macbookpro.roam.corp.google.com> References: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com> <1540380945-18114-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1540380945-18114-1-git-send-email-yunlong.song@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/24, 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 | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 106f116..882e217 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -396,13 +396,17 @@ static bool has_merged_page(struct f2fs_sb_info *sbi, struct inode *inode, > } > > static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, > - enum page_type type, enum temp_type temp) > + struct inode *inode, struct page *page, nid_t ino, > + enum page_type type, enum temp_type temp, bool force) > { > enum page_type btype = PAGE_TYPE_OF_BIO(type); > struct f2fs_bio_info *io = sbi->write_io[btype] + temp; > > down_write(&io->io_rwsem); > > + if (!force && !__has_merged_page(io, inode, page, ino)) > + goto out; Could you clean up this to call once in __submit_merged_write_cond() only? > + > /* change META to META_FLUSH in the checkpoint procedure */ > if (type >= META_FLUSH) { > io->fio.type = META_FLUSH; > @@ -412,6 +416,7 @@ static void __f2fs_submit_merged_write(struct f2fs_sb_info *sbi, > io->fio.op_flags |= REQ_PREFLUSH | REQ_FUA; > } > __submit_merged_bio(io); > +out: > up_write(&io->io_rwsem); > } > > @@ -426,7 +431,7 @@ static void __submit_merged_write_cond(struct f2fs_sb_info *sbi, > > for (temp = HOT; temp < NR_TEMP_TYPE; temp++) { > > - __f2fs_submit_merged_write(sbi, type, temp); > + __f2fs_submit_merged_write(sbi, inode, page, ino, type, temp, force); > > /* TODO: use HOT temp only for meta pages now. */ > if (type >= META) > -- > 1.8.5.2