Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 348974
b: refs/heads/master
c: 66af62c
h: refs/heads/master
v: v3
  • Loading branch information
majianpeng authored and Jaegeuk Kim committed Jan 15, 2013
1 parent 2b1c723 commit ef2d720
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa9150a84ca333f68127097c4fa1eda4b3913a22
refs/heads/master: 66af62ce7588736ae65edfdb1c0df597775c4d21
23 changes: 11 additions & 12 deletions trunk/fs/f2fs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

static LIST_HEAD(f2fs_stat_list);
static struct dentry *debugfs_root;
static DEFINE_MUTEX(f2fs_stat_mutex);

static void update_general_status(struct f2fs_sb_info *sbi)
{
Expand Down Expand Up @@ -180,13 +181,9 @@ static int stat_show(struct seq_file *s, void *v)
int i = 0;
int j;

mutex_lock(&f2fs_stat_mutex);
list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) {

mutex_lock(&si->stat_lock);
if (!si->sbi) {
mutex_unlock(&si->stat_lock);
continue;
}
update_general_status(si->sbi);

seq_printf(s, "\n=====[ partition info. #%d ]=====\n", i++);
Expand Down Expand Up @@ -286,8 +283,8 @@ static int stat_show(struct seq_file *s, void *v)
seq_printf(s, "\nMemory: %u KB = static: %u + cached: %u\n",
(si->base_mem + si->cache_mem) >> 10,
si->base_mem >> 10, si->cache_mem >> 10);
mutex_unlock(&si->stat_lock);
}
mutex_unlock(&f2fs_stat_mutex);
return 0;
}

Expand All @@ -313,9 +310,6 @@ static int init_stats(struct f2fs_sb_info *sbi)
return -ENOMEM;

si = sbi->stat_info;
mutex_init(&si->stat_lock);
list_add_tail(&si->stat_list, &f2fs_stat_list);

si->all_area_segs = le32_to_cpu(raw_super->segment_count);
si->sit_area_segs = le32_to_cpu(raw_super->segment_count_sit);
si->nat_area_segs = le32_to_cpu(raw_super->segment_count_nat);
Expand All @@ -325,6 +319,11 @@ static int init_stats(struct f2fs_sb_info *sbi)
si->main_area_zones = si->main_area_sections /
le32_to_cpu(raw_super->secs_per_zone);
si->sbi = sbi;

mutex_lock(&f2fs_stat_mutex);
list_add_tail(&si->stat_list, &f2fs_stat_list);
mutex_unlock(&f2fs_stat_mutex);

return 0;
}

Expand All @@ -347,10 +346,10 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
{
struct f2fs_stat_info *si = sbi->stat_info;

mutex_lock(&f2fs_stat_mutex);
list_del(&si->stat_list);
mutex_lock(&si->stat_lock);
si->sbi = NULL;
mutex_unlock(&si->stat_lock);
mutex_unlock(&f2fs_stat_mutex);

kfree(sbi->stat_info);
}

Expand Down

0 comments on commit ef2d720

Please sign in to comment.