aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/node.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/node.h')
-rw-r--r--fs/f2fs/node.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index d4d1f636fe1c..1f4f9d4569d9 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -25,6 +25,9 @@
25/* control the memory footprint threshold (10MB per 1GB ram) */ 25/* control the memory footprint threshold (10MB per 1GB ram) */
26#define DEF_RAM_THRESHOLD 10 26#define DEF_RAM_THRESHOLD 10
27 27
28/* control dirty nats ratio threshold (default: 10% over max nid count) */
29#define DEF_DIRTY_NAT_RATIO_THRESHOLD 10
30
28/* vector size for gang look-up from nat cache that consists of radix tree */ 31/* vector size for gang look-up from nat cache that consists of radix tree */
29#define NATVEC_SIZE 64 32#define NATVEC_SIZE 64
30#define SETVEC_SIZE 32 33#define SETVEC_SIZE 32
@@ -117,6 +120,12 @@ static inline void raw_nat_from_node_info(struct f2fs_nat_entry *raw_ne,
117 raw_ne->version = ni->version; 120 raw_ne->version = ni->version;
118} 121}
119 122
123static inline bool excess_dirty_nats(struct f2fs_sb_info *sbi)
124{
125 return NM_I(sbi)->dirty_nat_cnt >= NM_I(sbi)->max_nid *
126 NM_I(sbi)->dirty_nats_ratio / 100;
127}
128
120enum mem_type { 129enum mem_type {
121 FREE_NIDS, /* indicates the free nid list */ 130 FREE_NIDS, /* indicates the free nid list */
122 NAT_ENTRIES, /* indicates the cached nat entry */ 131 NAT_ENTRIES, /* indicates the cached nat entry */
@@ -321,7 +330,7 @@ static inline int set_nid(struct page *p, int off, nid_t nid, bool i)
321{ 330{
322 struct f2fs_node *rn = F2FS_NODE(p); 331 struct f2fs_node *rn = F2FS_NODE(p);
323 332
324 f2fs_wait_on_page_writeback(p, NODE); 333 f2fs_wait_on_page_writeback(p, NODE, true);
325 334
326 if (i) 335 if (i)
327 rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid); 336 rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid);
@@ -370,6 +379,21 @@ static inline int is_node(struct page *page, int type)
370#define is_fsync_dnode(page) is_node(page, FSYNC_BIT_SHIFT) 379#define is_fsync_dnode(page) is_node(page, FSYNC_BIT_SHIFT)
371#define is_dent_dnode(page) is_node(page, DENT_BIT_SHIFT) 380#define is_dent_dnode(page) is_node(page, DENT_BIT_SHIFT)
372 381
382static inline int is_inline_node(struct page *page)
383{
384 return PageChecked(page);
385}
386
387static inline void set_inline_node(struct page *page)
388{
389 SetPageChecked(page);
390}
391
392static inline void clear_inline_node(struct page *page)
393{
394 ClearPageChecked(page);
395}
396
373static inline void set_cold_node(struct inode *inode, struct page *page) 397static inline void set_cold_node(struct inode *inode, struct page *page)
374{ 398{
375 struct f2fs_node *rn = F2FS_NODE(page); 399 struct f2fs_node *rn = F2FS_NODE(page);