f2fs: use IPU for cold files
authorJaegeuk Kim <jaegeuk@kernel.org>
Sat, 5 Aug 2017 21:25:08 +0000 (14:25 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 15 Aug 2017 17:40:11 +0000 (10:40 -0700)
We expect cold files write data sequentially, but sometimes some of small data
can be updated, which incurs fragmentation.
Let's avoid that.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.h

index 6b871b4..7f700e5 100644 (file)
@@ -577,6 +577,10 @@ static inline bool need_inplace_update_policy(struct inode *inode,
        if (test_opt(sbi, LFS))
                return false;
 
+       /* if this is cold file, we should overwrite to avoid fragmentation */
+       if (file_is_cold(inode))
+               return true;
+
        if (policy & (0x1 << F2FS_IPU_FORCE))
                return true;
        if (policy & (0x1 << F2FS_IPU_SSR) && need_SSR(sbi))