summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/f2fs.h
diff options
context:
space:
mode:
authorTomohiro Kusumi <tkusumi@tuxera.com>2017-04-08 19:11:36 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2017-04-10 22:48:10 -0400
commit68afcf2d38cd7544817558757e57e7b9d5c4e72c (patch)
treef9615c9e7fe7adb2958d5b4c489aa93ed8ab5870 /fs/f2fs/f2fs.h
parent771a9a71778def4098e8baaa23854d24e33fdb2f (diff)
f2fs: guard macro variables with braces
Add braces around variables used within macros for those make sense to do it. Many of the macros in f2fs already do this. What this commit doesn't do is anything that changes line# as a result of adding braces, which usually affects the binary via __LINE__. Confirmed no diff in fs/f2fs/f2fs.ko before/after this commit on x86_64, to make sure this has no functional change as well as there's been no unexpected side effect due to callers' arithmetics within the existing code. Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r--fs/f2fs/f2fs.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 7321f061bb28..3e1f8319d557 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -63,7 +63,7 @@ struct f2fs_fault_info {
63}; 63};
64 64
65extern char *fault_name[FAULT_MAX]; 65extern char *fault_name[FAULT_MAX];
66#define IS_FAULT_SET(fi, type) (fi->inject_type & (1 << (type))) 66#define IS_FAULT_SET(fi, type) ((fi)->inject_type & (1 << (type)))
67#endif 67#endif
68 68
69/* 69/*
@@ -89,9 +89,9 @@ extern char *fault_name[FAULT_MAX];
89#define F2FS_MOUNT_ADAPTIVE 0x00020000 89#define F2FS_MOUNT_ADAPTIVE 0x00020000
90#define F2FS_MOUNT_LFS 0x00040000 90#define F2FS_MOUNT_LFS 0x00040000
91 91
92#define clear_opt(sbi, option) (sbi->mount_opt.opt &= ~F2FS_MOUNT_##option) 92#define clear_opt(sbi, option) ((sbi)->mount_opt.opt &= ~F2FS_MOUNT_##option)
93#define set_opt(sbi, option) (sbi->mount_opt.opt |= F2FS_MOUNT_##option) 93#define set_opt(sbi, option) ((sbi)->mount_opt.opt |= F2FS_MOUNT_##option)
94#define test_opt(sbi, option) (sbi->mount_opt.opt & F2FS_MOUNT_##option) 94#define test_opt(sbi, option) ((sbi)->mount_opt.opt & F2FS_MOUNT_##option)
95 95
96#define ver_after(a, b) (typecheck(unsigned long long, a) && \ 96#define ver_after(a, b) (typecheck(unsigned long long, a) && \
97 typecheck(unsigned long long, b) && \ 97 typecheck(unsigned long long, b) && \
@@ -228,13 +228,13 @@ struct fsync_inode_entry {
228 block_t last_dentry; /* block address locating the last dentry */ 228 block_t last_dentry; /* block address locating the last dentry */
229}; 229};
230 230
231#define nats_in_cursum(jnl) (le16_to_cpu(jnl->n_nats)) 231#define nats_in_cursum(jnl) (le16_to_cpu((jnl)->n_nats))
232#define sits_in_cursum(jnl) (le16_to_cpu(jnl->n_sits)) 232#define sits_in_cursum(jnl) (le16_to_cpu((jnl)->n_sits))
233 233
234#define nat_in_journal(jnl, i) (jnl->nat_j.entries[i].ne) 234#define nat_in_journal(jnl, i) ((jnl)->nat_j.entries[i].ne)
235#define nid_in_journal(jnl, i) (jnl->nat_j.entries[i].nid) 235#define nid_in_journal(jnl, i) ((jnl)->nat_j.entries[i].nid)
236#define sit_in_journal(jnl, i) (jnl->sit_j.entries[i].se) 236#define sit_in_journal(jnl, i) ((jnl)->sit_j.entries[i].se)
237#define segno_in_journal(jnl, i) (jnl->sit_j.entries[i].segno) 237#define segno_in_journal(jnl, i) ((jnl)->sit_j.entries[i].segno)
238 238
239#define MAX_NAT_JENTRIES(jnl) (NAT_JOURNAL_ENTRIES - nats_in_cursum(jnl)) 239#define MAX_NAT_JENTRIES(jnl) (NAT_JOURNAL_ENTRIES - nats_in_cursum(jnl))
240#define MAX_SIT_JENTRIES(jnl) (SIT_JOURNAL_ENTRIES - sits_in_cursum(jnl)) 240#define MAX_SIT_JENTRIES(jnl) (SIT_JOURNAL_ENTRIES - sits_in_cursum(jnl))
@@ -745,7 +745,7 @@ struct f2fs_io_info {
745 bool submitted; /* indicate IO submission */ 745 bool submitted; /* indicate IO submission */
746}; 746};
747 747
748#define is_read_io(rw) (rw == READ) 748#define is_read_io(rw) ((rw) == READ)
749struct f2fs_bio_info { 749struct f2fs_bio_info {
750 struct f2fs_sb_info *sbi; /* f2fs superblock */ 750 struct f2fs_sb_info *sbi; /* f2fs superblock */
751 struct bio *bio; /* bios to merge */ 751 struct bio *bio; /* bios to merge */
@@ -983,8 +983,8 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type)
983 * and the return value is in kbytes. s is of struct f2fs_sb_info. 983 * and the return value is in kbytes. s is of struct f2fs_sb_info.
984 */ 984 */
985#define BD_PART_WRITTEN(s) \ 985#define BD_PART_WRITTEN(s) \
986(((u64)part_stat_read(s->sb->s_bdev->bd_part, sectors[1]) - \ 986(((u64)part_stat_read((s)->sb->s_bdev->bd_part, sectors[1]) - \
987 s->sectors_written_start) >> 1) 987 (s)->sectors_written_start) >> 1)
988 988
989static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type) 989static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type)
990{ 990{
@@ -2437,8 +2437,8 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
2437#define stat_inc_seg_count(sbi, type, gc_type) \ 2437#define stat_inc_seg_count(sbi, type, gc_type) \
2438 do { \ 2438 do { \
2439 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2439 struct f2fs_stat_info *si = F2FS_STAT(sbi); \
2440 (si)->tot_segs++; \ 2440 si->tot_segs++; \
2441 if (type == SUM_TYPE_DATA) { \ 2441 if ((type) == SUM_TYPE_DATA) { \
2442 si->data_segs++; \ 2442 si->data_segs++; \
2443 si->bg_data_segs += (gc_type == BG_GC) ? 1 : 0; \ 2443 si->bg_data_segs += (gc_type == BG_GC) ? 1 : 0; \
2444 } else { \ 2444 } else { \
@@ -2448,14 +2448,14 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
2448 } while (0) 2448 } while (0)
2449 2449
2450#define stat_inc_tot_blk_count(si, blks) \ 2450#define stat_inc_tot_blk_count(si, blks) \
2451 (si->tot_blks += (blks)) 2451 ((si)->tot_blks += (blks))
2452 2452
2453#define stat_inc_data_blk_count(sbi, blks, gc_type) \ 2453#define stat_inc_data_blk_count(sbi, blks, gc_type) \
2454 do { \ 2454 do { \
2455 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2455 struct f2fs_stat_info *si = F2FS_STAT(sbi); \
2456 stat_inc_tot_blk_count(si, blks); \ 2456 stat_inc_tot_blk_count(si, blks); \
2457 si->data_blks += (blks); \ 2457 si->data_blks += (blks); \
2458 si->bg_data_blks += (gc_type == BG_GC) ? (blks) : 0; \ 2458 si->bg_data_blks += ((gc_type) == BG_GC) ? (blks) : 0; \
2459 } while (0) 2459 } while (0)
2460 2460
2461#define stat_inc_node_blk_count(sbi, blks, gc_type) \ 2461#define stat_inc_node_blk_count(sbi, blks, gc_type) \
@@ -2463,7 +2463,7 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
2463 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2463 struct f2fs_stat_info *si = F2FS_STAT(sbi); \
2464 stat_inc_tot_blk_count(si, blks); \ 2464 stat_inc_tot_blk_count(si, blks); \
2465 si->node_blks += (blks); \ 2465 si->node_blks += (blks); \
2466 si->bg_node_blks += (gc_type == BG_GC) ? (blks) : 0; \ 2466 si->bg_node_blks += ((gc_type) == BG_GC) ? (blks) : 0; \
2467 } while (0) 2467 } while (0)
2468 2468
2469int f2fs_build_stats(struct f2fs_sb_info *sbi); 2469int f2fs_build_stats(struct f2fs_sb_info *sbi);