lkml.org 
[lkml]   [2021]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] f2fs: set file as cold when file defragmentation
From
Date
In file defragmentation by ioctl, all data blocks in the file are
re-written out-of-place. File defragmentation implies user will not update
and mostly read the file. So before the defragmentation, we set file
temperature as cold for better block allocation.

Signed-off-by: Daejun Park <daejun7.park@samsung.com>
---
fs/f2fs/file.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d697c8900fa7..dcac965a05fe 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2669,6 +2669,9 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
map.m_len = pg_end - pg_start;
total = 0;

+ if (!file_is_cold(inode))
+ file_set_cold(inode);
+
while (map.m_lblk < pg_end) {
pgoff_t idx;
int cnt = 0;
--
2.25.1
\
 
 \ /
  Last update: 2021-04-29 08:20    [W:0.473 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site