Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626634 > unrolled thread

[PATCH] f2fs: improve definition of statistic macros

Started byArnd Bergmann <arnd@arndb.de>
First post2017-04-19 19:40 +0200
Last post2017-04-20 03:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] f2fs: improve definition of statistic macros Arnd Bergmann <arnd@arndb.de> - 2017-04-19 19:40 +0200
    Re: [PATCH] f2fs: improve definition of statistic macros Chao Yu <yuchao0@huawei.com> - 2017-04-20 03:20 +0200

#1626634 — [PATCH] f2fs: improve definition of statistic macros

FromArnd Bergmann <arnd@arndb.de>
Date2017-04-19 19:40 +0200
Subject[PATCH] f2fs: improve definition of statistic macros
Message-ID<ty1K9-6hB-11@gated-at.bofh.it>
With a recent addition of f2fs_lookup_extent_tree(), we get a warning about
the use of empty macros:

fs/f2fs/extent_cache.c: In function 'f2fs_lookup_extent_tree':
fs/f2fs/extent_cache.c:358:32: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
   stat_inc_rbtree_node_hit(sbi);

A good way to avoid the warning and make the code more robust is to define
all no-op macros as 'do { } while (0)'.

Fixes: 54c2258cd63a ("f2fs: extract rb-tree operation infrastructure")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/f2fs/f2fs.h | 58 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 18bb86ac0f33..cdd33af74e01 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2464,35 +2464,35 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi);
 int __init f2fs_create_root_stats(void);
 void f2fs_destroy_root_stats(void);
 #else
-#define stat_inc_cp_count(si)
-#define stat_inc_bg_cp_count(si)
-#define stat_inc_call_count(si)
-#define stat_inc_bggc_count(si)
-#define stat_inc_dirty_inode(sbi, type)
-#define stat_dec_dirty_inode(sbi, type)
-#define stat_inc_total_hit(sb)
-#define stat_inc_rbtree_node_hit(sb)
-#define stat_inc_largest_node_hit(sbi)
-#define stat_inc_cached_node_hit(sbi)
-#define stat_inc_inline_xattr(inode)
-#define stat_dec_inline_xattr(inode)
-#define stat_inc_inline_inode(inode)
-#define stat_dec_inline_inode(inode)
-#define stat_inc_inline_dir(inode)
-#define stat_dec_inline_dir(inode)
-#define stat_inc_atomic_write(inode)
-#define stat_dec_atomic_write(inode)
-#define stat_update_max_atomic_write(inode)
-#define stat_inc_volatile_write(inode)
-#define stat_dec_volatile_write(inode)
-#define stat_update_max_volatile_write(inode)
-#define stat_inc_seg_type(sbi, curseg)
-#define stat_inc_block_count(sbi, curseg)
-#define stat_inc_inplace_blocks(sbi)
-#define stat_inc_seg_count(sbi, type, gc_type)
-#define stat_inc_tot_blk_count(si, blks)
-#define stat_inc_data_blk_count(sbi, blks, gc_type)
-#define stat_inc_node_blk_count(sbi, blks, gc_type)
+#define stat_inc_cp_count(si)				do { } while (0)
+#define stat_inc_bg_cp_count(si)			do { } while (0)
+#define stat_inc_call_count(si)				do { } while (0)
+#define stat_inc_bggc_count(si)				do { } while (0)
+#define stat_inc_dirty_inode(sbi, type)			do { } while (0)
+#define stat_dec_dirty_inode(sbi, type)			do { } while (0)
+#define stat_inc_total_hit(sb)				do { } while (0)
+#define stat_inc_rbtree_node_hit(sb)			do { } while (0)
+#define stat_inc_largest_node_hit(sbi)			do { } while (0)
+#define stat_inc_cached_node_hit(sbi)			do { } while (0)
+#define stat_inc_inline_xattr(inode)			do { } while (0)
+#define stat_dec_inline_xattr(inode)			do { } while (0)
+#define stat_inc_inline_inode(inode)			do { } while (0)
+#define stat_dec_inline_inode(inode)			do { } while (0)
+#define stat_inc_inline_dir(inode)			do { } while (0)
+#define stat_dec_inline_dir(inode)			do { } while (0)
+#define stat_inc_atomic_write(inode)			do { } while (0)
+#define stat_dec_atomic_write(inode)			do { } while (0)
+#define stat_update_max_atomic_write(inode)		do { } while (0)
+#define stat_inc_volatile_write(inode)			do { } while (0)
+#define stat_dec_volatile_write(inode)			do { } while (0)
+#define stat_update_max_volatile_write(inode)		do { } while (0)
+#define stat_inc_seg_type(sbi, curseg)			do { } while (0)
+#define stat_inc_block_count(sbi, curseg)		do { } while (0)
+#define stat_inc_inplace_blocks(sbi)			do { } while (0)
+#define stat_inc_seg_count(sbi, type, gc_type)		do { } while (0)
+#define stat_inc_tot_blk_count(si, blks)		do { } while (0)
+#define stat_inc_data_blk_count(sbi, blks, gc_type)	do { } while (0)
+#define stat_inc_node_blk_count(sbi, blks, gc_type)	do { } while (0)
 
 static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
 static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
-- 
2.9.0

[toc] | [next] | [standalone]


#1626907

FromChao Yu <yuchao0@huawei.com>
Date2017-04-20 03:20 +0200
Message-ID<ty8Vj-2lE-1@gated-at.bofh.it>
In reply to#1626634
On 2017/4/20 1:38, Arnd Bergmann wrote:
> With a recent addition of f2fs_lookup_extent_tree(), we get a warning about
> the use of empty macros:
> 
> fs/f2fs/extent_cache.c: In function 'f2fs_lookup_extent_tree':
> fs/f2fs/extent_cache.c:358:32: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
>    stat_inc_rbtree_node_hit(sbi);
> 
> A good way to avoid the warning and make the code more robust is to define
> all no-op macros as 'do { } while (0)'.
> 
> Fixes: 54c2258cd63a ("f2fs: extract rb-tree operation infrastructure")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thank you for the fix. :)

Reivewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

> ---
>  fs/f2fs/f2fs.h | 58 +++++++++++++++++++++++++++++-----------------------------
>  1 file changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 18bb86ac0f33..cdd33af74e01 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2464,35 +2464,35 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi);
>  int __init f2fs_create_root_stats(void);
>  void f2fs_destroy_root_stats(void);
>  #else
> -#define stat_inc_cp_count(si)
> -#define stat_inc_bg_cp_count(si)
> -#define stat_inc_call_count(si)
> -#define stat_inc_bggc_count(si)
> -#define stat_inc_dirty_inode(sbi, type)
> -#define stat_dec_dirty_inode(sbi, type)
> -#define stat_inc_total_hit(sb)
> -#define stat_inc_rbtree_node_hit(sb)
> -#define stat_inc_largest_node_hit(sbi)
> -#define stat_inc_cached_node_hit(sbi)
> -#define stat_inc_inline_xattr(inode)
> -#define stat_dec_inline_xattr(inode)
> -#define stat_inc_inline_inode(inode)
> -#define stat_dec_inline_inode(inode)
> -#define stat_inc_inline_dir(inode)
> -#define stat_dec_inline_dir(inode)
> -#define stat_inc_atomic_write(inode)
> -#define stat_dec_atomic_write(inode)
> -#define stat_update_max_atomic_write(inode)
> -#define stat_inc_volatile_write(inode)
> -#define stat_dec_volatile_write(inode)
> -#define stat_update_max_volatile_write(inode)
> -#define stat_inc_seg_type(sbi, curseg)
> -#define stat_inc_block_count(sbi, curseg)
> -#define stat_inc_inplace_blocks(sbi)
> -#define stat_inc_seg_count(sbi, type, gc_type)
> -#define stat_inc_tot_blk_count(si, blks)
> -#define stat_inc_data_blk_count(sbi, blks, gc_type)
> -#define stat_inc_node_blk_count(sbi, blks, gc_type)
> +#define stat_inc_cp_count(si)				do { } while (0)
> +#define stat_inc_bg_cp_count(si)			do { } while (0)
> +#define stat_inc_call_count(si)				do { } while (0)
> +#define stat_inc_bggc_count(si)				do { } while (0)
> +#define stat_inc_dirty_inode(sbi, type)			do { } while (0)
> +#define stat_dec_dirty_inode(sbi, type)			do { } while (0)
> +#define stat_inc_total_hit(sb)				do { } while (0)
> +#define stat_inc_rbtree_node_hit(sb)			do { } while (0)
> +#define stat_inc_largest_node_hit(sbi)			do { } while (0)
> +#define stat_inc_cached_node_hit(sbi)			do { } while (0)
> +#define stat_inc_inline_xattr(inode)			do { } while (0)
> +#define stat_dec_inline_xattr(inode)			do { } while (0)
> +#define stat_inc_inline_inode(inode)			do { } while (0)
> +#define stat_dec_inline_inode(inode)			do { } while (0)
> +#define stat_inc_inline_dir(inode)			do { } while (0)
> +#define stat_dec_inline_dir(inode)			do { } while (0)
> +#define stat_inc_atomic_write(inode)			do { } while (0)
> +#define stat_dec_atomic_write(inode)			do { } while (0)
> +#define stat_update_max_atomic_write(inode)		do { } while (0)
> +#define stat_inc_volatile_write(inode)			do { } while (0)
> +#define stat_dec_volatile_write(inode)			do { } while (0)
> +#define stat_update_max_volatile_write(inode)		do { } while (0)
> +#define stat_inc_seg_type(sbi, curseg)			do { } while (0)
> +#define stat_inc_block_count(sbi, curseg)		do { } while (0)
> +#define stat_inc_inplace_blocks(sbi)			do { } while (0)
> +#define stat_inc_seg_count(sbi, type, gc_type)		do { } while (0)
> +#define stat_inc_tot_blk_count(si, blks)		do { } while (0)
> +#define stat_inc_data_blk_count(sbi, blks, gc_type)	do { } while (0)
> +#define stat_inc_node_blk_count(sbi, blks, gc_type)	do { } while (0)
>  
>  static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
>  static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web