lkml.org 
[lkml]   [2018]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] f2fs: only flush the single temp bio cache which owns the target page
Date
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 | 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);
+ return;
+ }
+
for (temp = HOT; temp < NR_TEMP_TYPE; temp++) {

__f2fs_submit_merged_write(sbi, type, temp);
--
1.8.5.2
\
 
 \ /
  Last update: 2018-10-24 10:12    [W:0.111 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site