@@ -72,15 +72,23 @@ static void update_general_status(struct f2fs_sb_info *sbi)
72
72
si -> main_area_zones = si -> main_area_sections /
73
73
le32_to_cpu (raw_super -> secs_per_zone );
74
74
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 */
76
88
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 */
84
92
si -> ndirty_node = get_pages (sbi , F2FS_DIRTY_NODES );
85
93
si -> ndirty_dent = get_pages (sbi , F2FS_DIRTY_DENTS );
86
94
si -> ndirty_meta = get_pages (sbi , F2FS_DIRTY_META );
@@ -294,10 +302,16 @@ static void update_mem_info(struct f2fs_sb_info *sbi)
294
302
sizeof (struct nat_entry_set );
295
303
for (i = 0 ; i < MAX_INO_ENTRY ; i ++ )
296
304
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 ) *
298
310
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 ) *
300
312
sizeof (struct extent_node );
313
+ si -> cache_mem += si -> ext_mem [i ];
314
+ }
301
315
302
316
si -> page_mem = 0 ;
303
317
if (sbi -> node_inode ) {
@@ -490,16 +504,18 @@ static int stat_show(struct seq_file *s, void *v)
490
504
si -> bg_node_blks );
491
505
seq_printf (s , "BG skip : IO: %u, Other: %u\n" ,
492
506
si -> io_skip_bggc , si -> other_skip_bggc );
493
- seq_puts (s , "\nExtent Cache:\n" );
507
+ seq_puts (s , "\nExtent Cache (Read) :\n" );
494
508
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 ] );
497
511
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 ]);
501
516
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 ]);
503
519
seq_puts (s , "\nBalancing F2FS Async:\n" );
504
520
seq_printf (s , " - DIO (R: %4d, W: %4d)\n" ,
505
521
si -> nr_dio_read , si -> nr_dio_write );
@@ -566,8 +582,10 @@ static int stat_show(struct seq_file *s, void *v)
566
582
(si -> base_mem + si -> cache_mem + si -> page_mem ) >> 10 );
567
583
seq_printf (s , " - static: %llu KB\n" ,
568
584
si -> base_mem >> 10 );
569
- seq_printf (s , " - cached: %llu KB\n" ,
585
+ seq_printf (s , " - cached all : %llu KB\n" ,
570
586
si -> cache_mem >> 10 );
587
+ seq_printf (s , " - read extent cache: %llu KB\n" ,
588
+ si -> ext_mem [EX_READ ] >> 10 );
571
589
seq_printf (s , " - paged : %llu KB\n" ,
572
590
si -> page_mem >> 10 );
573
591
}
@@ -600,10 +618,15 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi)
600
618
si -> sbi = sbi ;
601
619
sbi -> stat_info = si ;
602
620
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 */
605
629
atomic64_set (& sbi -> read_hit_largest , 0 );
606
- atomic64_set (& sbi -> read_hit_cached , 0 );
607
630
608
631
atomic_set (& sbi -> inline_xattr , 0 );
609
632
atomic_set (& sbi -> inline_inode , 0 );
0 commit comments