f2fs: return error when accessing insane flie offset
[linux-2.6-block.git] / fs / f2fs / segment.h
index 6b871b492fd5cdc7fc81dcad4684b0a0680e4c72..b9b4f85ffeb6a8399e21f24b2f400e4b55ca2c2e 100644 (file)
@@ -492,11 +492,6 @@ static inline int overprovision_segments(struct f2fs_sb_info *sbi)
        return SM_I(sbi)->ovp_segments;
 }
 
-static inline int overprovision_sections(struct f2fs_sb_info *sbi)
-{
-       return GET_SEC_FROM_SEG(sbi, (unsigned int)overprovision_segments(sbi));
-}
-
 static inline int reserved_sections(struct f2fs_sb_info *sbi)
 {
        return GET_SEC_FROM_SEG(sbi, (unsigned int)reserved_segments(sbi));
@@ -577,6 +572,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))