If we know a buffer_head is non-null, then brelse() is unnecessary and
put_bh() can be used instead. Also, an explicit check for NULL is
unnecessary when using brelse(). This patch only covers buffer_head_io.c and
resize.c, which have recently added code which exhibits this problem.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
* information for this bh as it's not marked locally
* uptodate. */
ret = -EIO;
- brelse(bh);
+ put_bh(bh);
}
mutex_unlock(&OCFS2_I(inode)->ip_io_mutex);
* for this bh as it's not marked locally
* uptodate. */
status = -EIO;
- brelse(bh);
+ put_bh(bh);
bhs[i] = NULL;
continue;
}
if (!buffer_uptodate(bh)) {
ret = -EIO;
- brelse(bh);
+ put_bh(bh);
}
out:
ret = update_backups(inode, clusters, super_bh->b_data);
out:
- if (super_bh)
- brelse(super_bh);
+ brelse(super_bh);
if (ret)
printk(KERN_WARNING "ocfs2: Failed to update super blocks on %s"
" during fs resize. This condition is not fatal,"
out_commit:
ocfs2_commit_trans(osb, handle);
out_unlock:
- if (group_bh)
- brelse(group_bh);
-
- if (main_bm_bh)
- brelse(main_bm_bh);
+ brelse(group_bh);
+ brelse(main_bm_bh);
ocfs2_inode_unlock(main_bm_inode, 1);
out_commit:
ocfs2_commit_trans(osb, handle);
out_unlock:
- if (group_bh)
- brelse(group_bh);
-
- if (main_bm_bh)
- brelse(main_bm_bh);
+ brelse(group_bh);
+ brelse(main_bm_bh);
ocfs2_inode_unlock(main_bm_inode, 1);