f2fs.h (e8240f656d4d5d718ce8cf6b4ea266d6719ef547) | f2fs.h (c227f912732f204c0ec4a577ba812401ac4672af) |
---|---|
1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 634 unchanged lines hidden (view full) --- 643 * COUNT_TYPE for monitoring 644 * 645 * f2fs monitors the number of several block types such as on-writeback, 646 * dirty dentry blocks, dirty node blocks, and dirty meta blocks. 647 */ 648enum count_type { 649 F2FS_WRITEBACK, 650 F2FS_DIRTY_DENTS, | 1/* 2 * fs/f2fs/f2fs.h 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 634 unchanged lines hidden (view full) --- 643 * COUNT_TYPE for monitoring 644 * 645 * f2fs monitors the number of several block types such as on-writeback, 646 * dirty dentry blocks, dirty node blocks, and dirty meta blocks. 647 */ 648enum count_type { 649 F2FS_WRITEBACK, 650 F2FS_DIRTY_DENTS, |
651 F2FS_DIRTY_DATA, |
|
651 F2FS_DIRTY_NODES, 652 F2FS_DIRTY_META, 653 F2FS_INMEM_PAGES, 654 NR_COUNT_TYPE, 655}; 656 657/* 658 * The below are the page types of bios used in submit_bio(). --- 32 unchanged lines hidden (view full) --- 691struct f2fs_bio_info { 692 struct f2fs_sb_info *sbi; /* f2fs superblock */ 693 struct bio *bio; /* bios to merge */ 694 sector_t last_block_in_bio; /* last block number */ 695 struct f2fs_io_info fio; /* store buffered io info. */ 696 struct rw_semaphore io_rwsem; /* blocking op for bio */ 697}; 698 | 652 F2FS_DIRTY_NODES, 653 F2FS_DIRTY_META, 654 F2FS_INMEM_PAGES, 655 NR_COUNT_TYPE, 656}; 657 658/* 659 * The below are the page types of bios used in submit_bio(). --- 32 unchanged lines hidden (view full) --- 692struct f2fs_bio_info { 693 struct f2fs_sb_info *sbi; /* f2fs superblock */ 694 struct bio *bio; /* bios to merge */ 695 sector_t last_block_in_bio; /* last block number */ 696 struct f2fs_io_info fio; /* store buffered io info. */ 697 struct rw_semaphore io_rwsem; /* blocking op for bio */ 698}; 699 |
700enum inode_type { 701 DIR_INODE, /* for dirty dir inode */ 702 FILE_INODE, /* for dirty regular/symlink inode */ 703 NR_INODE_TYPE, 704}; 705 |
|
699/* for inner inode cache management */ 700struct inode_management { 701 struct radix_tree_root ino_root; /* ino entry array */ 702 spinlock_t ino_lock; /* for ino entry lock */ 703 struct list_head ino_list; /* inode list head */ 704 unsigned long ino_num; /* number of entries */ 705}; 706 --- 33 unchanged lines hidden (view full) --- 740 wait_queue_head_t cp_wait; 741 long cp_expires, cp_interval; /* next expected periodic cp */ 742 743 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 744 745 /* for orphan inode, use 0'th array */ 746 unsigned int max_orphans; /* max orphan inodes */ 747 | 706/* for inner inode cache management */ 707struct inode_management { 708 struct radix_tree_root ino_root; /* ino entry array */ 709 spinlock_t ino_lock; /* for ino entry lock */ 710 struct list_head ino_list; /* inode list head */ 711 unsigned long ino_num; /* number of entries */ 712}; 713 --- 33 unchanged lines hidden (view full) --- 747 wait_queue_head_t cp_wait; 748 long cp_expires, cp_interval; /* next expected periodic cp */ 749 750 struct inode_management im[MAX_INO_ENTRY]; /* manage inode cache */ 751 752 /* for orphan inode, use 0'th array */ 753 unsigned int max_orphans; /* max orphan inodes */ 754 |
748 /* for directory inode management */ 749 struct list_head dir_inode_list; /* dir inode list */ 750 spinlock_t dir_inode_lock; /* for dir inode list lock */ | 755 /* for inode management */ 756 struct list_head inode_list[NR_INODE_TYPE]; /* dirty inode list */ 757 spinlock_t inode_lock[NR_INODE_TYPE]; /* for dirty inode list lock */ |
751 752 /* for extent tree cache */ 753 struct radix_tree_root extent_tree_root;/* cache extent cache entries */ 754 struct rw_semaphore extent_tree_lock; /* locking extent radix tree */ 755 struct list_head extent_list; /* lru list for shrinker */ 756 spinlock_t extent_lock; /* locking extent lru list */ 757 int total_ext_tree; /* extent tree count */ 758 atomic_t total_ext_node; /* extent info count */ --- 296 unchanged lines hidden (view full) --- 1055{ 1056 atomic_inc(&sbi->nr_pages[count_type]); 1057 set_sbi_flag(sbi, SBI_IS_DIRTY); 1058} 1059 1060static inline void inode_inc_dirty_pages(struct inode *inode) 1061{ 1062 atomic_inc(&F2FS_I(inode)->dirty_pages); | 758 759 /* for extent tree cache */ 760 struct radix_tree_root extent_tree_root;/* cache extent cache entries */ 761 struct rw_semaphore extent_tree_lock; /* locking extent radix tree */ 762 struct list_head extent_list; /* lru list for shrinker */ 763 spinlock_t extent_lock; /* locking extent lru list */ 764 int total_ext_tree; /* extent tree count */ 765 atomic_t total_ext_node; /* extent info count */ --- 296 unchanged lines hidden (view full) --- 1062{ 1063 atomic_inc(&sbi->nr_pages[count_type]); 1064 set_sbi_flag(sbi, SBI_IS_DIRTY); 1065} 1066 1067static inline void inode_inc_dirty_pages(struct inode *inode) 1068{ 1069 atomic_inc(&F2FS_I(inode)->dirty_pages); |
1063 if (S_ISDIR(inode->i_mode)) 1064 inc_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); | 1070 inc_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1071 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); |
1065} 1066 1067static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) 1068{ 1069 atomic_dec(&sbi->nr_pages[count_type]); 1070} 1071 1072static inline void inode_dec_dirty_pages(struct inode *inode) 1073{ 1074 if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && 1075 !S_ISLNK(inode->i_mode)) 1076 return; 1077 1078 atomic_dec(&F2FS_I(inode)->dirty_pages); | 1072} 1073 1074static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) 1075{ 1076 atomic_dec(&sbi->nr_pages[count_type]); 1077} 1078 1079static inline void inode_dec_dirty_pages(struct inode *inode) 1080{ 1081 if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && 1082 !S_ISLNK(inode->i_mode)) 1083 return; 1084 1085 atomic_dec(&F2FS_I(inode)->dirty_pages); |
1079 1080 if (S_ISDIR(inode->i_mode)) 1081 dec_page_count(F2FS_I_SB(inode), F2FS_DIRTY_DENTS); | 1086 dec_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1087 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); |
1082} 1083 1084static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) 1085{ 1086 return atomic_read(&sbi->nr_pages[count_type]); 1087} 1088 1089static inline int get_dirty_pages(struct inode *inode) --- 322 unchanged lines hidden (view full) --- 1412 FI_NEED_IPU, /* used for ipu per file */ 1413 FI_ATOMIC_FILE, /* indicate atomic file */ 1414 FI_VOLATILE_FILE, /* indicate volatile file */ 1415 FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ 1416 FI_DROP_CACHE, /* drop dirty page cache */ 1417 FI_DATA_EXIST, /* indicate data exists */ 1418 FI_INLINE_DOTS, /* indicate inline dot dentries */ 1419 FI_DO_DEFRAG, /* indicate defragment is running */ | 1088} 1089 1090static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) 1091{ 1092 return atomic_read(&sbi->nr_pages[count_type]); 1093} 1094 1095static inline int get_dirty_pages(struct inode *inode) --- 322 unchanged lines hidden (view full) --- 1418 FI_NEED_IPU, /* used for ipu per file */ 1419 FI_ATOMIC_FILE, /* indicate atomic file */ 1420 FI_VOLATILE_FILE, /* indicate volatile file */ 1421 FI_FIRST_BLOCK_WRITTEN, /* indicate #0 data block was written */ 1422 FI_DROP_CACHE, /* drop dirty page cache */ 1423 FI_DATA_EXIST, /* indicate data exists */ 1424 FI_INLINE_DOTS, /* indicate inline dot dentries */ 1425 FI_DO_DEFRAG, /* indicate defragment is running */ |
1426 FI_DIRTY_FILE, /* indicate regular/symlink has dirty pages */ |
|
1420}; 1421 1422static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) 1423{ 1424 if (!test_bit(flag, &fi->flags)) 1425 set_bit(flag, &fi->flags); 1426} 1427 --- 393 unchanged lines hidden (view full) --- 1821int acquire_orphan_inode(struct f2fs_sb_info *); 1822void release_orphan_inode(struct f2fs_sb_info *); 1823void add_orphan_inode(struct f2fs_sb_info *, nid_t); 1824void remove_orphan_inode(struct f2fs_sb_info *, nid_t); 1825int recover_orphan_inodes(struct f2fs_sb_info *); 1826int get_valid_checkpoint(struct f2fs_sb_info *); 1827void update_dirty_page(struct inode *, struct page *); 1828void add_dirty_dir_inode(struct inode *); | 1427}; 1428 1429static inline void set_inode_flag(struct f2fs_inode_info *fi, int flag) 1430{ 1431 if (!test_bit(flag, &fi->flags)) 1432 set_bit(flag, &fi->flags); 1433} 1434 --- 393 unchanged lines hidden (view full) --- 1828int acquire_orphan_inode(struct f2fs_sb_info *); 1829void release_orphan_inode(struct f2fs_sb_info *); 1830void add_orphan_inode(struct f2fs_sb_info *, nid_t); 1831void remove_orphan_inode(struct f2fs_sb_info *, nid_t); 1832int recover_orphan_inodes(struct f2fs_sb_info *); 1833int get_valid_checkpoint(struct f2fs_sb_info *); 1834void update_dirty_page(struct inode *, struct page *); 1835void add_dirty_dir_inode(struct inode *); |
1829void remove_dirty_dir_inode(struct inode *); 1830void sync_dirty_dir_inodes(struct f2fs_sb_info *); | 1836void remove_dirty_inode(struct inode *); 1837void sync_dirty_inodes(struct f2fs_sb_info *, enum inode_type); |
1831void write_checkpoint(struct f2fs_sb_info *, struct cp_control *); 1832void init_ino_entry_info(struct f2fs_sb_info *); 1833int __init create_checkpoint_caches(void); 1834void destroy_checkpoint_caches(void); 1835 1836/* 1837 * data.c 1838 */ --- 377 unchanged lines hidden --- | 1838void write_checkpoint(struct f2fs_sb_info *, struct cp_control *); 1839void init_ino_entry_info(struct f2fs_sb_info *); 1840int __init create_checkpoint_caches(void); 1841void destroy_checkpoint_caches(void); 1842 1843/* 1844 * data.c 1845 */ --- 377 unchanged lines hidden --- |