diff options
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 163 |
1 files changed, 121 insertions, 42 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e921242186f6..8171e80b2ee9 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -21,10 +21,16 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | 22 | ||
23 | #ifdef CONFIG_F2FS_CHECK_FS | 23 | #ifdef CONFIG_F2FS_CHECK_FS |
24 | #define f2fs_bug_on(condition) BUG_ON(condition) | 24 | #define f2fs_bug_on(sbi, condition) BUG_ON(condition) |
25 | #define f2fs_down_write(x, y) down_write_nest_lock(x, y) | 25 | #define f2fs_down_write(x, y) down_write_nest_lock(x, y) |
26 | #else | 26 | #else |
27 | #define f2fs_bug_on(condition) WARN_ON(condition) | 27 | #define f2fs_bug_on(sbi, condition) \ |
28 | do { \ | ||
29 | if (unlikely(condition)) { \ | ||
30 | WARN_ON(1); \ | ||
31 | sbi->need_fsck = true; \ | ||
32 | } \ | ||
33 | } while (0) | ||
28 | #define f2fs_down_write(x, y) down_write(x) | 34 | #define f2fs_down_write(x, y) down_write(x) |
29 | #endif | 35 | #endif |
30 | 36 | ||
@@ -90,6 +96,20 @@ enum { | |||
90 | SIT_BITMAP | 96 | SIT_BITMAP |
91 | }; | 97 | }; |
92 | 98 | ||
99 | enum { | ||
100 | CP_UMOUNT, | ||
101 | CP_SYNC, | ||
102 | CP_DISCARD, | ||
103 | }; | ||
104 | |||
105 | struct cp_control { | ||
106 | int reason; | ||
107 | __u64 trim_start; | ||
108 | __u64 trim_end; | ||
109 | __u64 trim_minlen; | ||
110 | __u64 trimmed; | ||
111 | }; | ||
112 | |||
93 | /* | 113 | /* |
94 | * For CP/NAT/SIT/SSA readahead | 114 | * For CP/NAT/SIT/SSA readahead |
95 | */ | 115 | */ |
@@ -97,7 +117,8 @@ enum { | |||
97 | META_CP, | 117 | META_CP, |
98 | META_NAT, | 118 | META_NAT, |
99 | META_SIT, | 119 | META_SIT, |
100 | META_SSA | 120 | META_SSA, |
121 | META_POR, | ||
101 | }; | 122 | }; |
102 | 123 | ||
103 | /* for the list of ino */ | 124 | /* for the list of ino */ |
@@ -130,7 +151,9 @@ struct discard_entry { | |||
130 | struct fsync_inode_entry { | 151 | struct fsync_inode_entry { |
131 | struct list_head list; /* list head */ | 152 | struct list_head list; /* list head */ |
132 | struct inode *inode; /* vfs inode pointer */ | 153 | struct inode *inode; /* vfs inode pointer */ |
133 | block_t blkaddr; /* block address locating the last inode */ | 154 | block_t blkaddr; /* block address locating the last fsync */ |
155 | block_t last_dentry; /* block address locating the last dentry */ | ||
156 | block_t last_inode; /* block address locating the last inode */ | ||
134 | }; | 157 | }; |
135 | 158 | ||
136 | #define nats_in_cursum(sum) (le16_to_cpu(sum->n_nats)) | 159 | #define nats_in_cursum(sum) (le16_to_cpu(sum->n_nats)) |
@@ -141,6 +164,9 @@ struct fsync_inode_entry { | |||
141 | #define sit_in_journal(sum, i) (sum->sit_j.entries[i].se) | 164 | #define sit_in_journal(sum, i) (sum->sit_j.entries[i].se) |
142 | #define segno_in_journal(sum, i) (sum->sit_j.entries[i].segno) | 165 | #define segno_in_journal(sum, i) (sum->sit_j.entries[i].segno) |
143 | 166 | ||
167 | #define MAX_NAT_JENTRIES(sum) (NAT_JOURNAL_ENTRIES - nats_in_cursum(sum)) | ||
168 | #define MAX_SIT_JENTRIES(sum) (SIT_JOURNAL_ENTRIES - sits_in_cursum(sum)) | ||
169 | |||
144 | static inline int update_nats_in_cursum(struct f2fs_summary_block *rs, int i) | 170 | static inline int update_nats_in_cursum(struct f2fs_summary_block *rs, int i) |
145 | { | 171 | { |
146 | int before = nats_in_cursum(rs); | 172 | int before = nats_in_cursum(rs); |
@@ -155,11 +181,24 @@ static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i) | |||
155 | return before; | 181 | return before; |
156 | } | 182 | } |
157 | 183 | ||
184 | static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int size, | ||
185 | int type) | ||
186 | { | ||
187 | if (type == NAT_JOURNAL) | ||
188 | return size <= MAX_NAT_JENTRIES(sum); | ||
189 | return size <= MAX_SIT_JENTRIES(sum); | ||
190 | } | ||
191 | |||
158 | /* | 192 | /* |
159 | * ioctl commands | 193 | * ioctl commands |
160 | */ | 194 | */ |
161 | #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS | 195 | #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS |
162 | #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS | 196 | #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS |
197 | |||
198 | #define F2FS_IOCTL_MAGIC 0xf5 | ||
199 | #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) | ||
200 | #define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2) | ||
201 | #define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3) | ||
163 | 202 | ||
164 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) | 203 | #if defined(__KERNEL__) && defined(CONFIG_COMPAT) |
165 | /* | 204 | /* |
@@ -222,13 +261,16 @@ struct f2fs_inode_info { | |||
222 | /* Use below internally in f2fs*/ | 261 | /* Use below internally in f2fs*/ |
223 | unsigned long flags; /* use to pass per-file flags */ | 262 | unsigned long flags; /* use to pass per-file flags */ |
224 | struct rw_semaphore i_sem; /* protect fi info */ | 263 | struct rw_semaphore i_sem; /* protect fi info */ |
225 | atomic_t dirty_dents; /* # of dirty dentry pages */ | 264 | atomic_t dirty_pages; /* # of dirty pages */ |
226 | f2fs_hash_t chash; /* hash value of given file name */ | 265 | f2fs_hash_t chash; /* hash value of given file name */ |
227 | unsigned int clevel; /* maximum level of given file name */ | 266 | unsigned int clevel; /* maximum level of given file name */ |
228 | nid_t i_xattr_nid; /* node id that contains xattrs */ | 267 | nid_t i_xattr_nid; /* node id that contains xattrs */ |
229 | unsigned long long xattr_ver; /* cp version of xattr modification */ | 268 | unsigned long long xattr_ver; /* cp version of xattr modification */ |
230 | struct extent_info ext; /* in-memory extent cache entry */ | 269 | struct extent_info ext; /* in-memory extent cache entry */ |
231 | struct dir_inode_entry *dirty_dir; /* the pointer of dirty dir */ | 270 | struct dir_inode_entry *dirty_dir; /* the pointer of dirty dir */ |
271 | |||
272 | struct list_head inmem_pages; /* inmemory pages managed by f2fs */ | ||
273 | struct mutex inmem_lock; /* lock for inmemory pages */ | ||
232 | }; | 274 | }; |
233 | 275 | ||
234 | static inline void get_extent_info(struct extent_info *ext, | 276 | static inline void get_extent_info(struct extent_info *ext, |
@@ -260,11 +302,10 @@ struct f2fs_nm_info { | |||
260 | 302 | ||
261 | /* NAT cache management */ | 303 | /* NAT cache management */ |
262 | struct radix_tree_root nat_root;/* root of the nat entry cache */ | 304 | struct radix_tree_root nat_root;/* root of the nat entry cache */ |
305 | struct radix_tree_root nat_set_root;/* root of the nat set cache */ | ||
263 | rwlock_t nat_tree_lock; /* protect nat_tree_lock */ | 306 | rwlock_t nat_tree_lock; /* protect nat_tree_lock */ |
264 | unsigned int nat_cnt; /* the # of cached nat entries */ | ||
265 | struct list_head nat_entries; /* cached nat entry list (clean) */ | 307 | struct list_head nat_entries; /* cached nat entry list (clean) */ |
266 | struct list_head dirty_nat_entries; /* cached nat entry list (dirty) */ | 308 | unsigned int nat_cnt; /* the # of cached nat entries */ |
267 | struct list_head nat_entry_set; /* nat entry set list */ | ||
268 | unsigned int dirty_nat_cnt; /* total num of nat entries in set */ | 309 | unsigned int dirty_nat_cnt; /* total num of nat entries in set */ |
269 | 310 | ||
270 | /* free node ids management */ | 311 | /* free node ids management */ |
@@ -332,18 +373,16 @@ enum { | |||
332 | }; | 373 | }; |
333 | 374 | ||
334 | struct flush_cmd { | 375 | struct flush_cmd { |
335 | struct flush_cmd *next; | ||
336 | struct completion wait; | 376 | struct completion wait; |
377 | struct llist_node llnode; | ||
337 | int ret; | 378 | int ret; |
338 | }; | 379 | }; |
339 | 380 | ||
340 | struct flush_cmd_control { | 381 | struct flush_cmd_control { |
341 | struct task_struct *f2fs_issue_flush; /* flush thread */ | 382 | struct task_struct *f2fs_issue_flush; /* flush thread */ |
342 | wait_queue_head_t flush_wait_queue; /* waiting queue for wake-up */ | 383 | wait_queue_head_t flush_wait_queue; /* waiting queue for wake-up */ |
343 | struct flush_cmd *issue_list; /* list for command issue */ | 384 | struct llist_head issue_list; /* list for command issue */ |
344 | struct flush_cmd *dispatch_list; /* list for command dispatch */ | 385 | struct llist_node *dispatch_list; /* list for command dispatch */ |
345 | spinlock_t issue_lock; /* for issue list lock */ | ||
346 | struct flush_cmd *issue_tail; /* list tail of issue list */ | ||
347 | }; | 386 | }; |
348 | 387 | ||
349 | struct f2fs_sm_info { | 388 | struct f2fs_sm_info { |
@@ -369,8 +408,11 @@ struct f2fs_sm_info { | |||
369 | int nr_discards; /* # of discards in the list */ | 408 | int nr_discards; /* # of discards in the list */ |
370 | int max_discards; /* max. discards to be issued */ | 409 | int max_discards; /* max. discards to be issued */ |
371 | 410 | ||
411 | struct list_head sit_entry_set; /* sit entry set list */ | ||
412 | |||
372 | unsigned int ipu_policy; /* in-place-update policy */ | 413 | unsigned int ipu_policy; /* in-place-update policy */ |
373 | unsigned int min_ipu_util; /* in-place-update threshold */ | 414 | unsigned int min_ipu_util; /* in-place-update threshold */ |
415 | unsigned int min_fsync_blocks; /* threshold for fsync */ | ||
374 | 416 | ||
375 | /* for flush command control */ | 417 | /* for flush command control */ |
376 | struct flush_cmd_control *cmd_control_info; | 418 | struct flush_cmd_control *cmd_control_info; |
@@ -434,6 +476,7 @@ struct f2fs_sb_info { | |||
434 | struct buffer_head *raw_super_buf; /* buffer head of raw sb */ | 476 | struct buffer_head *raw_super_buf; /* buffer head of raw sb */ |
435 | struct f2fs_super_block *raw_super; /* raw super block pointer */ | 477 | struct f2fs_super_block *raw_super; /* raw super block pointer */ |
436 | int s_dirty; /* dirty flag for checkpoint */ | 478 | int s_dirty; /* dirty flag for checkpoint */ |
479 | bool need_fsck; /* need fsck.f2fs to fix */ | ||
437 | 480 | ||
438 | /* for node-related operations */ | 481 | /* for node-related operations */ |
439 | struct f2fs_nm_info *nm_info; /* node manager */ | 482 | struct f2fs_nm_info *nm_info; /* node manager */ |
@@ -539,6 +582,21 @@ static inline struct f2fs_sb_info *F2FS_SB(struct super_block *sb) | |||
539 | return sb->s_fs_info; | 582 | return sb->s_fs_info; |
540 | } | 583 | } |
541 | 584 | ||
585 | static inline struct f2fs_sb_info *F2FS_I_SB(struct inode *inode) | ||
586 | { | ||
587 | return F2FS_SB(inode->i_sb); | ||
588 | } | ||
589 | |||
590 | static inline struct f2fs_sb_info *F2FS_M_SB(struct address_space *mapping) | ||
591 | { | ||
592 | return F2FS_I_SB(mapping->host); | ||
593 | } | ||
594 | |||
595 | static inline struct f2fs_sb_info *F2FS_P_SB(struct page *page) | ||
596 | { | ||
597 | return F2FS_M_SB(page->mapping); | ||
598 | } | ||
599 | |||
542 | static inline struct f2fs_super_block *F2FS_RAW_SUPER(struct f2fs_sb_info *sbi) | 600 | static inline struct f2fs_super_block *F2FS_RAW_SUPER(struct f2fs_sb_info *sbi) |
543 | { | 601 | { |
544 | return (struct f2fs_super_block *)(sbi->raw_super); | 602 | return (struct f2fs_super_block *)(sbi->raw_super); |
@@ -703,8 +761,8 @@ static inline void dec_valid_block_count(struct f2fs_sb_info *sbi, | |||
703 | blkcnt_t count) | 761 | blkcnt_t count) |
704 | { | 762 | { |
705 | spin_lock(&sbi->stat_lock); | 763 | spin_lock(&sbi->stat_lock); |
706 | f2fs_bug_on(sbi->total_valid_block_count < (block_t) count); | 764 | f2fs_bug_on(sbi, sbi->total_valid_block_count < (block_t) count); |
707 | f2fs_bug_on(inode->i_blocks < count); | 765 | f2fs_bug_on(sbi, inode->i_blocks < count); |
708 | inode->i_blocks -= count; | 766 | inode->i_blocks -= count; |
709 | sbi->total_valid_block_count -= (block_t)count; | 767 | sbi->total_valid_block_count -= (block_t)count; |
710 | spin_unlock(&sbi->stat_lock); | 768 | spin_unlock(&sbi->stat_lock); |
@@ -716,10 +774,11 @@ static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) | |||
716 | F2FS_SET_SB_DIRT(sbi); | 774 | F2FS_SET_SB_DIRT(sbi); |
717 | } | 775 | } |
718 | 776 | ||
719 | static inline void inode_inc_dirty_dents(struct inode *inode) | 777 | static inline void inode_inc_dirty_pages(struct inode *inode) |
720 | { | 778 | { |
721 | inc_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS); | 779 | atomic_inc(&F2FS_I(inode)->dirty_pages); |
722 | atomic_inc(&F2FS_I(inode)->dirty_dents); | 780 | if (S_ISDIR(inode->i_mode)) |
781 | inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); | ||
723 | } | 782 | } |
724 | 783 | ||
725 | static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) | 784 | static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) |
@@ -727,13 +786,15 @@ static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) | |||
727 | atomic_dec(&sbi->nr_pages[count_type]); | 786 | atomic_dec(&sbi->nr_pages[count_type]); |
728 | } | 787 | } |
729 | 788 | ||
730 | static inline void inode_dec_dirty_dents(struct inode *inode) | 789 | static inline void inode_dec_dirty_pages(struct inode *inode) |
731 | { | 790 | { |
732 | if (!S_ISDIR(inode->i_mode)) | 791 | if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode)) |
733 | return; | 792 | return; |
734 | 793 | ||
735 | dec_page_count(F2FS_SB(inode->i_sb), F2FS_DIRTY_DENTS); | 794 | atomic_dec(&F2FS_I(inode)->dirty_pages); |
736 | atomic_dec(&F2FS_I(inode)->dirty_dents); | 795 | |
796 | if (S_ISDIR(inode->i_mode)) | ||
797 | dec_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); | ||
737 | } | 798 | } |
738 | 799 | ||
739 | static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) | 800 | static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) |
@@ -741,9 +802,9 @@ static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) | |||
741 | return atomic_read(&sbi->nr_pages[count_type]); | 802 | return atomic_read(&sbi->nr_pages[count_type]); |
742 | } | 803 | } |
743 | 804 | ||
744 | static inline int get_dirty_dents(struct inode *inode) | 805 | static inline int get_dirty_pages(struct inode *inode) |
745 | { | 806 | { |
746 | return atomic_read(&F2FS_I(inode)->dirty_dents); | 807 | return atomic_read(&F2FS_I(inode)->dirty_pages); |
747 | } | 808 | } |
748 | 809 | ||
749 | static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) | 810 | static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) |
@@ -848,9 +909,9 @@ static inline void dec_valid_node_count(struct f2fs_sb_info *sbi, | |||
848 | { | 909 | { |
849 | spin_lock(&sbi->stat_lock); | 910 | spin_lock(&sbi->stat_lock); |
850 | 911 | ||
851 | f2fs_bug_on(!sbi->total_valid_block_count); | 912 | f2fs_bug_on(sbi, !sbi->total_valid_block_count); |
852 | f2fs_bug_on(!sbi->total_valid_node_count); | 913 | f2fs_bug_on(sbi, !sbi->total_valid_node_count); |
853 | f2fs_bug_on(!inode->i_blocks); | 914 | f2fs_bug_on(sbi, !inode->i_blocks); |
854 | 915 | ||
855 | inode->i_blocks--; | 916 | inode->i_blocks--; |
856 | sbi->total_valid_node_count--; | 917 | sbi->total_valid_node_count--; |
@@ -867,7 +928,7 @@ static inline unsigned int valid_node_count(struct f2fs_sb_info *sbi) | |||
867 | static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) | 928 | static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) |
868 | { | 929 | { |
869 | spin_lock(&sbi->stat_lock); | 930 | spin_lock(&sbi->stat_lock); |
870 | f2fs_bug_on(sbi->total_valid_inode_count == sbi->total_node_count); | 931 | f2fs_bug_on(sbi, sbi->total_valid_inode_count == sbi->total_node_count); |
871 | sbi->total_valid_inode_count++; | 932 | sbi->total_valid_inode_count++; |
872 | spin_unlock(&sbi->stat_lock); | 933 | spin_unlock(&sbi->stat_lock); |
873 | } | 934 | } |
@@ -875,7 +936,7 @@ static inline void inc_valid_inode_count(struct f2fs_sb_info *sbi) | |||
875 | static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi) | 936 | static inline void dec_valid_inode_count(struct f2fs_sb_info *sbi) |
876 | { | 937 | { |
877 | spin_lock(&sbi->stat_lock); | 938 | spin_lock(&sbi->stat_lock); |
878 | f2fs_bug_on(!sbi->total_valid_inode_count); | 939 | f2fs_bug_on(sbi, !sbi->total_valid_inode_count); |
879 | sbi->total_valid_inode_count--; | 940 | sbi->total_valid_inode_count--; |
880 | spin_unlock(&sbi->stat_lock); | 941 | spin_unlock(&sbi->stat_lock); |
881 | } | 942 | } |
@@ -891,7 +952,7 @@ static inline void f2fs_put_page(struct page *page, int unlock) | |||
891 | return; | 952 | return; |
892 | 953 | ||
893 | if (unlock) { | 954 | if (unlock) { |
894 | f2fs_bug_on(!PageLocked(page)); | 955 | f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page)); |
895 | unlock_page(page); | 956 | unlock_page(page); |
896 | } | 957 | } |
897 | page_cache_release(page); | 958 | page_cache_release(page); |
@@ -998,7 +1059,9 @@ enum { | |||
998 | FI_INLINE_DATA, /* used for inline data*/ | 1059 | FI_INLINE_DATA, /* used for inline data*/ |
999 | FI_APPEND_WRITE, /* inode has appended data */ | 1060 | FI_APPEND_WRITE, /* inode has appended data */ |
1000 | FI_UPDATE_WRITE, /* inode has in-place-update data */ | 1061 | FI_UPDATE_WRITE, /* inode has in-place-update data */ |
1001 | FI_NEED_IPU, /* used fo ipu for fdatasync */ | 1062 | FI_NEED_IPU, /* used for ipu per file */ |
1063 | FI_ATOMIC_FILE, /* indicate atomic file */ | ||
1064 | FI_VOLATILE_FILE, /* indicate volatile file */ | ||
1002 | }; | 1065 | }; |
1003 | 1066 | ||
1004 | static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) | 1067 | static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) |
@@ -1085,6 +1148,16 @@ static inline int f2fs_has_inline_data(struct inode *inode) | |||
1085 | return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA); | 1148 | return is_inode_flag_set(F2FS_I(inode), FI_INLINE_DATA); |
1086 | } | 1149 | } |
1087 | 1150 | ||
1151 | static inline bool f2fs_is_atomic_file(struct inode *inode) | ||
1152 | { | ||
1153 | return is_inode_flag_set(F2FS_I(inode), FI_ATOMIC_FILE); | ||
1154 | } | ||
1155 | |||
1156 | static inline bool f2fs_is_volatile_file(struct inode *inode) | ||
1157 | { | ||
1158 | return is_inode_flag_set(F2FS_I(inode), FI_VOLATILE_FILE); | ||
1159 | } | ||
1160 | |||
1088 | static inline void *inline_data_addr(struct page *page) | 1161 | static inline void *inline_data_addr(struct page *page) |
1089 | { | 1162 | { |
1090 | struct f2fs_inode *ri = F2FS_INODE(page); | 1163 | struct f2fs_inode *ri = F2FS_INODE(page); |
@@ -1141,6 +1214,7 @@ void update_inode(struct inode *, struct page *); | |||
1141 | void update_inode_page(struct inode *); | 1214 | void update_inode_page(struct inode *); |
1142 | int f2fs_write_inode(struct inode *, struct writeback_control *); | 1215 | int f2fs_write_inode(struct inode *, struct writeback_control *); |
1143 | void f2fs_evict_inode(struct inode *); | 1216 | void f2fs_evict_inode(struct inode *); |
1217 | void handle_failed_inode(struct inode *); | ||
1144 | 1218 | ||
1145 | /* | 1219 | /* |
1146 | * namei.c | 1220 | * namei.c |
@@ -1188,9 +1262,9 @@ struct dnode_of_data; | |||
1188 | struct node_info; | 1262 | struct node_info; |
1189 | 1263 | ||
1190 | bool available_free_memory(struct f2fs_sb_info *, int); | 1264 | bool available_free_memory(struct f2fs_sb_info *, int); |
1191 | int is_checkpointed_node(struct f2fs_sb_info *, nid_t); | 1265 | bool is_checkpointed_node(struct f2fs_sb_info *, nid_t); |
1192 | bool fsync_mark_done(struct f2fs_sb_info *, nid_t); | 1266 | bool has_fsynced_inode(struct f2fs_sb_info *, nid_t); |
1193 | void fsync_mark_clear(struct f2fs_sb_info *, nid_t); | 1267 | bool need_inode_block_update(struct f2fs_sb_info *, nid_t); |
1194 | void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *); | 1268 | void get_node_info(struct f2fs_sb_info *, nid_t, struct node_info *); |
1195 | int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int); | 1269 | int get_dnode_of_data(struct dnode_of_data *, pgoff_t, int); |
1196 | int truncate_inode_blocks(struct inode *, pgoff_t); | 1270 | int truncate_inode_blocks(struct inode *, pgoff_t); |
@@ -1221,6 +1295,8 @@ void destroy_node_manager_caches(void); | |||
1221 | /* | 1295 | /* |
1222 | * segment.c | 1296 | * segment.c |
1223 | */ | 1297 | */ |
1298 | void register_inmem_page(struct inode *, struct page *); | ||
1299 | void commit_inmem_pages(struct inode *, bool); | ||
1224 | void f2fs_balance_fs(struct f2fs_sb_info *); | 1300 | void f2fs_balance_fs(struct f2fs_sb_info *); |
1225 | void f2fs_balance_fs_bg(struct f2fs_sb_info *); | 1301 | void f2fs_balance_fs_bg(struct f2fs_sb_info *); |
1226 | int f2fs_issue_flush(struct f2fs_sb_info *); | 1302 | int f2fs_issue_flush(struct f2fs_sb_info *); |
@@ -1229,9 +1305,11 @@ void destroy_flush_cmd_control(struct f2fs_sb_info *); | |||
1229 | void invalidate_blocks(struct f2fs_sb_info *, block_t); | 1305 | void invalidate_blocks(struct f2fs_sb_info *, block_t); |
1230 | void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); | 1306 | void refresh_sit_entry(struct f2fs_sb_info *, block_t, block_t); |
1231 | void clear_prefree_segments(struct f2fs_sb_info *); | 1307 | void clear_prefree_segments(struct f2fs_sb_info *); |
1308 | void release_discard_addrs(struct f2fs_sb_info *); | ||
1232 | void discard_next_dnode(struct f2fs_sb_info *, block_t); | 1309 | void discard_next_dnode(struct f2fs_sb_info *, block_t); |
1233 | int npages_for_summary_flush(struct f2fs_sb_info *); | 1310 | int npages_for_summary_flush(struct f2fs_sb_info *); |
1234 | void allocate_new_segments(struct f2fs_sb_info *); | 1311 | void allocate_new_segments(struct f2fs_sb_info *); |
1312 | int f2fs_trim_fs(struct f2fs_sb_info *, struct fstrim_range *); | ||
1235 | struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); | 1313 | struct page *get_sum_page(struct f2fs_sb_info *, unsigned int); |
1236 | void write_meta_page(struct f2fs_sb_info *, struct page *); | 1314 | void write_meta_page(struct f2fs_sb_info *, struct page *); |
1237 | void write_node_page(struct f2fs_sb_info *, struct page *, | 1315 | void write_node_page(struct f2fs_sb_info *, struct page *, |
@@ -1248,7 +1326,7 @@ void write_data_summaries(struct f2fs_sb_info *, block_t); | |||
1248 | void write_node_summaries(struct f2fs_sb_info *, block_t); | 1326 | void write_node_summaries(struct f2fs_sb_info *, block_t); |
1249 | int lookup_journal_in_cursum(struct f2fs_summary_block *, | 1327 | int lookup_journal_in_cursum(struct f2fs_summary_block *, |
1250 | int, unsigned int, int); | 1328 | int, unsigned int, int); |
1251 | void flush_sit_entries(struct f2fs_sb_info *); | 1329 | void flush_sit_entries(struct f2fs_sb_info *, struct cp_control *); |
1252 | int build_segment_manager(struct f2fs_sb_info *); | 1330 | int build_segment_manager(struct f2fs_sb_info *); |
1253 | void destroy_segment_manager(struct f2fs_sb_info *); | 1331 | void destroy_segment_manager(struct f2fs_sb_info *); |
1254 | int __init create_segment_manager_caches(void); | 1332 | int __init create_segment_manager_caches(void); |
@@ -1259,7 +1337,8 @@ void destroy_segment_manager_caches(void); | |||
1259 | */ | 1337 | */ |
1260 | struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t); | 1338 | struct page *grab_meta_page(struct f2fs_sb_info *, pgoff_t); |
1261 | struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t); | 1339 | struct page *get_meta_page(struct f2fs_sb_info *, pgoff_t); |
1262 | int ra_meta_pages(struct f2fs_sb_info *, int, int, int); | 1340 | struct page *get_meta_page_ra(struct f2fs_sb_info *, pgoff_t); |
1341 | int ra_meta_pages(struct f2fs_sb_info *, block_t, int, int); | ||
1263 | long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); | 1342 | long sync_meta_pages(struct f2fs_sb_info *, enum page_type, long); |
1264 | void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); | 1343 | void add_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
1265 | void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); | 1344 | void remove_dirty_inode(struct f2fs_sb_info *, nid_t, int type); |
@@ -1271,11 +1350,11 @@ void add_orphan_inode(struct f2fs_sb_info *, nid_t); | |||
1271 | void remove_orphan_inode(struct f2fs_sb_info *, nid_t); | 1350 | void remove_orphan_inode(struct f2fs_sb_info *, nid_t); |
1272 | void recover_orphan_inodes(struct f2fs_sb_info *); | 1351 | void recover_orphan_inodes(struct f2fs_sb_info *); |
1273 | int get_valid_checkpoint(struct f2fs_sb_info *); | 1352 | int get_valid_checkpoint(struct f2fs_sb_info *); |
1274 | void set_dirty_dir_page(struct inode *, struct page *); | 1353 | void update_dirty_page(struct inode *, struct page *); |
1275 | void add_dirty_dir_inode(struct inode *); | 1354 | void add_dirty_dir_inode(struct inode *); |
1276 | void remove_dirty_dir_inode(struct inode *); | 1355 | void remove_dirty_dir_inode(struct inode *); |
1277 | void sync_dirty_dir_inodes(struct f2fs_sb_info *); | 1356 | void sync_dirty_dir_inodes(struct f2fs_sb_info *); |
1278 | void write_checkpoint(struct f2fs_sb_info *, bool); | 1357 | void write_checkpoint(struct f2fs_sb_info *, struct cp_control *); |
1279 | void init_ino_entry_info(struct f2fs_sb_info *); | 1358 | void init_ino_entry_info(struct f2fs_sb_info *); |
1280 | int __init create_checkpoint_caches(void); | 1359 | int __init create_checkpoint_caches(void); |
1281 | void destroy_checkpoint_caches(void); | 1360 | void destroy_checkpoint_caches(void); |
@@ -1359,12 +1438,12 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) | |||
1359 | #define stat_inc_inline_inode(inode) \ | 1438 | #define stat_inc_inline_inode(inode) \ |
1360 | do { \ | 1439 | do { \ |
1361 | if (f2fs_has_inline_data(inode)) \ | 1440 | if (f2fs_has_inline_data(inode)) \ |
1362 | ((F2FS_SB(inode->i_sb))->inline_inode++); \ | 1441 | ((F2FS_I_SB(inode))->inline_inode++); \ |
1363 | } while (0) | 1442 | } while (0) |
1364 | #define stat_dec_inline_inode(inode) \ | 1443 | #define stat_dec_inline_inode(inode) \ |
1365 | do { \ | 1444 | do { \ |
1366 | if (f2fs_has_inline_data(inode)) \ | 1445 | if (f2fs_has_inline_data(inode)) \ |
1367 | ((F2FS_SB(inode->i_sb))->inline_inode--); \ | 1446 | ((F2FS_I_SB(inode))->inline_inode--); \ |
1368 | } while (0) | 1447 | } while (0) |
1369 | 1448 | ||
1370 | #define stat_inc_seg_type(sbi, curseg) \ | 1449 | #define stat_inc_seg_type(sbi, curseg) \ |