f2fs.h (f573018491fd823e909d587cfe16758f3dd9e6d6) | f2fs.h (523be8a6b3418eb7e0f0f042fe0490345eb5d516) |
---|---|
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 --- 799 unchanged lines hidden (view full) --- 808 809 block_t user_block_count; /* # of user blocks */ 810 block_t total_valid_block_count; /* # of valid blocks */ 811 block_t alloc_valid_block_count; /* # of allocated blocks */ 812 block_t discard_blks; /* discard command candidats */ 813 block_t last_valid_block_count; /* for recovery */ 814 u32 s_next_generation; /* for NFS support */ 815 atomic_t nr_wb_bios; /* # of writeback bios */ | 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 --- 799 unchanged lines hidden (view full) --- 808 809 block_t user_block_count; /* # of user blocks */ 810 block_t total_valid_block_count; /* # of valid blocks */ 811 block_t alloc_valid_block_count; /* # of allocated blocks */ 812 block_t discard_blks; /* discard command candidats */ 813 block_t last_valid_block_count; /* for recovery */ 814 u32 s_next_generation; /* for NFS support */ 815 atomic_t nr_wb_bios; /* # of writeback bios */ |
816 atomic_t nr_pages[NR_COUNT_TYPE]; /* # of pages, see count_type */ | |
817 | 816 |
817 /* # of pages, see count_type */ 818 struct percpu_counter nr_pages[NR_COUNT_TYPE]; 819 |
|
818 struct f2fs_mount_info mount_opt; /* mount options */ 819 820 /* for cleaning operations */ 821 struct mutex gc_mutex; /* mutex for GC */ 822 struct f2fs_gc_kthread *gc_thread; /* GC thread */ 823 unsigned int cur_victim_sec; /* current victim section num */ 824 825 /* maximum # of trials to find a victim segment for SSR and GC */ --- 327 unchanged lines hidden (view full) --- 1153 f2fs_bug_on(sbi, inode->i_blocks < count); 1154 inode->i_blocks -= count; 1155 sbi->total_valid_block_count -= (block_t)count; 1156 spin_unlock(&sbi->stat_lock); 1157} 1158 1159static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) 1160{ | 820 struct f2fs_mount_info mount_opt; /* mount options */ 821 822 /* for cleaning operations */ 823 struct mutex gc_mutex; /* mutex for GC */ 824 struct f2fs_gc_kthread *gc_thread; /* GC thread */ 825 unsigned int cur_victim_sec; /* current victim section num */ 826 827 /* maximum # of trials to find a victim segment for SSR and GC */ --- 327 unchanged lines hidden (view full) --- 1155 f2fs_bug_on(sbi, inode->i_blocks < count); 1156 inode->i_blocks -= count; 1157 sbi->total_valid_block_count -= (block_t)count; 1158 spin_unlock(&sbi->stat_lock); 1159} 1160 1161static inline void inc_page_count(struct f2fs_sb_info *sbi, int count_type) 1162{ |
1161 atomic_inc(&sbi->nr_pages[count_type]); | 1163 percpu_counter_inc(&sbi->nr_pages[count_type]); |
1162 set_sbi_flag(sbi, SBI_IS_DIRTY); 1163} 1164 1165static inline void inode_inc_dirty_pages(struct inode *inode) 1166{ 1167 atomic_inc(&F2FS_I(inode)->dirty_pages); 1168 inc_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1169 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); 1170} 1171 1172static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) 1173{ | 1164 set_sbi_flag(sbi, SBI_IS_DIRTY); 1165} 1166 1167static inline void inode_inc_dirty_pages(struct inode *inode) 1168{ 1169 atomic_inc(&F2FS_I(inode)->dirty_pages); 1170 inc_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1171 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); 1172} 1173 1174static inline void dec_page_count(struct f2fs_sb_info *sbi, int count_type) 1175{ |
1174 atomic_dec(&sbi->nr_pages[count_type]); | 1176 percpu_counter_dec(&sbi->nr_pages[count_type]); |
1175} 1176 1177static inline void inode_dec_dirty_pages(struct inode *inode) 1178{ 1179 if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && 1180 !S_ISLNK(inode->i_mode)) 1181 return; 1182 1183 atomic_dec(&F2FS_I(inode)->dirty_pages); 1184 dec_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1185 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); 1186} 1187 | 1177} 1178 1179static inline void inode_dec_dirty_pages(struct inode *inode) 1180{ 1181 if (!S_ISDIR(inode->i_mode) && !S_ISREG(inode->i_mode) && 1182 !S_ISLNK(inode->i_mode)) 1183 return; 1184 1185 atomic_dec(&F2FS_I(inode)->dirty_pages); 1186 dec_page_count(F2FS_I_SB(inode), S_ISDIR(inode->i_mode) ? 1187 F2FS_DIRTY_DENTS : F2FS_DIRTY_DATA); 1188} 1189 |
1188static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) | 1190static inline s64 get_pages(struct f2fs_sb_info *sbi, int count_type) |
1189{ | 1191{ |
1190 return atomic_read(&sbi->nr_pages[count_type]); | 1192 return percpu_counter_sum_positive(&sbi->nr_pages[count_type]); |
1191} 1192 1193static inline int get_dirty_pages(struct inode *inode) 1194{ 1195 return atomic_read(&F2FS_I(inode)->dirty_pages); 1196} 1197 1198static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) 1199{ 1200 unsigned int pages_per_sec = sbi->segs_per_sec * sbi->blocks_per_seg; | 1193} 1194 1195static inline int get_dirty_pages(struct inode *inode) 1196{ 1197 return atomic_read(&F2FS_I(inode)->dirty_pages); 1198} 1199 1200static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) 1201{ 1202 unsigned int pages_per_sec = sbi->segs_per_sec * sbi->blocks_per_seg; |
1201 return ((get_pages(sbi, block_type) + pages_per_sec - 1) 1202 >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; | 1203 unsigned int segs = (get_pages(sbi, block_type) + pages_per_sec - 1) >> 1204 sbi->log_blocks_per_seg; 1205 1206 return segs / sbi->segs_per_sec; |
1203} 1204 1205static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) 1206{ 1207 return sbi->total_valid_block_count; 1208} 1209 1210static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag) --- 797 unchanged lines hidden (view full) --- 2008struct f2fs_stat_info { 2009 struct list_head stat_list; 2010 struct f2fs_sb_info *sbi; 2011 int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; 2012 int main_area_segs, main_area_sections, main_area_zones; 2013 unsigned long long hit_largest, hit_cached, hit_rbtree; 2014 unsigned long long hit_total, total_ext; 2015 int ext_tree, zombie_tree, ext_node; | 1207} 1208 1209static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) 1210{ 1211 return sbi->total_valid_block_count; 1212} 1213 1214static inline unsigned long __bitmap_size(struct f2fs_sb_info *sbi, int flag) --- 797 unchanged lines hidden (view full) --- 2012struct f2fs_stat_info { 2013 struct list_head stat_list; 2014 struct f2fs_sb_info *sbi; 2015 int all_area_segs, sit_area_segs, nat_area_segs, ssa_area_segs; 2016 int main_area_segs, main_area_sections, main_area_zones; 2017 unsigned long long hit_largest, hit_cached, hit_rbtree; 2018 unsigned long long hit_total, total_ext; 2019 int ext_tree, zombie_tree, ext_node; |
2016 int ndirty_node, ndirty_meta; 2017 int ndirty_dent, ndirty_dirs, ndirty_data, ndirty_files; | 2020 s64 ndirty_node, ndirty_dent, ndirty_meta, ndirty_data, inmem_pages; 2021 unsigned int ndirty_dirs, ndirty_files; |
2018 int nats, dirty_nats, sits, dirty_sits, fnids; 2019 int total_count, utilization; | 2022 int nats, dirty_nats, sits, dirty_sits, fnids; 2023 int total_count, utilization; |
2020 int bg_gc, inmem_pages, wb_bios; | 2024 int bg_gc, wb_bios; |
2021 int inline_xattr, inline_inode, inline_dir, orphans; 2022 unsigned int valid_count, valid_node_count, valid_inode_count; 2023 unsigned int bimodal, avg_vblocks; 2024 int util_free, util_valid, util_invalid; 2025 int rsvd_segs, overp_segs; 2026 int dirty_count, node_pages, meta_pages; 2027 int prefree_count, call_count, cp_count, bg_cp_count; 2028 int tot_segs, node_segs, data_segs, free_segs, free_secs; --- 253 unchanged lines hidden --- | 2025 int inline_xattr, inline_inode, inline_dir, orphans; 2026 unsigned int valid_count, valid_node_count, valid_inode_count; 2027 unsigned int bimodal, avg_vblocks; 2028 int util_free, util_valid, util_invalid; 2029 int rsvd_segs, overp_segs; 2030 int dirty_count, node_pages, meta_pages; 2031 int prefree_count, call_count, cp_count, bg_cp_count; 2032 int tot_segs, node_segs, data_segs, free_segs, free_secs; --- 253 unchanged lines hidden --- |