aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@gmail.com>2013-01-15 05:58:47 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-01-15 06:19:15 -0500
commit4589d25d015c2d02bb5f7075d0cbf6dcf23a33c0 (patch)
treef91c18c0285d980938b8bbac7d8c7e7ed5863421
parent66af62ce7588736ae65edfdb1c0df597775c4d21 (diff)
f2fs: fix the debugfs entry creation path
As the "status" debugfs entry will be maintained for entire F2FS filesystem irrespective of the number of partitions. So, we can move the initialization to the init part of the f2fs and destroy will be done from exit part. After making changes, for individual partition mount - entry creation code will not be executed. Signed-off-by: Jianpeng Ma <majianpeng@gmail.com> 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>
-rw-r--r--fs/f2fs/debug.c27
-rw-r--r--fs/f2fs/f2fs.h6
-rw-r--r--fs/f2fs/super.c7
3 files changed, 19 insertions, 21 deletions
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 73f034a94182..c8c37307b326 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -300,7 +300,7 @@ static const struct file_operations stat_fops = {
300 .release = single_release, 300 .release = single_release,
301}; 301};
302 302
303static int init_stats(struct f2fs_sb_info *sbi) 303int f2fs_build_stats(struct f2fs_sb_info *sbi)
304{ 304{
305 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); 305 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
306 struct f2fs_stat_info *si; 306 struct f2fs_stat_info *si;
@@ -327,21 +327,6 @@ static int init_stats(struct f2fs_sb_info *sbi)
327 return 0; 327 return 0;
328} 328}
329 329
330int f2fs_build_stats(struct f2fs_sb_info *sbi)
331{
332 int retval;
333
334 retval = init_stats(sbi);
335 if (retval)
336 return retval;
337
338 if (!debugfs_root)
339 debugfs_root = debugfs_create_dir("f2fs", NULL);
340
341 debugfs_create_file("status", S_IRUGO, debugfs_root, NULL, &stat_fops);
342 return 0;
343}
344
345void f2fs_destroy_stats(struct f2fs_sb_info *sbi) 330void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
346{ 331{
347 struct f2fs_stat_info *si = sbi->stat_info; 332 struct f2fs_stat_info *si = sbi->stat_info;
@@ -353,7 +338,15 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
353 kfree(sbi->stat_info); 338 kfree(sbi->stat_info);
354} 339}
355 340
356void destroy_root_stats(void) 341void __init f2fs_create_root_stats(void)
342{
343 debugfs_root = debugfs_create_dir("f2fs", NULL);
344 if (debugfs_root)
345 debugfs_create_file("status", S_IRUGO, debugfs_root,
346 NULL, &stat_fops);
347}
348
349void f2fs_destroy_root_stats(void)
357{ 350{
358 debugfs_remove_recursive(debugfs_root); 351 debugfs_remove_recursive(debugfs_root);
359 debugfs_root = NULL; 352 debugfs_root = NULL;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 285e43d602f3..976325d51e3d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1060,7 +1060,8 @@ struct f2fs_stat_info {
1060 1060
1061int f2fs_build_stats(struct f2fs_sb_info *); 1061int f2fs_build_stats(struct f2fs_sb_info *);
1062void f2fs_destroy_stats(struct f2fs_sb_info *); 1062void f2fs_destroy_stats(struct f2fs_sb_info *);
1063void destroy_root_stats(void); 1063void f2fs_create_root_stats(void);
1064void f2fs_destroy_root_stats(void);
1064#else 1065#else
1065#define stat_inc_call_count(si) 1066#define stat_inc_call_count(si)
1066#define stat_inc_seg_count(si, type) 1067#define stat_inc_seg_count(si, type)
@@ -1070,7 +1071,8 @@ void destroy_root_stats(void);
1070 1071
1071static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 1072static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
1072static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 1073static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
1073static inline void destroy_root_stats(void) { } 1074static inline void f2fs_create_root_stats(void) { }
1075static inline void f2fs_destroy_root_stats(void) { }
1074#endif 1076#endif
1075 1077
1076extern const struct file_operations f2fs_dir_operations; 1078extern const struct file_operations f2fs_dir_operations;
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index ac127fde8e11..d551a724b736 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -675,14 +675,17 @@ static int __init init_f2fs_fs(void)
675 err = create_checkpoint_caches(); 675 err = create_checkpoint_caches();
676 if (err) 676 if (err)
677 goto fail; 677 goto fail;
678 return register_filesystem(&f2fs_fs_type); 678 err = register_filesystem(&f2fs_fs_type);
679 if (err)
680 goto fail;
681 f2fs_create_root_stats();
679fail: 682fail:
680 return err; 683 return err;
681} 684}
682 685
683static void __exit exit_f2fs_fs(void) 686static void __exit exit_f2fs_fs(void)
684{ 687{
685 destroy_root_stats(); 688 f2fs_destroy_root_stats();
686 unregister_filesystem(&f2fs_fs_type); 689 unregister_filesystem(&f2fs_fs_type);
687 destroy_checkpoint_caches(); 690 destroy_checkpoint_caches();
688 destroy_gc_caches(); 691 destroy_gc_caches();