debug.c (b10778a00d40b3d9fdaaf5891e802794781ff71c) | debug.c (67298804f34452a53a9ec9e609d95aa35084132b) |
---|---|
1/* 2 * f2fs debugging statistics 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * Copyright (c) 2012 Linux Foundation 7 * Copyright (c) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> 8 * --- 32 unchanged lines hidden (view full) --- 41 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META); 42 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg; 43 si->rsvd_segs = reserved_segments(sbi); 44 si->overp_segs = overprovision_segments(sbi); 45 si->valid_count = valid_user_blocks(sbi); 46 si->valid_node_count = valid_node_count(sbi); 47 si->valid_inode_count = valid_inode_count(sbi); 48 si->inline_inode = sbi->inline_inode; | 1/* 2 * f2fs debugging statistics 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * Copyright (c) 2012 Linux Foundation 7 * Copyright (c) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> 8 * --- 32 unchanged lines hidden (view full) --- 41 si->ndirty_meta = get_pages(sbi, F2FS_DIRTY_META); 42 si->total_count = (int)sbi->user_block_count / sbi->blocks_per_seg; 43 si->rsvd_segs = reserved_segments(sbi); 44 si->overp_segs = overprovision_segments(sbi); 45 si->valid_count = valid_user_blocks(sbi); 46 si->valid_node_count = valid_node_count(sbi); 47 si->valid_inode_count = valid_inode_count(sbi); 48 si->inline_inode = sbi->inline_inode; |
49 si->inline_dir = sbi->inline_dir; |
|
49 si->utilization = utilization(sbi); 50 51 si->free_segs = free_segments(sbi); 52 si->free_secs = free_sections(sbi); 53 si->prefree_count = prefree_segments(sbi); 54 si->dirty_count = dirty_segments(sbi); 55 si->node_pages = NODE_MAPPING(sbi)->nrpages; 56 si->meta_pages = META_MAPPING(sbi)->nrpages; --- 31 unchanged lines hidden (view full) --- 88 unsigned int blks_per_sec, hblks_per_sec, total_vblocks, bimodal, dist; 89 unsigned int segno, vblocks; 90 int ndirty = 0; 91 92 bimodal = 0; 93 total_vblocks = 0; 94 blks_per_sec = sbi->segs_per_sec * (1 << sbi->log_blocks_per_seg); 95 hblks_per_sec = blks_per_sec / 2; | 50 si->utilization = utilization(sbi); 51 52 si->free_segs = free_segments(sbi); 53 si->free_secs = free_sections(sbi); 54 si->prefree_count = prefree_segments(sbi); 55 si->dirty_count = dirty_segments(sbi); 56 si->node_pages = NODE_MAPPING(sbi)->nrpages; 57 si->meta_pages = META_MAPPING(sbi)->nrpages; --- 31 unchanged lines hidden (view full) --- 89 unsigned int blks_per_sec, hblks_per_sec, total_vblocks, bimodal, dist; 90 unsigned int segno, vblocks; 91 int ndirty = 0; 92 93 bimodal = 0; 94 total_vblocks = 0; 95 blks_per_sec = sbi->segs_per_sec * (1 << sbi->log_blocks_per_seg); 96 hblks_per_sec = blks_per_sec / 2; |
96 for (segno = 0; segno < TOTAL_SEGS(sbi); segno += sbi->segs_per_sec) { | 97 for (segno = 0; segno < MAIN_SEGS(sbi); segno += sbi->segs_per_sec) { |
97 vblocks = get_valid_blocks(sbi, segno, sbi->segs_per_sec); 98 dist = abs(vblocks - hblks_per_sec); 99 bimodal += dist * dist; 100 101 if (vblocks > 0 && vblocks < blks_per_sec) { 102 total_vblocks += vblocks; 103 ndirty++; 104 } 105 } | 98 vblocks = get_valid_blocks(sbi, segno, sbi->segs_per_sec); 99 dist = abs(vblocks - hblks_per_sec); 100 bimodal += dist * dist; 101 102 if (vblocks > 0 && vblocks < blks_per_sec) { 103 total_vblocks += vblocks; 104 ndirty++; 105 } 106 } |
106 dist = TOTAL_SECS(sbi) * hblks_per_sec * hblks_per_sec / 100; | 107 dist = MAIN_SECS(sbi) * hblks_per_sec * hblks_per_sec / 100; |
107 si->bimodal = bimodal / dist; 108 if (si->dirty_count) 109 si->avg_vblocks = total_vblocks / ndirty; 110 else 111 si->avg_vblocks = 0; 112} 113 114/* 115 * This function calculates memory footprint. 116 */ 117static void update_mem_info(struct f2fs_sb_info *sbi) 118{ 119 struct f2fs_stat_info *si = F2FS_STAT(sbi); 120 unsigned npages; | 108 si->bimodal = bimodal / dist; 109 if (si->dirty_count) 110 si->avg_vblocks = total_vblocks / ndirty; 111 else 112 si->avg_vblocks = 0; 113} 114 115/* 116 * This function calculates memory footprint. 117 */ 118static void update_mem_info(struct f2fs_sb_info *sbi) 119{ 120 struct f2fs_stat_info *si = F2FS_STAT(sbi); 121 unsigned npages; |
122 int i; |
|
121 122 if (si->base_mem) 123 goto get_cache; 124 125 si->base_mem = sizeof(struct f2fs_sb_info) + sbi->sb->s_blocksize; 126 si->base_mem += 2 * sizeof(struct f2fs_inode_info); 127 si->base_mem += sizeof(*sbi->ckpt); 128 129 /* build sm */ 130 si->base_mem += sizeof(struct f2fs_sm_info); 131 132 /* build sit */ 133 si->base_mem += sizeof(struct sit_info); | 123 124 if (si->base_mem) 125 goto get_cache; 126 127 si->base_mem = sizeof(struct f2fs_sb_info) + sbi->sb->s_blocksize; 128 si->base_mem += 2 * sizeof(struct f2fs_inode_info); 129 si->base_mem += sizeof(*sbi->ckpt); 130 131 /* build sm */ 132 si->base_mem += sizeof(struct f2fs_sm_info); 133 134 /* build sit */ 135 si->base_mem += sizeof(struct sit_info); |
134 si->base_mem += TOTAL_SEGS(sbi) * sizeof(struct seg_entry); 135 si->base_mem += f2fs_bitmap_size(TOTAL_SEGS(sbi)); 136 si->base_mem += 2 * SIT_VBLOCK_MAP_SIZE * TOTAL_SEGS(sbi); | 136 si->base_mem += MAIN_SEGS(sbi) * sizeof(struct seg_entry); 137 si->base_mem += f2fs_bitmap_size(MAIN_SEGS(sbi)); 138 si->base_mem += 2 * SIT_VBLOCK_MAP_SIZE * MAIN_SEGS(sbi); |
137 if (sbi->segs_per_sec > 1) | 139 if (sbi->segs_per_sec > 1) |
138 si->base_mem += TOTAL_SECS(sbi) * sizeof(struct sec_entry); | 140 si->base_mem += MAIN_SECS(sbi) * sizeof(struct sec_entry); |
139 si->base_mem += __bitmap_size(sbi, SIT_BITMAP); 140 141 /* build free segmap */ 142 si->base_mem += sizeof(struct free_segmap_info); | 141 si->base_mem += __bitmap_size(sbi, SIT_BITMAP); 142 143 /* build free segmap */ 144 si->base_mem += sizeof(struct free_segmap_info); |
143 si->base_mem += f2fs_bitmap_size(TOTAL_SEGS(sbi)); 144 si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); | 145 si->base_mem += f2fs_bitmap_size(MAIN_SEGS(sbi)); 146 si->base_mem += f2fs_bitmap_size(MAIN_SECS(sbi)); |
145 146 /* build curseg */ 147 si->base_mem += sizeof(struct curseg_info) * NR_CURSEG_TYPE; 148 si->base_mem += PAGE_CACHE_SIZE * NR_CURSEG_TYPE; 149 150 /* build dirty segmap */ 151 si->base_mem += sizeof(struct dirty_seglist_info); | 147 148 /* build curseg */ 149 si->base_mem += sizeof(struct curseg_info) * NR_CURSEG_TYPE; 150 si->base_mem += PAGE_CACHE_SIZE * NR_CURSEG_TYPE; 151 152 /* build dirty segmap */ 153 si->base_mem += sizeof(struct dirty_seglist_info); |
152 si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(TOTAL_SEGS(sbi)); 153 si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); | 154 si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(MAIN_SEGS(sbi)); 155 si->base_mem += f2fs_bitmap_size(MAIN_SECS(sbi)); |
154 155 /* build nm */ 156 si->base_mem += sizeof(struct f2fs_nm_info); 157 si->base_mem += __bitmap_size(sbi, NAT_BITMAP); 158 159 /* build gc */ 160 si->base_mem += sizeof(struct f2fs_gc_kthread); 161 162get_cache: 163 /* free nids */ 164 si->cache_mem = NM_I(sbi)->fcnt; 165 si->cache_mem += NM_I(sbi)->nat_cnt; 166 npages = NODE_MAPPING(sbi)->nrpages; 167 si->cache_mem += npages << PAGE_CACHE_SHIFT; 168 npages = META_MAPPING(sbi)->nrpages; 169 si->cache_mem += npages << PAGE_CACHE_SHIFT; | 156 157 /* build nm */ 158 si->base_mem += sizeof(struct f2fs_nm_info); 159 si->base_mem += __bitmap_size(sbi, NAT_BITMAP); 160 161 /* build gc */ 162 si->base_mem += sizeof(struct f2fs_gc_kthread); 163 164get_cache: 165 /* free nids */ 166 si->cache_mem = NM_I(sbi)->fcnt; 167 si->cache_mem += NM_I(sbi)->nat_cnt; 168 npages = NODE_MAPPING(sbi)->nrpages; 169 si->cache_mem += npages << PAGE_CACHE_SHIFT; 170 npages = META_MAPPING(sbi)->nrpages; 171 si->cache_mem += npages << PAGE_CACHE_SHIFT; |
170 si->cache_mem += sbi->n_orphans * sizeof(struct ino_entry); | |
171 si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry); | 172 si->cache_mem += sbi->n_dirty_dirs * sizeof(struct dir_inode_entry); |
173 for (i = 0; i <= UPDATE_INO; i++) 174 si->cache_mem += sbi->im[i].ino_num * sizeof(struct ino_entry); |
|
172} 173 174static int stat_show(struct seq_file *s, void *v) 175{ 176 struct f2fs_stat_info *si; 177 int i = 0; 178 int j; 179 --- 15 unchanged lines hidden (view full) --- 195 si->utilization, si->valid_count); 196 seq_printf(s, " - Node: %u (Inode: %u, ", 197 si->valid_node_count, si->valid_inode_count); 198 seq_printf(s, "Other: %u)\n - Data: %u\n", 199 si->valid_node_count - si->valid_inode_count, 200 si->valid_count - si->valid_node_count); 201 seq_printf(s, " - Inline_data Inode: %u\n", 202 si->inline_inode); | 175} 176 177static int stat_show(struct seq_file *s, void *v) 178{ 179 struct f2fs_stat_info *si; 180 int i = 0; 181 int j; 182 --- 15 unchanged lines hidden (view full) --- 198 si->utilization, si->valid_count); 199 seq_printf(s, " - Node: %u (Inode: %u, ", 200 si->valid_node_count, si->valid_inode_count); 201 seq_printf(s, "Other: %u)\n - Data: %u\n", 202 si->valid_node_count - si->valid_inode_count, 203 si->valid_count - si->valid_node_count); 204 seq_printf(s, " - Inline_data Inode: %u\n", 205 si->inline_inode); |
206 seq_printf(s, " - Inline_dentry Inode: %u\n", 207 si->inline_dir); |
|
203 seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n", 204 si->main_area_segs, si->main_area_sections, 205 si->main_area_zones); 206 seq_printf(s, " - COLD data: %d, %d, %d\n", 207 si->curseg[CURSEG_COLD_DATA], 208 si->cursec[CURSEG_COLD_DATA], 209 si->curzone[CURSEG_COLD_DATA]); 210 seq_printf(s, " - WARM data: %d, %d, %d\n", --- 155 unchanged lines hidden --- | 208 seq_printf(s, "\nMain area: %d segs, %d secs %d zones\n", 209 si->main_area_segs, si->main_area_sections, 210 si->main_area_zones); 211 seq_printf(s, " - COLD data: %d, %d, %d\n", 212 si->curseg[CURSEG_COLD_DATA], 213 si->cursec[CURSEG_COLD_DATA], 214 si->curzone[CURSEG_COLD_DATA]); 215 seq_printf(s, " - WARM data: %d, %d, %d\n", --- 155 unchanged lines hidden --- |