Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Tomohiro Kusumi and committed by
Jaegeuk Kim
68afcf2d 771a9a71

+70 -70
+18 -18
fs/f2fs/f2fs.h
··· 63 63 }; 64 64 65 65 extern 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 67 #endif 68 68 69 69 /* ··· 89 89 #define F2FS_MOUNT_ADAPTIVE 0x00020000 90 90 #define F2FS_MOUNT_LFS 0x00040000 91 91 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) 94 - #define test_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) 94 + #define test_opt(sbi, option) ((sbi)->mount_opt.opt & F2FS_MOUNT_##option) 95 95 96 96 #define ver_after(a, b) (typecheck(unsigned long long, a) && \ 97 97 typecheck(unsigned long long, b) && \ ··· 228 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)) 232 - #define sits_in_cursum(jnl) (le16_to_cpu(jnl->n_sits)) 231 + #define nats_in_cursum(jnl) (le16_to_cpu((jnl)->n_nats)) 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) 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) 237 - #define segno_in_journal(jnl, i) (jnl->sit_j.entries[i].segno) 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) 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) 238 238 239 239 #define MAX_NAT_JENTRIES(jnl) (NAT_JOURNAL_ENTRIES - nats_in_cursum(jnl)) 240 240 #define MAX_SIT_JENTRIES(jnl) (SIT_JOURNAL_ENTRIES - sits_in_cursum(jnl)) ··· 745 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) 749 749 struct f2fs_bio_info { 750 750 struct f2fs_sb_info *sbi; /* f2fs superblock */ 751 751 struct bio *bio; /* bios to merge */ ··· 983 983 * and the return value is in kbytes. s is of struct f2fs_sb_info. 984 984 */ 985 985 #define BD_PART_WRITTEN(s) \ 986 - (((u64)part_stat_read(s->sb->s_bdev->bd_part, sectors[1]) - \ 987 - s->sectors_written_start) >> 1) 986 + (((u64)part_stat_read((s)->sb->s_bdev->bd_part, sectors[1]) - \ 987 + (s)->sectors_written_start) >> 1) 988 988 989 989 static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type) 990 990 { ··· 2437 2437 #define stat_inc_seg_count(sbi, type, gc_type) \ 2438 2438 do { \ 2439 2439 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2440 - (si)->tot_segs++; \ 2441 - if (type == SUM_TYPE_DATA) { \ 2440 + si->tot_segs++; \ 2441 + if ((type) == SUM_TYPE_DATA) { \ 2442 2442 si->data_segs++; \ 2443 2443 si->bg_data_segs += (gc_type == BG_GC) ? 1 : 0; \ 2444 2444 } else { \ ··· 2448 2448 } while (0) 2449 2449 2450 2450 #define stat_inc_tot_blk_count(si, blks) \ 2451 - (si->tot_blks += (blks)) 2451 + ((si)->tot_blks += (blks)) 2452 2452 2453 2453 #define stat_inc_data_blk_count(sbi, blks, gc_type) \ 2454 2454 do { \ 2455 2455 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2456 2456 stat_inc_tot_blk_count(si, blks); \ 2457 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 2459 } while (0) 2460 2460 2461 2461 #define stat_inc_node_blk_count(sbi, blks, gc_type) \ ··· 2463 2463 struct f2fs_stat_info *si = F2FS_STAT(sbi); \ 2464 2464 stat_inc_tot_blk_count(si, blks); \ 2465 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 2467 } while (0) 2468 2468 2469 2469 int f2fs_build_stats(struct f2fs_sb_info *sbi);
+1 -1
fs/f2fs/node.c
··· 22 22 #include "trace.h" 23 23 #include <trace/events/f2fs.h> 24 24 25 - #define on_build_free_nids(nmi) mutex_is_locked(&nm_i->build_lock) 25 + #define on_build_free_nids(nmi) mutex_is_locked(&(nm_i)->build_lock) 26 26 27 27 static struct kmem_cache *nat_entry_slab; 28 28 static struct kmem_cache *free_nid_slab;
+11 -11
fs/f2fs/node.h
··· 9 9 * published by the Free Software Foundation. 10 10 */ 11 11 /* start node id of a node block dedicated to the given node id */ 12 - #define START_NID(nid) ((nid / NAT_ENTRY_PER_BLOCK) * NAT_ENTRY_PER_BLOCK) 12 + #define START_NID(nid) (((nid) / NAT_ENTRY_PER_BLOCK) * NAT_ENTRY_PER_BLOCK) 13 13 14 14 /* node block offset on the NAT area dedicated to the given start node id */ 15 - #define NAT_BLOCK_OFFSET(start_nid) (start_nid / NAT_ENTRY_PER_BLOCK) 15 + #define NAT_BLOCK_OFFSET(start_nid) ((start_nid) / NAT_ENTRY_PER_BLOCK) 16 16 17 17 /* # of pages to perform synchronous readahead before building free nids */ 18 18 #define FREE_NID_PAGES 8 ··· 62 62 struct node_info ni; /* in-memory node information */ 63 63 }; 64 64 65 - #define nat_get_nid(nat) (nat->ni.nid) 66 - #define nat_set_nid(nat, n) (nat->ni.nid = n) 67 - #define nat_get_blkaddr(nat) (nat->ni.blk_addr) 68 - #define nat_set_blkaddr(nat, b) (nat->ni.blk_addr = b) 69 - #define nat_get_ino(nat) (nat->ni.ino) 70 - #define nat_set_ino(nat, i) (nat->ni.ino = i) 71 - #define nat_get_version(nat) (nat->ni.version) 72 - #define nat_set_version(nat, v) (nat->ni.version = v) 65 + #define nat_get_nid(nat) ((nat)->ni.nid) 66 + #define nat_set_nid(nat, n) ((nat)->ni.nid = (n)) 67 + #define nat_get_blkaddr(nat) ((nat)->ni.blk_addr) 68 + #define nat_set_blkaddr(nat, b) ((nat)->ni.blk_addr = (b)) 69 + #define nat_get_ino(nat) ((nat)->ni.ino) 70 + #define nat_set_ino(nat, i) ((nat)->ni.ino = (i)) 71 + #define nat_get_version(nat) ((nat)->ni.version) 72 + #define nat_set_version(nat, v) ((nat)->ni.version = (v)) 73 73 74 - #define inc_node_version(version) (++version) 74 + #define inc_node_version(version) (++(version)) 75 75 76 76 static inline void copy_node_info(struct node_info *dst, 77 77 struct node_info *src)
+38 -38
fs/f2fs/segment.h
··· 21 21 #define F2FS_MIN_SEGMENTS 9 /* SB + 2 (CP + SIT + NAT) + SSA + MAIN */ 22 22 23 23 /* L: Logical segment # in volume, R: Relative segment # in main area */ 24 - #define GET_L2R_SEGNO(free_i, segno) (segno - free_i->start_segno) 25 - #define GET_R2L_SEGNO(free_i, segno) (segno + free_i->start_segno) 24 + #define GET_L2R_SEGNO(free_i, segno) ((segno) - (free_i)->start_segno) 25 + #define GET_R2L_SEGNO(free_i, segno) ((segno) + (free_i)->start_segno) 26 26 27 - #define IS_DATASEG(t) (t <= CURSEG_COLD_DATA) 28 - #define IS_NODESEG(t) (t >= CURSEG_HOT_NODE) 27 + #define IS_DATASEG(t) ((t) <= CURSEG_COLD_DATA) 28 + #define IS_NODESEG(t) ((t) >= CURSEG_HOT_NODE) 29 29 30 30 #define IS_CURSEG(sbi, seg) \ 31 - ((seg == CURSEG_I(sbi, CURSEG_HOT_DATA)->segno) || \ 32 - (seg == CURSEG_I(sbi, CURSEG_WARM_DATA)->segno) || \ 33 - (seg == CURSEG_I(sbi, CURSEG_COLD_DATA)->segno) || \ 34 - (seg == CURSEG_I(sbi, CURSEG_HOT_NODE)->segno) || \ 35 - (seg == CURSEG_I(sbi, CURSEG_WARM_NODE)->segno) || \ 36 - (seg == CURSEG_I(sbi, CURSEG_COLD_NODE)->segno)) 31 + (((seg) == CURSEG_I(sbi, CURSEG_HOT_DATA)->segno) || \ 32 + ((seg) == CURSEG_I(sbi, CURSEG_WARM_DATA)->segno) || \ 33 + ((seg) == CURSEG_I(sbi, CURSEG_COLD_DATA)->segno) || \ 34 + ((seg) == CURSEG_I(sbi, CURSEG_HOT_NODE)->segno) || \ 35 + ((seg) == CURSEG_I(sbi, CURSEG_WARM_NODE)->segno) || \ 36 + ((seg) == CURSEG_I(sbi, CURSEG_COLD_NODE)->segno)) 37 37 38 38 #define IS_CURSEC(sbi, secno) \ 39 - ((secno == CURSEG_I(sbi, CURSEG_HOT_DATA)->segno / \ 40 - sbi->segs_per_sec) || \ 41 - (secno == CURSEG_I(sbi, CURSEG_WARM_DATA)->segno / \ 42 - sbi->segs_per_sec) || \ 43 - (secno == CURSEG_I(sbi, CURSEG_COLD_DATA)->segno / \ 44 - sbi->segs_per_sec) || \ 45 - (secno == CURSEG_I(sbi, CURSEG_HOT_NODE)->segno / \ 46 - sbi->segs_per_sec) || \ 47 - (secno == CURSEG_I(sbi, CURSEG_WARM_NODE)->segno / \ 48 - sbi->segs_per_sec) || \ 49 - (secno == CURSEG_I(sbi, CURSEG_COLD_NODE)->segno / \ 50 - sbi->segs_per_sec)) \ 39 + (((secno) == CURSEG_I(sbi, CURSEG_HOT_DATA)->segno / \ 40 + (sbi)->segs_per_sec) || \ 41 + ((secno) == CURSEG_I(sbi, CURSEG_WARM_DATA)->segno / \ 42 + (sbi)->segs_per_sec) || \ 43 + ((secno) == CURSEG_I(sbi, CURSEG_COLD_DATA)->segno / \ 44 + (sbi)->segs_per_sec) || \ 45 + ((secno) == CURSEG_I(sbi, CURSEG_HOT_NODE)->segno / \ 46 + (sbi)->segs_per_sec) || \ 47 + ((secno) == CURSEG_I(sbi, CURSEG_WARM_NODE)->segno / \ 48 + (sbi)->segs_per_sec) || \ 49 + ((secno) == CURSEG_I(sbi, CURSEG_COLD_NODE)->segno / \ 50 + (sbi)->segs_per_sec)) \ 51 51 52 52 #define MAIN_BLKADDR(sbi) (SM_I(sbi)->main_blkaddr) 53 53 #define SEG0_BLKADDR(sbi) (SM_I(sbi)->seg0_blkaddr) 54 54 55 55 #define MAIN_SEGS(sbi) (SM_I(sbi)->main_segments) 56 - #define MAIN_SECS(sbi) (sbi->total_sections) 56 + #define MAIN_SECS(sbi) ((sbi)->total_sections) 57 57 58 58 #define TOTAL_SEGS(sbi) (SM_I(sbi)->segment_count) 59 - #define TOTAL_BLKS(sbi) (TOTAL_SEGS(sbi) << sbi->log_blocks_per_seg) 59 + #define TOTAL_BLKS(sbi) (TOTAL_SEGS(sbi) << (sbi)->log_blocks_per_seg) 60 60 61 61 #define MAX_BLKADDR(sbi) (SEG0_BLKADDR(sbi) + TOTAL_BLKS(sbi)) 62 - #define SEGMENT_SIZE(sbi) (1ULL << (sbi->log_blocksize + \ 63 - sbi->log_blocks_per_seg)) 62 + #define SEGMENT_SIZE(sbi) (1ULL << ((sbi)->log_blocksize + \ 63 + (sbi)->log_blocks_per_seg)) 64 64 65 65 #define START_BLOCK(sbi, segno) (SEG0_BLKADDR(sbi) + \ 66 - (GET_R2L_SEGNO(FREE_I(sbi), segno) << sbi->log_blocks_per_seg)) 66 + (GET_R2L_SEGNO(FREE_I(sbi), segno) << (sbi)->log_blocks_per_seg)) 67 67 68 68 #define NEXT_FREE_BLKADDR(sbi, curseg) \ 69 - (START_BLOCK(sbi, curseg->segno) + curseg->next_blkoff) 69 + (START_BLOCK(sbi, (curseg)->segno) + (curseg)->next_blkoff) 70 70 71 71 #define GET_SEGOFF_FROM_SEG0(sbi, blk_addr) ((blk_addr) - SEG0_BLKADDR(sbi)) 72 72 #define GET_SEGNO_FROM_SEG0(sbi, blk_addr) \ 73 - (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) >> sbi->log_blocks_per_seg) 73 + (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) >> (sbi)->log_blocks_per_seg) 74 74 #define GET_BLKOFF_FROM_SEG0(sbi, blk_addr) \ 75 - (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & (sbi->blocks_per_seg - 1)) 75 + (GET_SEGOFF_FROM_SEG0(sbi, blk_addr) & ((sbi)->blocks_per_seg - 1)) 76 76 77 77 #define GET_SEGNO(sbi, blk_addr) \ 78 - (((blk_addr == NULL_ADDR) || (blk_addr == NEW_ADDR)) ? \ 78 + ((((blk_addr) == NULL_ADDR) || ((blk_addr) == NEW_ADDR)) ? \ 79 79 NULL_SEGNO : GET_L2R_SEGNO(FREE_I(sbi), \ 80 80 GET_SEGNO_FROM_SEG0(sbi, blk_addr))) 81 81 #define GET_SECNO(sbi, segno) \ 82 - ((segno) / sbi->segs_per_sec) 82 + ((segno) / (sbi)->segs_per_sec) 83 83 #define GET_ZONENO_FROM_SEGNO(sbi, segno) \ 84 - ((segno / sbi->segs_per_sec) / sbi->secs_per_zone) 84 + (((segno) / (sbi)->segs_per_sec) / (sbi)->secs_per_zone) 85 85 86 86 #define GET_SUM_BLOCK(sbi, segno) \ 87 - ((sbi->sm_info->ssa_blkaddr) + segno) 87 + ((sbi)->sm_info->ssa_blkaddr + (segno)) 88 88 89 89 #define GET_SUM_TYPE(footer) ((footer)->entry_type) 90 - #define SET_SUM_TYPE(footer, type) ((footer)->entry_type = type) 90 + #define SET_SUM_TYPE(footer, type) ((footer)->entry_type = (type)) 91 91 92 92 #define SIT_ENTRY_OFFSET(sit_i, segno) \ 93 - (segno % sit_i->sents_per_block) 93 + ((segno) % (sit_i)->sents_per_block) 94 94 #define SIT_BLOCK_OFFSET(segno) \ 95 - (segno / SIT_ENTRY_PER_BLOCK) 95 + ((segno) / SIT_ENTRY_PER_BLOCK) 96 96 #define START_SEGNO(segno) \ 97 97 (SIT_BLOCK_OFFSET(segno) * SIT_ENTRY_PER_BLOCK) 98 98 #define SIT_BLK_CNT(sbi) \ ··· 103 103 #define SECTOR_FROM_BLOCK(blk_addr) \ 104 104 (((sector_t)blk_addr) << F2FS_LOG_SECTORS_PER_BLOCK) 105 105 #define SECTOR_TO_BLOCK(sectors) \ 106 - (sectors >> F2FS_LOG_SECTORS_PER_BLOCK) 106 + ((sectors) >> F2FS_LOG_SECTORS_PER_BLOCK) 107 107 108 108 /* 109 109 * indicate a block allocation direction: RIGHT and LEFT.
+2 -2
fs/f2fs/xattr.h
··· 58 58 #define XATTR_FIRST_ENTRY(ptr) (XATTR_ENTRY(XATTR_HDR(ptr) + 1)) 59 59 #define XATTR_ROUND (3) 60 60 61 - #define XATTR_ALIGN(size) ((size + XATTR_ROUND) & ~XATTR_ROUND) 61 + #define XATTR_ALIGN(size) (((size) + XATTR_ROUND) & ~XATTR_ROUND) 62 62 63 63 #define ENTRY_SIZE(entry) (XATTR_ALIGN(sizeof(struct f2fs_xattr_entry) + \ 64 - entry->e_name_len + le16_to_cpu(entry->e_value_size))) 64 + (entry)->e_name_len + le16_to_cpu((entry)->e_value_size))) 65 65 66 66 #define XATTR_NEXT_ENTRY(entry) ((struct f2fs_xattr_entry *)((char *)(entry) +\ 67 67 ENTRY_SIZE(entry)))