diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2008-01-23 21:35:31 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2008-01-25 18:05:48 -0500 |
commit | 2fe5c1d7eb88830b09c863a4b5b3279dc120f3af (patch) | |
tree | c04e3249e3ae14f935ae1d090cd88833c96e6e3b /fs/ocfs2/resize.c | |
parent | 7ec373cf33533af6c50828a62f6b305c2d7fa931 (diff) |
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.c | 17 |
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, | |||
257 | ret = update_backups(inode, clusters, super_bh->b_data); | 257 | ret = update_backups(inode, clusters, super_bh->b_data); |
258 | 258 | ||
259 | out: | 259 | out: |
260 | if (super_bh) | 260 | brelse(super_bh); |
261 | brelse(super_bh); | ||
262 | if (ret) | 261 | if (ret) |
263 | printk(KERN_WARNING "ocfs2: Failed to update super blocks on %s" | 262 | printk(KERN_WARNING "ocfs2: Failed to update super blocks on %s" |
264 | " during fs resize. This condition is not fatal," | 263 | " during fs resize. This condition is not fatal," |
@@ -380,11 +379,8 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters) | |||
380 | out_commit: | 379 | out_commit: |
381 | ocfs2_commit_trans(osb, handle); | 380 | ocfs2_commit_trans(osb, handle); |
382 | out_unlock: | 381 | out_unlock: |
383 | if (group_bh) | 382 | brelse(group_bh); |
384 | brelse(group_bh); | 383 | brelse(main_bm_bh); |
385 | |||
386 | if (main_bm_bh) | ||
387 | brelse(main_bm_bh); | ||
388 | 384 | ||
389 | ocfs2_inode_unlock(main_bm_inode, 1); | 385 | ocfs2_inode_unlock(main_bm_inode, 1); |
390 | 386 | ||
@@ -623,11 +619,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
623 | out_commit: | 619 | out_commit: |
624 | ocfs2_commit_trans(osb, handle); | 620 | ocfs2_commit_trans(osb, handle); |
625 | out_unlock: | 621 | out_unlock: |
626 | if (group_bh) | 622 | brelse(group_bh); |
627 | brelse(group_bh); | 623 | brelse(main_bm_bh); |
628 | |||
629 | if (main_bm_bh) | ||
630 | brelse(main_bm_bh); | ||
631 | 624 | ||
632 | ocfs2_inode_unlock(main_bm_inode, 1); | 625 | ocfs2_inode_unlock(main_bm_inode, 1); |
633 | 626 | ||