diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2013-05-23 09:57:53 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-05-28 02:03:05 -0400 |
commit | 35b09d82c3cf3fc0b8b6d923e7fd82ff7926aafc (patch) | |
tree | e92d7f02e6bbd19c194cd6363f1c5b0545e20523 /fs/f2fs | |
parent | a9841c4dbbdd8a2fb919ea305ffa95ab5ec80af2 (diff) |
f2fs: push some variables to debug part
Some, counters are needed only for the statistical information
while debugging.
So, those can be controlled using CONFIG_F2FS_STAT_FS,
pushing the usage for few variables under this flag.
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/checkpoint.c | 4 | ||||
-rw-r--r-- | fs/f2fs/data.c | 6 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 6 | ||||
-rw-r--r-- | fs/f2fs/gc.c | 2 | ||||
-rw-r--r-- | fs/f2fs/segment.c | 5 |
5 files changed, 21 insertions, 2 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 3d1144908ac6..01ddc911ac9b 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c | |||
@@ -478,7 +478,9 @@ retry: | |||
478 | } | 478 | } |
479 | } | 479 | } |
480 | list_add_tail(&new->list, head); | 480 | list_add_tail(&new->list, head); |
481 | #ifdef CONFIG_F2FS_STAT_FS | ||
481 | sbi->n_dirty_dirs++; | 482 | sbi->n_dirty_dirs++; |
483 | #endif | ||
482 | 484 | ||
483 | BUG_ON(!S_ISDIR(inode->i_mode)); | 485 | BUG_ON(!S_ISDIR(inode->i_mode)); |
484 | out: | 486 | out: |
@@ -508,7 +510,9 @@ void remove_dirty_dir_inode(struct inode *inode) | |||
508 | if (entry->inode == inode) { | 510 | if (entry->inode == inode) { |
509 | list_del(&entry->list); | 511 | list_del(&entry->list); |
510 | kmem_cache_free(inode_entry_slab, entry); | 512 | kmem_cache_free(inode_entry_slab, entry); |
513 | #ifdef CONFIG_F2FS_STAT_FS | ||
511 | sbi->n_dirty_dirs--; | 514 | sbi->n_dirty_dirs--; |
515 | #endif | ||
512 | break; | 516 | break; |
513 | } | 517 | } |
514 | } | 518 | } |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 1644fffea251..93917e31dbdf 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -68,7 +68,9 @@ static int check_extent_cache(struct inode *inode, pgoff_t pgofs, | |||
68 | struct buffer_head *bh_result) | 68 | struct buffer_head *bh_result) |
69 | { | 69 | { |
70 | struct f2fs_inode_info *fi = F2FS_I(inode); | 70 | struct f2fs_inode_info *fi = F2FS_I(inode); |
71 | #ifdef CONFIG_F2FS_STAT_FS | ||
71 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 72 | struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
73 | #endif | ||
72 | pgoff_t start_fofs, end_fofs; | 74 | pgoff_t start_fofs, end_fofs; |
73 | block_t start_blkaddr; | 75 | block_t start_blkaddr; |
74 | 76 | ||
@@ -78,7 +80,9 @@ static int check_extent_cache(struct inode *inode, pgoff_t pgofs, | |||
78 | return 0; | 80 | return 0; |
79 | } | 81 | } |
80 | 82 | ||
83 | #ifdef CONFIG_F2FS_STAT_FS | ||
81 | sbi->total_hit_ext++; | 84 | sbi->total_hit_ext++; |
85 | #endif | ||
82 | start_fofs = fi->ext.fofs; | 86 | start_fofs = fi->ext.fofs; |
83 | end_fofs = fi->ext.fofs + fi->ext.len - 1; | 87 | end_fofs = fi->ext.fofs + fi->ext.len - 1; |
84 | start_blkaddr = fi->ext.blk_addr; | 88 | start_blkaddr = fi->ext.blk_addr; |
@@ -96,7 +100,9 @@ static int check_extent_cache(struct inode *inode, pgoff_t pgofs, | |||
96 | else | 100 | else |
97 | bh_result->b_size = UINT_MAX; | 101 | bh_result->b_size = UINT_MAX; |
98 | 102 | ||
103 | #ifdef CONFIG_F2FS_STAT_FS | ||
99 | sbi->read_hit_ext++; | 104 | sbi->read_hit_ext++; |
105 | #endif | ||
100 | read_unlock(&fi->ext.ext_lock); | 106 | read_unlock(&fi->ext.ext_lock); |
101 | return 1; | 107 | return 1; |
102 | } | 108 | } |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 92fd4e9285c0..40b137acb8a2 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -372,7 +372,6 @@ struct f2fs_sb_info { | |||
372 | /* for directory inode management */ | 372 | /* for directory inode management */ |
373 | struct list_head dir_inode_list; /* dir inode list */ | 373 | struct list_head dir_inode_list; /* dir inode list */ |
374 | spinlock_t dir_inode_lock; /* for dir inode list lock */ | 374 | spinlock_t dir_inode_lock; /* for dir inode list lock */ |
375 | unsigned int n_dirty_dirs; /* # of dir inodes */ | ||
376 | 375 | ||
377 | /* basic file system units */ | 376 | /* basic file system units */ |
378 | unsigned int log_sectors_per_block; /* log2 sectors per block */ | 377 | unsigned int log_sectors_per_block; /* log2 sectors per block */ |
@@ -409,12 +408,15 @@ struct f2fs_sb_info { | |||
409 | * for stat information. | 408 | * for stat information. |
410 | * one is for the LFS mode, and the other is for the SSR mode. | 409 | * one is for the LFS mode, and the other is for the SSR mode. |
411 | */ | 410 | */ |
411 | #ifdef CONFIG_F2FS_STAT_FS | ||
412 | struct f2fs_stat_info *stat_info; /* FS status information */ | 412 | struct f2fs_stat_info *stat_info; /* FS status information */ |
413 | unsigned int segment_count[2]; /* # of allocated segments */ | 413 | unsigned int segment_count[2]; /* # of allocated segments */ |
414 | unsigned int block_count[2]; /* # of allocated blocks */ | 414 | unsigned int block_count[2]; /* # of allocated blocks */ |
415 | unsigned int last_victim[2]; /* last victim segment # */ | ||
416 | int total_hit_ext, read_hit_ext; /* extent cache hit ratio */ | 415 | int total_hit_ext, read_hit_ext; /* extent cache hit ratio */ |
417 | int bg_gc; /* background gc calls */ | 416 | int bg_gc; /* background gc calls */ |
417 | unsigned int n_dirty_dirs; /* # of dir inodes */ | ||
418 | #endif | ||
419 | unsigned int last_victim[2]; /* last victim segment # */ | ||
418 | spinlock_t stat_lock; /* lock for stat operations */ | 420 | spinlock_t stat_lock; /* lock for stat operations */ |
419 | }; | 421 | }; |
420 | 422 | ||
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 14961593e93c..25b083c81d50 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c | |||
@@ -76,7 +76,9 @@ static int gc_thread_func(void *data) | |||
76 | else | 76 | else |
77 | wait_ms = increase_sleep_time(wait_ms); | 77 | wait_ms = increase_sleep_time(wait_ms); |
78 | 78 | ||
79 | #ifdef CONFIG_F2FS_STAT_FS | ||
79 | sbi->bg_gc++; | 80 | sbi->bg_gc++; |
81 | #endif | ||
80 | 82 | ||
81 | /* if return value is not zero, no victim was selected */ | 83 | /* if return value is not zero, no victim was selected */ |
82 | if (f2fs_gc(sbi)) | 84 | if (f2fs_gc(sbi)) |
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 3a0d027aad7e..be668ffb001c 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c | |||
@@ -610,7 +610,10 @@ static void allocate_segment_by_default(struct f2fs_sb_info *sbi, | |||
610 | else | 610 | else |
611 | new_curseg(sbi, type, false); | 611 | new_curseg(sbi, type, false); |
612 | out: | 612 | out: |
613 | #ifdef CONFIG_F2FS_STAT_FS | ||
613 | sbi->segment_count[curseg->alloc_type]++; | 614 | sbi->segment_count[curseg->alloc_type]++; |
615 | #endif | ||
616 | return; | ||
614 | } | 617 | } |
615 | 618 | ||
616 | void allocate_new_segments(struct f2fs_sb_info *sbi) | 619 | void allocate_new_segments(struct f2fs_sb_info *sbi) |
@@ -846,7 +849,9 @@ static void do_write_page(struct f2fs_sb_info *sbi, struct page *page, | |||
846 | 849 | ||
847 | mutex_lock(&sit_i->sentry_lock); | 850 | mutex_lock(&sit_i->sentry_lock); |
848 | __refresh_next_blkoff(sbi, curseg); | 851 | __refresh_next_blkoff(sbi, curseg); |
852 | #ifdef CONFIG_F2FS_STAT_FS | ||
849 | sbi->block_count[curseg->alloc_type]++; | 853 | sbi->block_count[curseg->alloc_type]++; |
854 | #endif | ||
850 | 855 | ||
851 | /* | 856 | /* |
852 | * SIT information should be updated before segment allocation, | 857 | * SIT information should be updated before segment allocation, |