Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2fe5c1d7eb88830b09c863a4b5b3279dc120f3af
Commit:     2fe5c1d7eb88830b09c863a4b5b3279dc120f3af
Parent:     7ec373cf33533af6c50828a62f6b305c2d7fa931
Author:     Mark Fasheh <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 23 18:35:31 2008 -0800
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 15:05:48 2008 -0800

    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 <[EMAIL PROTECTED]>
---
 fs/ocfs2/buffer_head_io.c |    6 +++---
 fs/ocfs2/resize.c         |   17 +++++------------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index 31aa61d..f136639 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -79,7 +79,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct 
buffer_head *bh,
                 * 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);
@@ -256,7 +256,7 @@ int ocfs2_read_blocks(struct ocfs2_super *osb, u64 block, 
int nr,
                                 * for this bh as it's not marked locally
                                 * uptodate. */
                                status = -EIO;
-                               brelse(bh);
+                               put_bh(bh);
                                bhs[i] = NULL;
                                continue;
                        }
@@ -334,7 +334,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
 
        if (!buffer_uptodate(bh)) {
                ret = -EIO;
-               brelse(bh);
+               put_bh(bh);
        }
 
 out:
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index 7791309..37835ff 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);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to