BUG_ON conversion for fs/reiserfs
PATCH 1/1 BUG_ON conversion for fs/reiserfs
hi,
this patch converts several if () BUG(); construct to BUG_ON(); which occupies less space, uses unlikely and is safer when BUG() is disabled. S_ISREG() has no side effects, so the conversion is safe.
Signed-off-by Eric Sesterhenn <[email protected]>
fs/reiserfs/file.c renamed from fs/reiserfs/file.c.orig +2 -4
@@ -37,8 +37,7 @@ static int reiserfs_file_release(structint err;int jbegin_failure =0 ; -if (!S_ISREG (inode->i_mode)) -BUG (); +BUG_ON (!S_ISREG (inode->i_mode));/* fast out for when nothing needs to be done */ if ((atomic_read(&inode->i_count) > 1 ||
@@ -124,8 +123,7 @@ static int reiserfs_sync_file(struct filint n_err;int barrier_done; -if (!S_ISREG (p_s_inode->i_mode)) -BUG (); +BUG_ON (!S_ISREG (p_s_inode->i_mode)); n_err =sync_mapping_buffers (p_s_inode->i_mapping);reiserfs_write_lock (p_s_inode->i_sb); barrier_done =reiserfs_commit_for_inode (p_s_inode);
fs/reiserfs/item_ops.c renamed from fs/reiserfs/item_ops.c.orig +4 -8
@@ -75,8 +75,7 @@ static int sd_create_vi(struct virtual_nstatic int sd_check_left (struct virtual_item *vi,int free,int start_skip,int end_skip) { -if (start_skip || end_skip) -BUG (); +BUG_ON (start_skip || end_skip);return -1 ; }
@@ -87,8 +86,7 @@ static int sd_check_right(struct virtualstatic int sd_part_size (struct virtual_item *vi,int first,int count) { -if (count) -BUG (); +BUG_ON (count);return 0 ; }
@@ -476,8 +474,7 @@ static int direntry_create_vi(struct vir vi->vi_index =TYPE_DIRENTRY ; -if (!(vi->vi_ih) || !vi->vi_item) -BUG (); +BUG_ON (!(vi->vi_ih) || !vi->vi_item); dir_u->flags =0 ;if (le_ih_k_offset (vi->vi_ih) =DOT_OFFSET )
@@ -575,8 +572,7 @@ static int direntry_check_right(struct v free -= dir_u->entry_sizes[i]; entries++; } -if (entries = dir_u->entry_count) -BUG (); +BUG_ON (entries = dir_u->entry_count);/* "." and ".." can not be separated from each other */ if ((dir_u->flags & DIRENTRY_VI_FIRST_DIRENTRY_ITEM)
fs/reiserfs/journal.c renamed from fs/reiserfs/journal.c.orig +16 -33
127 lines not on this page · raw message
fs/reiserfs/namei.c renamed from fs/reiserfs/namei.c.orig +3 -6
@@ -67,8 +67,7 @@ inline void set_de_name_and_namelen(stru {struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num; -if (de->de_entry_num >=ih_entry_count (de->de_ih)) -BUG (); +BUG_ON (de->de_entry_num >=ih_entry_count (de->de_ih)); de->de_entrylen =entry_length (de->de_bh, de->de_ih, de->de_entry_num); de->de_namelen = de->de_entrylen - (de_with_sd (deh) ?SD_SIZE :0 );
@@ -80,8 +79,7 @@ inline void set_de_name_and_namelen(stru// what entry points to static inline void set_de_object_key (struct reiserfs_dir_entry *de) { -if (de->de_entry_num >=ih_entry_count (de->de_ih)) -BUG (); +BUG_ON (de->de_entry_num >=ih_entry_count (de->de_ih)); de->de_dir_id =deh_dir_id (&(de->de_deh[de->de_entry_num])); de->de_objectid =deh_objectid (&(de->de_deh[de->de_entry_num])); }
@@ -90,8 +88,7 @@ static inline void store_de_entry_key(st {struct reiserfs_de_head *deh = de->de_deh + de->de_entry_num; -if (de->de_entry_num >=ih_entry_count (de->de_ih)) -BUG (); +BUG_ON (de->de_entry_num >=ih_entry_count (de->de_ih));/* store key of the found entry */ de->de_entry_key.version =KEY_FORMAT_3_5 ;
fs/reiserfs/stree.c renamed from fs/reiserfs/stree.c.orig +1 -3
@@ -1476,9 +1476,7 @@ static int maybe_indirect_to_direct(struint n_block_size = p_s_sb->s_blocksize;int cut_bytes;BUG_ON (!th->t_trans_id); - -if (n_new_file_size != p_s_inode->i_size) -BUG (); +BUG_ON (n_new_file_size != p_s_inode->i_size);/* the page being sent in could be NULL if there was an i/o error ** reading in the last block. The user will hit problems trying to
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors