@@ -1383,6 +1383,13 @@ enum errors_option {
13831383 MOUNT_ERRORS_PANIC , /* panic on errors */
13841384};
13851385
1386+ enum {
1387+ BACKGROUND ,
1388+ FOREGROUND ,
1389+ MAX_CALL_TYPE ,
1390+ TOTAL_CALL = FOREGROUND ,
1391+ };
1392+
13861393static inline int f2fs_test_bit (unsigned int nr , char * addr );
13871394static inline void f2fs_set_bit (unsigned int nr , char * addr );
13881395static inline void f2fs_clear_bit (unsigned int nr , char * addr );
@@ -1695,6 +1702,7 @@ struct f2fs_sb_info {
16951702 unsigned int io_skip_bggc ; /* skip background gc for in-flight IO */
16961703 unsigned int other_skip_bggc ; /* skip background gc for other reasons */
16971704 unsigned int ndirty_inode [NR_INODE_TYPE ]; /* # of dirty inodes */
1705+ atomic_t cp_call_count [MAX_CALL_TYPE ]; /* # of cp call */
16981706#endif
16991707 spinlock_t stat_lock ; /* lock for stat operations */
17001708
@@ -3860,12 +3868,6 @@ void f2fs_destroy_recovery_cache(void);
38603868/*
38613869 * debug.c
38623870 */
3863- enum {
3864- BACKGROUND ,
3865- FOREGROUND ,
3866- MAX_CALL_TYPE
3867- };
3868-
38693871#ifdef CONFIG_F2FS_STAT_FS
38703872struct f2fs_stat_info {
38713873 struct list_head stat_list ;
@@ -3912,7 +3914,7 @@ struct f2fs_stat_info {
39123914 int dirty_count , node_pages , meta_pages , compress_pages ;
39133915 int compress_page_hit ;
39143916 int prefree_count , free_segs , free_secs ;
3915- int cp_count , bg_cp_count ;
3917+ int cp_call_count [ MAX_CALL_TYPE ], cp_count ;
39163918 int gc_call_count [MAX_CALL_TYPE ];
39173919 int gc_segs [2 ][2 ];
39183920 int gc_secs [2 ][2 ];
@@ -3937,8 +3939,9 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
39373939 return (struct f2fs_stat_info * )sbi -> stat_info ;
39383940}
39393941
3940- #define stat_inc_cp_count (si ) ((si)->cp_count++)
3941- #define stat_inc_bg_cp_count (si ) ((si)->bg_cp_count++)
3942+ #define stat_inc_cp_call_count (sbi , foreground ) \
3943+ atomic_inc(&sbi->cp_call_count[(foreground)])
3944+ #define stat_inc_cp_count (si ) (F2FS_STAT(sbi)->cp_count++)
39423945#define stat_io_skip_bggc_count (sbi ) ((sbi)->io_skip_bggc++)
39433946#define stat_other_skip_bggc_count (sbi ) ((sbi)->other_skip_bggc++)
39443947#define stat_inc_dirty_inode (sbi , type ) ((sbi)->ndirty_inode[type]++)
@@ -4055,8 +4058,8 @@ void __init f2fs_create_root_stats(void);
40554058void f2fs_destroy_root_stats (void );
40564059void f2fs_update_sit_info (struct f2fs_sb_info * sbi );
40574060#else
4058- #define stat_inc_cp_count ( si ) do { } while (0)
4059- #define stat_inc_bg_cp_count ( si ) do { } while (0)
4061+ #define stat_inc_cp_call_count ( sbi , foreground ) do { } while (0)
4062+ #define stat_inc_cp_count ( sbi ) do { } while (0)
40604063#define stat_io_skip_bggc_count (sbi ) do { } while (0)
40614064#define stat_other_skip_bggc_count (sbi ) do { } while (0)
40624065#define stat_inc_dirty_inode (sbi , type ) do { } while (0)
0 commit comments