summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/resize.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2008-01-23 18:35:31 -0800
committerMark Fasheh <mark.fasheh@oracle.com>2008-01-25 15:05:48 -0800
commit2fe5c1d7eb88830b09c863a4b5b3279dc120f3af (patch)
treec04e3249e3ae14f935ae1d090cd88833c96e6e3b /fs/ocfs2/resize.c
parent7ec373cf33533af6c50828a62f6b305c2d7fa931 (diff)
downloadlinux-2fe5c1d7eb88830b09c863a4b5b3279dc120f3af.tar.gz
linux-2fe5c1d7eb88830b09c863a4b5b3279dc120f3af.tar.bz2
linux-2fe5c1d7eb88830b09c863a4b5b3279dc120f3af.zip
ocfs2: clean up bh null checks
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>
Diffstat (limited to 'fs/ocfs2/resize.c')
-rw-r--r--fs/ocfs2/resize.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 7791309bb258..37835ffcb039 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -257,8 +257,7 @@ static void ocfs2_update_super_and_backups(struct inode *inode,
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,"
@@ -380,11 +379,8 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters)
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);
@@ -623,11 +619,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
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);