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

ext4: make state in ext4_mb_mark_bb to be bool

As state could only be either 0 or 1, just make it bool.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20230928160407.142069-2-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Kemeng Shi and committed by
Theodore Ts'o
d2f7cf40 61187fce

+9 -9
+1 -1
fs/ext4/ext4.h
··· 2926 2926 extern int ext4_trim_fs(struct super_block *, struct fstrim_range *); 2927 2927 extern void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid); 2928 2928 extern void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block, 2929 - int len, int state); 2929 + int len, bool state); 2930 2930 static inline bool ext4_mb_cr_expensive(enum criteria cr) 2931 2931 { 2932 2932 return cr >= CR_GOAL_LEN_SLOW;
+2 -2
fs/ext4/extents.c
··· 6080 6080 for (j = 0; j < path->p_depth; j++) { 6081 6081 6082 6082 ext4_mb_mark_bb(inode->i_sb, 6083 - path[j].p_block, 1, 0); 6083 + path[j].p_block, 1, false); 6084 6084 ext4_fc_record_regions(inode->i_sb, inode->i_ino, 6085 6085 0, path[j].p_block, 1, 1); 6086 6086 } 6087 6087 ext4_free_ext_path(path); 6088 6088 } 6089 - ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0); 6089 + ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, false); 6090 6090 ext4_fc_record_regions(inode->i_sb, inode->i_ino, 6091 6091 map.m_lblk, map.m_pblk, map.m_len, 1); 6092 6092 }
+4 -4
fs/ext4/fast_commit.c
··· 1806 1806 * at the end of the FC replay using our array of 1807 1807 * modified inodes. 1808 1808 */ 1809 - ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0); 1809 + ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, false); 1810 1810 goto next; 1811 1811 } 1812 1812 ··· 1875 1875 if (ret > 0) { 1876 1876 remaining -= ret; 1877 1877 cur += ret; 1878 - ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0); 1878 + ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, false); 1879 1879 } else { 1880 1880 remaining -= map.m_len; 1881 1881 cur += map.m_len; ··· 1934 1934 if (!IS_ERR(path)) { 1935 1935 for (j = 0; j < path->p_depth; j++) 1936 1936 ext4_mb_mark_bb(inode->i_sb, 1937 - path[j].p_block, 1, 1); 1937 + path[j].p_block, 1, true); 1938 1938 ext4_free_ext_path(path); 1939 1939 } 1940 1940 cur += ret; 1941 1941 ext4_mb_mark_bb(inode->i_sb, map.m_pblk, 1942 - map.m_len, 1); 1942 + map.m_len, true); 1943 1943 } else { 1944 1944 cur = cur + (map.m_len ? map.m_len : 1); 1945 1945 }
+2 -2
fs/ext4/mballoc.c
··· 4067 4067 * blocks in bitmaps and update counters. 4068 4068 */ 4069 4069 void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block, 4070 - int len, int state) 4070 + int len, bool state) 4071 4071 { 4072 4072 struct buffer_head *bitmap_bh = NULL; 4073 4073 struct ext4_group_desc *gdp; ··· 6095 6095 } 6096 6096 6097 6097 block = ext4_group_first_block_no(sb, group) + EXT4_C2B(sbi, i); 6098 - ext4_mb_mark_bb(sb, block, 1, 1); 6098 + ext4_mb_mark_bb(sb, block, 1, true); 6099 6099 ar->len = 1; 6100 6100 6101 6101 return block;