linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yunlong Song <yunlong.song@huawei.com>
To: <jaegeuk@kernel.org>, <chao@kernel.org>, <yuchao0@huawei.com>,
	<yunlong.song@icloud.com>, <yunlong.song@huawei.com>
Cc: <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: [PATCH v2] f2fs: only flush the single temp bio cache which owns the target page
Date: Wed, 24 Oct 2018 19:35:45 +0800	[thread overview]
Message-ID: <1540380945-18114-1-git-send-email-yunlong.song@huawei.com> (raw)
In-Reply-To: <1540368651-14353-1-git-send-email-yunlong.song@huawei.com>

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 <yunlong.song@huawei.com>
---
 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;
+
 	/* 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


  parent reply	other threads:[~2018-10-24 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24  8:10 [PATCH] f2fs: only flush the single temp bio cache which owns the target page Yunlong Song
2018-10-24  9:55 ` Chao Yu
2018-10-24 11:35 ` Yunlong Song [this message]
2018-10-25  1:35   ` [PATCH v2] " Chao Yu
2018-11-13  0:15   ` Jaegeuk Kim
2018-11-13  3:57 ` [PATCH v3] " Yunlong Song
2018-11-14 10:49   ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540380945-18114-1-git-send-email-yunlong.song@huawei.com \
    --to=yunlong.song@huawei.com \
    --cc=bintian.wang@huawei.com \
    --cc=chao@kernel.org \
    --cc=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=shengyong1@huawei.com \
    --cc=yuchao0@huawei.com \
    --cc=yunlong.song@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).