Commit a81cb88b authored by Mark Fasheh's avatar Mark Fasheh
Browse files

ocfs2: Don't check for NULL before brelse()

This is pointless as brelse() already does the check.

Signed-off-by: Mark Fasheh
parent fd8351f8
Loading
Loading
Loading
Loading
+11 −22
Original line number Diff line number Diff line
@@ -719,7 +719,6 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,

	retval = le16_to_cpu(el->l_count) - le16_to_cpu(el->l_next_free_rec);
bail:
	if (eb_bh)
	brelse(eb_bh);

	mlog_exit(retval);
@@ -806,7 +805,6 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
bail:
	if (status < 0) {
		for(i = 0; i < wanted; i++) {
			if (bhs[i])
			brelse(bhs[i]);
			bhs[i] = NULL;
		}
@@ -1017,7 +1015,6 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
bail:
	if (new_eb_bhs) {
		for (i = 0; i < new_blocks; i++)
			if (new_eb_bhs[i])
			brelse(new_eb_bhs[i]);
		kfree(new_eb_bhs);
	}
@@ -1116,7 +1113,6 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
	new_eb_bh = NULL;
	status = 0;
bail:
	if (new_eb_bh)
	brelse(new_eb_bh);

	mlog_exit(status);
@@ -1177,10 +1173,8 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
			goto bail;
		}

		if (bh) {
		brelse(bh);
		bh = NULL;
		}

		status = ocfs2_read_block(osb, blkno, &bh, OCFS2_BH_CACHED,
					  inode);
@@ -1199,7 +1193,6 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,

		if (le16_to_cpu(el->l_next_free_rec) <
		    le16_to_cpu(el->l_count)) {
			if (lowest_bh)
			brelse(lowest_bh);
			lowest_bh = bh;
			get_bh(lowest_bh);
@@ -1214,7 +1207,6 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,

	*target_bh = lowest_bh;
bail:
	if (bh)
	brelse(bh);

	mlog_exit(status);
@@ -4471,7 +4463,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
		ocfs2_extent_map_insert_rec(inode, &rec);

bail:
	if (last_eb_bh)
	brelse(last_eb_bh);

	mlog_exit(status);
@@ -5677,7 +5668,6 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
bail:
	if (tl_inode)
		iput(tl_inode);
	if (tl_bh)
	brelse(tl_bh);

	if (status < 0 && (*tl_copy)) {
@@ -7115,7 +7105,6 @@ static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc)
		mlog(ML_NOTICE,
		     "Truncate completion has non-empty dealloc context\n");

	if (tc->tc_last_eb_bh)
	brelse(tc->tc_last_eb_bh);

	kfree(tc);
+1 −2
Original line number Diff line number Diff line
@@ -128,7 +128,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
	err = 0;

bail:
	if (bh)
	brelse(bh);

	mlog_exit(err);
+8 −16
Original line number Diff line number Diff line
@@ -716,7 +716,6 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
			for (i = ra_sectors >> (sb->s_blocksize_bits - 9);
			     i > 0; i--) {
				tmp = ocfs2_bread(inode, ++blk, &err, 1);
				if (tmp)
				brelse(tmp);
			}
			last_ra_blk = blk;
@@ -899,11 +898,9 @@ int ocfs2_find_files_on_disk(const char *name,
leave:
	if (status < 0) {
		*dirent = NULL;
		if (*dirent_bh) {
		brelse(*dirent_bh);
		*dirent_bh = NULL;
	}
	}

	mlog_exit(status);
	return status;
@@ -951,7 +948,6 @@ int ocfs2_check_dir_for_entry(struct inode *dir,

	ret = 0;
bail:
	if (dirent_bh)
	brelse(dirent_bh);

	mlog_exit(ret);
@@ -1127,7 +1123,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,

	status = 0;
bail:
	if (new_bh)
	brelse(new_bh);

	mlog_exit(status);
@@ -1574,7 +1569,6 @@ bail:
	if (meta_ac)
		ocfs2_free_alloc_context(meta_ac);

	if (new_bh)
	brelse(new_bh);

	mlog_exit(status);
@@ -1702,7 +1696,6 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,

	status = 0;
bail:
	if (bh)
	brelse(bh);

	mlog_exit(status);
@@ -1762,7 +1755,6 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
	*ret_de_bh = bh;
	bh = NULL;
out:
	if (bh)
	brelse(bh);
	return ret;
}
+3 −6
Original line number Diff line number Diff line
@@ -671,10 +671,8 @@ leave:
		restart_func = 0;
		goto restart_all;
	}
	if (bh) {
	brelse(bh);
	bh = NULL;
	}

	mlog_exit(status);
	return status;
@@ -991,7 +989,6 @@ bail_unlock_rw:
	if (size_change)
		ocfs2_rw_unlock(inode, 1);
bail:
	if (bh)
	brelse(bh);

	mlog_exit(status);
+3 −4
Original line number Diff line number Diff line
@@ -1174,10 +1174,9 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
	return bh;

fail:
	if (bh) {
	brelse(bh);
	bh = NULL;
	}

	*err = -EIO;
	return NULL;
}
Loading