1 From: Mark Fasheh <mfasheh@suse.com>
2 Subject: ocfs2: Don't check for NULL before brelse()
5 This is pointless as brelse() already does the check.
7 Signed-off-by: Mark Fasheh
9 fs/ocfs2/alloc.c | 33 ++++++-------------
10 fs/ocfs2/aops.c | 3 +-
11 fs/ocfs2/dir.c | 24 +++++---------
12 fs/ocfs2/file.c | 9 ++---
13 fs/ocfs2/inode.c | 7 ++--
14 fs/ocfs2/ioctl.c | 3 +-
15 fs/ocfs2/journal.c | 9 ++---
16 fs/ocfs2/localalloc.c | 15 +++------
17 fs/ocfs2/namei.c | 83 +++++++++++++++---------------------------------
18 fs/ocfs2/suballoc.c | 29 ++++++----------
19 fs/ocfs2/super.c | 3 +-
20 fs/ocfs2/symlink.c | 3 +-
21 12 files changed, 74 insertions(+), 147 deletions(-)
23 Index: linux-2.6.27/fs/ocfs2/alloc.c
24 ===================================================================
25 --- linux-2.6.27.orig/fs/ocfs2/alloc.c
26 +++ linux-2.6.27/fs/ocfs2/alloc.c
27 @@ -719,8 +719,7 @@ int ocfs2_num_free_extents(struct ocfs2_
29 retval = le16_to_cpu(el->l_count) - le16_to_cpu(el->l_next_free_rec);
37 @@ -806,8 +805,7 @@ static int ocfs2_create_new_meta_bhs(str
40 for(i = 0; i < wanted; i++) {
47 @@ -1017,8 +1015,7 @@ static int ocfs2_add_branch(struct ocfs2
50 for (i = 0; i < new_blocks; i++)
52 - brelse(new_eb_bhs[i]);
53 + brelse(new_eb_bhs[i]);
57 @@ -1116,8 +1113,7 @@ static int ocfs2_shift_tree_depth(struct
67 @@ -1177,10 +1173,8 @@ static int ocfs2_find_branch_target(stru
78 status = ocfs2_read_block(osb, blkno, &bh, OCFS2_BH_CACHED,
80 @@ -1199,8 +1193,7 @@ static int ocfs2_find_branch_target(stru
82 if (le16_to_cpu(el->l_next_free_rec) <
83 le16_to_cpu(el->l_count)) {
90 @@ -1214,8 +1207,7 @@ static int ocfs2_find_branch_target(stru
92 *target_bh = lowest_bh;
100 @@ -4480,8 +4472,7 @@ int ocfs2_insert_extent(struct ocfs2_sup
101 ocfs2_extent_map_insert_rec(inode, &rec);
105 - brelse(last_eb_bh);
106 + brelse(last_eb_bh);
110 @@ -5686,8 +5677,7 @@ int ocfs2_begin_truncate_log_recovery(st
118 if (status < 0 && (*tl_copy)) {
120 @@ -7124,8 +7114,7 @@ static void ocfs2_free_truncate_context(
122 "Truncate completion has non-empty dealloc context\n");
124 - if (tc->tc_last_eb_bh)
125 - brelse(tc->tc_last_eb_bh);
126 + brelse(tc->tc_last_eb_bh);
130 Index: linux-2.6.27/fs/ocfs2/aops.c
131 ===================================================================
132 --- linux-2.6.27.orig/fs/ocfs2/aops.c
133 +++ linux-2.6.27/fs/ocfs2/aops.c
134 @@ -128,8 +128,7 @@ static int ocfs2_symlink_get_block(struc
144 Index: linux-2.6.27/fs/ocfs2/dir.c
145 ===================================================================
146 --- linux-2.6.27.orig/fs/ocfs2/dir.c
147 +++ linux-2.6.27/fs/ocfs2/dir.c
148 @@ -716,8 +716,7 @@ static int ocfs2_dir_foreach_blk_el(stru
149 for (i = ra_sectors >> (sb->s_blocksize_bits - 9);
151 tmp = ocfs2_bread(inode, ++blk, &err, 1);
158 @@ -899,10 +898,8 @@ int ocfs2_find_files_on_disk(const char
163 - brelse(*dirent_bh);
166 + brelse(*dirent_bh);
171 @@ -951,8 +948,7 @@ int ocfs2_check_dir_for_entry(struct ino
181 @@ -1127,8 +1123,7 @@ static int ocfs2_fill_new_dir_el(struct
191 @@ -1574,8 +1569,7 @@ bail:
193 ocfs2_free_alloc_context(meta_ac);
201 @@ -1702,8 +1696,7 @@ static int ocfs2_find_dir_space_el(struc
211 @@ -1762,7 +1755,6 @@ int ocfs2_prepare_dir_for_insert(struct
220 Index: linux-2.6.27/fs/ocfs2/file.c
221 ===================================================================
222 --- linux-2.6.27.orig/fs/ocfs2/file.c
223 +++ linux-2.6.27/fs/ocfs2/file.c
224 @@ -671,10 +671,8 @@ leave:
237 @@ -991,8 +989,7 @@ bail_unlock_rw:
239 ocfs2_rw_unlock(inode, 1);
247 Index: linux-2.6.27/fs/ocfs2/inode.c
248 ===================================================================
249 --- linux-2.6.27.orig/fs/ocfs2/inode.c
250 +++ linux-2.6.27/fs/ocfs2/inode.c
251 @@ -1174,10 +1174,9 @@ struct buffer_head *ocfs2_bread(struct i
265 Index: linux-2.6.27/fs/ocfs2/ioctl.c
266 ===================================================================
267 --- linux-2.6.27.orig/fs/ocfs2/ioctl.c
268 +++ linux-2.6.27/fs/ocfs2/ioctl.c
269 @@ -102,8 +102,7 @@ bail_unlock:
271 mutex_unlock(&inode->i_mutex);
279 Index: linux-2.6.27/fs/ocfs2/journal.c
280 ===================================================================
281 --- linux-2.6.27.orig/fs/ocfs2/journal.c
282 +++ linux-2.6.27/fs/ocfs2/journal.c
283 @@ -554,8 +554,7 @@ done:
286 ocfs2_inode_unlock(inode, 1);
291 OCFS2_I(inode)->ip_open_count--;
293 @@ -869,8 +868,7 @@ static int ocfs2_force_read_journal(stru
296 for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++)
303 @@ -1286,8 +1284,7 @@ done:
313 Index: linux-2.6.27/fs/ocfs2/localalloc.c
314 ===================================================================
315 --- linux-2.6.27.orig/fs/ocfs2/localalloc.c
316 +++ linux-2.6.27/fs/ocfs2/localalloc.c
317 @@ -294,8 +294,7 @@ int ocfs2_load_local_alloc(struct ocfs2_
327 @@ -411,8 +410,7 @@ out_commit:
328 ocfs2_commit_trans(osb, handle);
332 - brelse(main_bm_bh);
333 + brelse(main_bm_bh);
335 ocfs2_inode_unlock(main_bm_inode, 1);
337 @@ -488,8 +486,7 @@ bail:
346 mutex_unlock(&inode->i_mutex);
347 @@ -557,8 +554,7 @@ out_unlock:
349 mutex_unlock(&main_bm_inode->i_mutex);
352 - brelse(main_bm_bh);
353 + brelse(main_bm_bh);
357 @@ -1281,8 +1277,7 @@ bail:
359 ocfs2_commit_trans(osb, handle);
362 - brelse(main_bm_bh);
363 + brelse(main_bm_bh);
367 Index: linux-2.6.27/fs/ocfs2/namei.c
368 ===================================================================
369 --- linux-2.6.27.orig/fs/ocfs2/namei.c
370 +++ linux-2.6.27/fs/ocfs2/namei.c
371 @@ -328,14 +328,9 @@ leave:
372 if (status == -ENOSPC)
373 mlog(0, "Disk is full\n");
382 - brelse(parent_fe_bh);
385 + brelse(parent_fe_bh);
387 if ((status < 0) && inode)
389 @@ -648,12 +643,9 @@ out_unlock_inode:
391 ocfs2_inode_unlock(dir, 1);
398 - brelse(parent_fe_bh);
401 + brelse(parent_fe_bh);
405 @@ -852,17 +844,10 @@ leave:
415 - if (parent_node_bh)
416 - brelse(parent_node_bh);
418 - if (orphan_entry_bh)
419 - brelse(orphan_entry_bh);
422 + brelse(parent_node_bh);
423 + brelse(orphan_entry_bh);
427 @@ -1373,24 +1358,15 @@ bail:
434 - brelse(old_inode_bh);
436 - brelse(old_dir_bh);
438 - brelse(new_dir_bh);
443 - if (old_inode_de_bh)
444 - brelse(old_inode_de_bh);
445 - if (orphan_entry_bh)
446 - brelse(orphan_entry_bh);
447 - if (insert_entry_bh)
448 - brelse(insert_entry_bh);
450 + brelse(old_inode_bh);
451 + brelse(old_dir_bh);
452 + brelse(new_dir_bh);
455 + brelse(old_inode_de_bh);
456 + brelse(orphan_entry_bh);
457 + brelse(insert_entry_bh);
461 @@ -1493,8 +1469,7 @@ bail:
464 for(i = 0; i < blocks; i++)
471 @@ -1660,12 +1635,9 @@ bail:
473 ocfs2_inode_unlock(dir, 1);
478 - brelse(parent_fe_bh);
482 + brelse(parent_fe_bh);
485 ocfs2_free_alloc_context(inode_ac);
487 @@ -1760,8 +1732,7 @@ leave:
488 iput(orphan_dir_inode);
492 - brelse(orphan_dir_bh);
493 + brelse(orphan_dir_bh);
497 @@ -1830,8 +1801,7 @@ static int ocfs2_orphan_add(struct ocfs2
498 (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num);
502 - brelse(orphan_dir_bh);
503 + brelse(orphan_dir_bh);
507 @@ -1899,8 +1869,7 @@ int ocfs2_orphan_del(struct ocfs2_super
512 - brelse(target_de_bh);
513 + brelse(target_de_bh);
517 Index: linux-2.6.27/fs/ocfs2/suballoc.c
518 ===================================================================
519 --- linux-2.6.27.orig/fs/ocfs2/suballoc.c
520 +++ linux-2.6.27/fs/ocfs2/suballoc.c
521 @@ -130,10 +130,8 @@ void ocfs2_free_ac_resource(struct ocfs2
533 void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac)
534 @@ -401,8 +399,7 @@ bail:
536 ocfs2_free_alloc_context(ac);
544 @@ -494,8 +491,7 @@ static int ocfs2_reserve_suballoc_bits(s
554 @@ -1270,10 +1266,9 @@ static int ocfs2_search_chain(struct ocf
555 if (!bg->bg_next_group)
558 - if (prev_group_bh) {
559 - brelse(prev_group_bh);
560 - prev_group_bh = NULL;
562 + brelse(prev_group_bh);
563 + prev_group_bh = NULL;
565 next_group = le64_to_cpu(bg->bg_next_group);
566 prev_group_bh = group_bh;
568 @@ -1368,10 +1363,8 @@ static int ocfs2_search_chain(struct ocf
569 *bg_blkno = le64_to_cpu(bg->bg_blkno);
570 *bits_left = le16_to_cpu(bg->bg_free_bits_count);
575 - brelse(prev_group_bh);
577 + brelse(prev_group_bh);
581 @@ -1845,8 +1838,7 @@ int ocfs2_free_suballoc_bits(handle_t *h
591 Index: linux-2.6.27/fs/ocfs2/super.c
592 ===================================================================
593 --- linux-2.6.27.orig/fs/ocfs2/super.c
594 +++ linux-2.6.27/fs/ocfs2/super.c
595 @@ -762,8 +762,7 @@ static int ocfs2_fill_super(struct super
605 Index: linux-2.6.27/fs/ocfs2/symlink.c
606 ===================================================================
607 --- linux-2.6.27.orig/fs/ocfs2/symlink.c
608 +++ linux-2.6.27/fs/ocfs2/symlink.c
609 @@ -158,8 +158,7 @@ bail:
611 page_cache_release(page);
617 return ERR_PTR(status);