@@ -72,15 +72,23 @@ static void update_general_status(struct f2fs_sb_info *sbi)
7272 si -> main_area_zones = si -> main_area_sections /
7373 le32_to_cpu (raw_super -> secs_per_zone );
7474
75- /* validation check of the segment numbers */
75+ /* general extent cache stats */
76+ for (i = 0 ; i < NR_EXTENT_CACHES ; i ++ ) {
77+ struct extent_tree_info * eti = & sbi -> extent_tree [i ];
78+
79+ si -> hit_cached [i ] = atomic64_read (& sbi -> read_hit_cached [i ]);
80+ si -> hit_rbtree [i ] = atomic64_read (& sbi -> read_hit_rbtree [i ]);
81+ si -> total_ext [i ] = atomic64_read (& sbi -> total_hit_ext [i ]);
82+ si -> hit_total [i ] = si -> hit_cached [i ] + si -> hit_rbtree [i ];
83+ si -> ext_tree [i ] = atomic_read (& eti -> total_ext_tree );
84+ si -> zombie_tree [i ] = atomic_read (& eti -> total_zombie_tree );
85+ si -> ext_node [i ] = atomic_read (& eti -> total_ext_node );
86+ }
87+ /* read extent_cache only */
7688 si -> hit_largest = atomic64_read (& sbi -> read_hit_largest );
77- si -> hit_cached = atomic64_read (& sbi -> read_hit_cached );
78- si -> hit_rbtree = atomic64_read (& sbi -> read_hit_rbtree );
79- si -> hit_total = si -> hit_largest + si -> hit_cached + si -> hit_rbtree ;
80- si -> total_ext = atomic64_read (& sbi -> total_hit_ext );
81- si -> ext_tree = atomic_read (& sbi -> total_ext_tree );
82- si -> zombie_tree = atomic_read (& sbi -> total_zombie_tree );
83- si -> ext_node = atomic_read (& sbi -> total_ext_node );
89+ si -> hit_total [EX_READ ] += si -> hit_largest ;
90+
91+ /* validation check of the segment numbers */
8492 si -> ndirty_node = get_pages (sbi , F2FS_DIRTY_NODES );
8593 si -> ndirty_dent = get_pages (sbi , F2FS_DIRTY_DENTS );
8694 si -> ndirty_meta = get_pages (sbi , F2FS_DIRTY_META );
@@ -294,10 +302,16 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
294302 sizeof (struct nat_entry_set );
295303 for (i = 0 ; i < MAX_INO_ENTRY ; i ++ )
296304 si -> cache_mem += sbi -> im [i ].ino_num * sizeof (struct ino_entry );
297- si -> cache_mem += atomic_read (& sbi -> total_ext_tree ) *
305+
306+ for (i = 0 ; i < NR_EXTENT_CACHES ; i ++ ) {
307+ struct extent_tree_info * eti = & sbi -> extent_tree [i ];
308+
309+ si -> ext_mem [i ] = atomic_read (& eti -> total_ext_tree ) *
298310 sizeof (struct extent_tree );
299- si -> cache_mem += atomic_read (& sbi -> total_ext_node ) *
311+ si -> ext_mem [ i ] += atomic_read (& eti -> total_ext_node ) *
300312 sizeof (struct extent_node );
313+ si -> cache_mem += si -> ext_mem [i ];
314+ }
301315
302316 si -> page_mem = 0 ;
303317 if (sbi -> node_inode ) {
@@ -490,16 +504,18 @@ static int stat_show(struct seq_file *s, void *v)
490504 si -> bg_node_blks );
491505 seq_printf (s , "BG skip : IO: %u, Other: %u\n" ,
492506 si -> io_skip_bggc , si -> other_skip_bggc );
493- seq_puts (s , "\nExtent Cache:\n" );
507+ seq_puts (s , "\nExtent Cache (Read) :\n" );
494508 seq_printf (s , " - Hit Count: L1-1:%llu L1-2:%llu L2:%llu\n" ,
495- si -> hit_largest , si -> hit_cached ,
496- si -> hit_rbtree );
509+ si -> hit_largest , si -> hit_cached [ EX_READ ] ,
510+ si -> hit_rbtree [ EX_READ ] );
497511 seq_printf (s , " - Hit Ratio: %llu%% (%llu / %llu)\n" ,
498- !si -> total_ext ? 0 :
499- div64_u64 (si -> hit_total * 100 , si -> total_ext ),
500- si -> hit_total , si -> total_ext );
512+ !si -> total_ext [EX_READ ] ? 0 :
513+ div64_u64 (si -> hit_total [EX_READ ] * 100 ,
514+ si -> total_ext [EX_READ ]),
515+ si -> hit_total [EX_READ ], si -> total_ext [EX_READ ]);
501516 seq_printf (s , " - Inner Struct Count: tree: %d(%d), node: %d\n" ,
502- si -> ext_tree , si -> zombie_tree , si -> ext_node );
517+ si -> ext_tree [EX_READ ], si -> zombie_tree [EX_READ ],
518+ si -> ext_node [EX_READ ]);
503519 seq_puts (s , "\nBalancing F2FS Async:\n" );
504520 seq_printf (s , " - DIO (R: %4d, W: %4d)\n" ,
505521 si -> nr_dio_read , si -> nr_dio_write );
@@ -566,8 +582,10 @@ static int stat_show(struct seq_file *s, void *v)
566582 (si -> base_mem + si -> cache_mem + si -> page_mem ) >> 10 );
567583 seq_printf (s , " - static: %llu KB\n" ,
568584 si -> base_mem >> 10 );
569- seq_printf (s , " - cached: %llu KB\n" ,
585+ seq_printf (s , " - cached all : %llu KB\n" ,
570586 si -> cache_mem >> 10 );
587+ seq_printf (s , " - read extent cache: %llu KB\n" ,
588+ si -> ext_mem [EX_READ ] >> 10 );
571589 seq_printf (s , " - paged : %llu KB\n" ,
572590 si -> page_mem >> 10 );
573591 }
@@ -600,10 +618,15 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
600618 si -> sbi = sbi ;
601619 sbi -> stat_info = si ;
602620
603- atomic64_set (& sbi -> total_hit_ext , 0 );
604- atomic64_set (& sbi -> read_hit_rbtree , 0 );
621+ /* general extent cache stats */
622+ for (i = 0 ; i < NR_EXTENT_CACHES ; i ++ ) {
623+ atomic64_set (& sbi -> total_hit_ext [i ], 0 );
624+ atomic64_set (& sbi -> read_hit_rbtree [i ], 0 );
625+ atomic64_set (& sbi -> read_hit_cached [i ], 0 );
626+ }
627+
628+ /* read extent_cache only */
605629 atomic64_set (& sbi -> read_hit_largest , 0 );
606- atomic64_set (& sbi -> read_hit_cached , 0 );
607630
608631 atomic_set (& sbi -> inline_xattr , 0 );
609632 atomic_set (& sbi -> inline_inode , 0 );
0 commit comments