@@ -74,40 +74,14 @@ static void __set_extent_info(struct extent_info *ei,
74
74
}
75
75
}
76
76
77
- static bool __may_read_extent_tree (struct inode * inode )
78
- {
79
- struct f2fs_sb_info * sbi = F2FS_I_SB (inode );
80
-
81
- if (!test_opt (sbi , READ_EXTENT_CACHE ))
82
- return false;
83
- if (is_inode_flag_set (inode , FI_NO_EXTENT ))
84
- return false;
85
- if (is_inode_flag_set (inode , FI_COMPRESSED_FILE ) &&
86
- !f2fs_sb_has_readonly (sbi ))
87
- return false;
88
- return S_ISREG (inode -> i_mode );
89
- }
90
-
91
- static bool __may_age_extent_tree (struct inode * inode )
92
- {
93
- struct f2fs_sb_info * sbi = F2FS_I_SB (inode );
94
-
95
- if (!test_opt (sbi , AGE_EXTENT_CACHE ))
96
- return false;
97
- if (is_inode_flag_set (inode , FI_COMPRESSED_FILE ))
98
- return false;
99
- if (file_is_cold (inode ))
100
- return false;
101
-
102
- return S_ISREG (inode -> i_mode ) || S_ISDIR (inode -> i_mode );
103
- }
104
-
105
77
static bool __init_may_extent_tree (struct inode * inode , enum extent_type type )
106
78
{
107
79
if (type == EX_READ )
108
- return __may_read_extent_tree (inode );
109
- else if (type == EX_BLOCK_AGE )
110
- return __may_age_extent_tree (inode );
80
+ return test_opt (F2FS_I_SB (inode ), READ_EXTENT_CACHE ) &&
81
+ S_ISREG (inode -> i_mode );
82
+ if (type == EX_BLOCK_AGE )
83
+ return test_opt (F2FS_I_SB (inode ), AGE_EXTENT_CACHE ) &&
84
+ (S_ISREG (inode -> i_mode ) || S_ISDIR (inode -> i_mode ));
111
85
return false;
112
86
}
113
87
@@ -120,7 +94,22 @@ static bool __may_extent_tree(struct inode *inode, enum extent_type type)
120
94
if (list_empty (& F2FS_I_SB (inode )-> s_list ))
121
95
return false;
122
96
123
- return __init_may_extent_tree (inode , type );
97
+ if (!__init_may_extent_tree (inode , type ))
98
+ return false;
99
+
100
+ if (type == EX_READ ) {
101
+ if (is_inode_flag_set (inode , FI_NO_EXTENT ))
102
+ return false;
103
+ if (is_inode_flag_set (inode , FI_COMPRESSED_FILE ) &&
104
+ !f2fs_sb_has_readonly (F2FS_I_SB (inode )))
105
+ return false;
106
+ } else if (type == EX_BLOCK_AGE ) {
107
+ if (is_inode_flag_set (inode , FI_COMPRESSED_FILE ))
108
+ return false;
109
+ if (file_is_cold (inode ))
110
+ return false;
111
+ }
112
+ return true;
124
113
}
125
114
126
115
static void __try_update_largest_extent (struct extent_tree * et ,
0 commit comments