Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 348975
b: refs/heads/master
c: 4589d25
h: refs/heads/master
i:
  348973: 2b1c723
  348971: b588c49
  348967: db9715f
  348959: 1b56ed3
v: v3
  • Loading branch information
Namjae Jeon authored and Jaegeuk Kim committed Jan 15, 2013
1 parent ef2d720 commit a11519d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 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: 66af62ce7588736ae65edfdb1c0df597775c4d21
refs/heads/master: 4589d25d015c2d02bb5f7075d0cbf6dcf23a33c0
27 changes: 10 additions & 17 deletions trunk/fs/f2fs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ static const struct file_operations stat_fops = {
.release = single_release,
};

static int init_stats(struct f2fs_sb_info *sbi)
int f2fs_build_stats(struct f2fs_sb_info *sbi)
{
struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
struct f2fs_stat_info *si;
Expand All @@ -327,21 +327,6 @@ static int init_stats(struct f2fs_sb_info *sbi)
return 0;
}

int f2fs_build_stats(struct f2fs_sb_info *sbi)
{
int retval;

retval = init_stats(sbi);
if (retval)
return retval;

if (!debugfs_root)
debugfs_root = debugfs_create_dir("f2fs", NULL);

debugfs_create_file("status", S_IRUGO, debugfs_root, NULL, &stat_fops);
return 0;
}

void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
{
struct f2fs_stat_info *si = sbi->stat_info;
Expand All @@ -353,7 +338,15 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
kfree(sbi->stat_info);
}

void destroy_root_stats(void)
void __init f2fs_create_root_stats(void)
{
debugfs_root = debugfs_create_dir("f2fs", NULL);
if (debugfs_root)
debugfs_create_file("status", S_IRUGO, debugfs_root,
NULL, &stat_fops);
}

void f2fs_destroy_root_stats(void)
{
debugfs_remove_recursive(debugfs_root);
debugfs_root = NULL;
Expand Down
6 changes: 4 additions & 2 deletions trunk/fs/f2fs/f2fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,8 @@ struct f2fs_stat_info {

int f2fs_build_stats(struct f2fs_sb_info *);
void f2fs_destroy_stats(struct f2fs_sb_info *);
void destroy_root_stats(void);
void f2fs_create_root_stats(void);
void f2fs_destroy_root_stats(void);
#else
#define stat_inc_call_count(si)
#define stat_inc_seg_count(si, type)
Expand All @@ -1070,7 +1071,8 @@ void destroy_root_stats(void);

static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
static inline void destroy_root_stats(void) { }
static inline void f2fs_create_root_stats(void) { }
static inline void f2fs_destroy_root_stats(void) { }
#endif

extern const struct file_operations f2fs_dir_operations;
Expand Down
7 changes: 5 additions & 2 deletions trunk/fs/f2fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,17 @@ static int __init init_f2fs_fs(void)
err = create_checkpoint_caches();
if (err)
goto fail;
return register_filesystem(&f2fs_fs_type);
err = register_filesystem(&f2fs_fs_type);
if (err)
goto fail;
f2fs_create_root_stats();
fail:
return err;
}

static void __exit exit_f2fs_fs(void)
{
destroy_root_stats();
f2fs_destroy_root_stats();
unregister_filesystem(&f2fs_fs_type);
destroy_checkpoint_caches();
destroy_gc_caches();
Expand Down

0 comments on commit a11519d

Please sign in to comment.