aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-10-07 17:25:16 -0400
committerMark Fasheh <mfasheh@suse.com>2008-10-13 20:02:44 -0400
commita81cb88b64a479b78c6dd5666678d50171865db8 (patch)
tree9fe0f67e30d7c70d43785827e57736ac01558c24
parentfd8351f83d413b41da956109cf429c15881886e2 (diff)
ocfs2: Don't check for NULL before brelse()
This is pointless as brelse() already does the check. Signed-off-by: Mark Fasheh
-rw-r--r--fs/ocfs2/alloc.c33
-rw-r--r--fs/ocfs2/aops.c3
-rw-r--r--fs/ocfs2/dir.c24
-rw-r--r--fs/ocfs2/file.c9
-rw-r--r--fs/ocfs2/inode.c7
-rw-r--r--fs/ocfs2/ioctl.c3
-rw-r--r--fs/ocfs2/journal.c9
-rw-r--r--fs/ocfs2/localalloc.c15
-rw-r--r--fs/ocfs2/namei.c83
-rw-r--r--fs/ocfs2/suballoc.c29
-rw-r--r--fs/ocfs2/super.c3
-rw-r--r--fs/ocfs2/symlink.c3
12 files changed, 74 insertions, 147 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index ebfe36ab2d5e..052c4cf7db95 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -719,8 +719,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
719 719
720 retval = le16_to_cpu(el->l_count) - le16_to_cpu(el->l_next_free_rec); 720 retval = le16_to_cpu(el->l_count) - le16_to_cpu(el->l_next_free_rec);
721bail: 721bail:
722 if (eb_bh) 722 brelse(eb_bh);
723 brelse(eb_bh);
724 723
725 mlog_exit(retval); 724 mlog_exit(retval);
726 return retval; 725 return retval;
@@ -806,8 +805,7 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
806bail: 805bail:
807 if (status < 0) { 806 if (status < 0) {
808 for(i = 0; i < wanted; i++) { 807 for(i = 0; i < wanted; i++) {
809 if (bhs[i]) 808 brelse(bhs[i]);
810 brelse(bhs[i]);
811 bhs[i] = NULL; 809 bhs[i] = NULL;
812 } 810 }
813 } 811 }
@@ -1017,8 +1015,7 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
1017bail: 1015bail:
1018 if (new_eb_bhs) { 1016 if (new_eb_bhs) {
1019 for (i = 0; i < new_blocks; i++) 1017 for (i = 0; i < new_blocks; i++)
1020 if (new_eb_bhs[i]) 1018 brelse(new_eb_bhs[i]);
1021 brelse(new_eb_bhs[i]);
1022 kfree(new_eb_bhs); 1019 kfree(new_eb_bhs);
1023 } 1020 }
1024 1021
@@ -1116,8 +1113,7 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1116 new_eb_bh = NULL; 1113 new_eb_bh = NULL;
1117 status = 0; 1114 status = 0;
1118bail: 1115bail:
1119 if (new_eb_bh) 1116 brelse(new_eb_bh);
1120 brelse(new_eb_bh);
1121 1117
1122 mlog_exit(status); 1118 mlog_exit(status);
1123 return status; 1119 return status;
@@ -1177,10 +1173,8 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
1177 goto bail; 1173 goto bail;
1178 } 1174 }
1179 1175
1180 if (bh) { 1176 brelse(bh);
1181 brelse(bh); 1177 bh = NULL;
1182 bh = NULL;
1183 }
1184 1178
1185 status = ocfs2_read_block(osb, blkno, &bh, OCFS2_BH_CACHED, 1179 status = ocfs2_read_block(osb, blkno, &bh, OCFS2_BH_CACHED,
1186 inode); 1180 inode);
@@ -1199,8 +1193,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
1199 1193
1200 if (le16_to_cpu(el->l_next_free_rec) < 1194 if (le16_to_cpu(el->l_next_free_rec) <
1201 le16_to_cpu(el->l_count)) { 1195 le16_to_cpu(el->l_count)) {
1202 if (lowest_bh) 1196 brelse(lowest_bh);
1203 brelse(lowest_bh);
1204 lowest_bh = bh; 1197 lowest_bh = bh;
1205 get_bh(lowest_bh); 1198 get_bh(lowest_bh);
1206 } 1199 }
@@ -1214,8 +1207,7 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
1214 1207
1215 *target_bh = lowest_bh; 1208 *target_bh = lowest_bh;
1216bail: 1209bail:
1217 if (bh) 1210 brelse(bh);
1218 brelse(bh);
1219 1211
1220 mlog_exit(status); 1212 mlog_exit(status);
1221 return status; 1213 return status;
@@ -4471,8 +4463,7 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
4471 ocfs2_extent_map_insert_rec(inode, &rec); 4463 ocfs2_extent_map_insert_rec(inode, &rec);
4472 4464
4473bail: 4465bail:
4474 if (last_eb_bh) 4466 brelse(last_eb_bh);
4475 brelse(last_eb_bh);
4476 4467
4477 mlog_exit(status); 4468 mlog_exit(status);
4478 return status; 4469 return status;
@@ -5677,8 +5668,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
5677bail: 5668bail:
5678 if (tl_inode) 5669 if (tl_inode)
5679 iput(tl_inode); 5670 iput(tl_inode);
5680 if (tl_bh) 5671 brelse(tl_bh);
5681 brelse(tl_bh);
5682 5672
5683 if (status < 0 && (*tl_copy)) { 5673 if (status < 0 && (*tl_copy)) {
5684 kfree(*tl_copy); 5674 kfree(*tl_copy);
@@ -7115,8 +7105,7 @@ static void ocfs2_free_truncate_context(struct ocfs2_truncate_context *tc)
7115 mlog(ML_NOTICE, 7105 mlog(ML_NOTICE,
7116 "Truncate completion has non-empty dealloc context\n"); 7106 "Truncate completion has non-empty dealloc context\n");
7117 7107
7118 if (tc->tc_last_eb_bh) 7108 brelse(tc->tc_last_eb_bh);
7119 brelse(tc->tc_last_eb_bh);
7120 7109
7121 kfree(tc); 7110 kfree(tc);
7122} 7111}
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index de179054a74b..98e16fb49e4b 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -128,8 +128,7 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
128 err = 0; 128 err = 0;
129 129
130bail: 130bail:
131 if (bh) 131 brelse(bh);
132 brelse(bh);
133 132
134 mlog_exit(err); 133 mlog_exit(err);
135 return err; 134 return err;
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 167e6c96277d..3614651dcdb2 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -716,8 +716,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
716 for (i = ra_sectors >> (sb->s_blocksize_bits - 9); 716 for (i = ra_sectors >> (sb->s_blocksize_bits - 9);
717 i > 0; i--) { 717 i > 0; i--) {
718 tmp = ocfs2_bread(inode, ++blk, &err, 1); 718 tmp = ocfs2_bread(inode, ++blk, &err, 1);
719 if (tmp) 719 brelse(tmp);
720 brelse(tmp);
721 } 720 }
722 last_ra_blk = blk; 721 last_ra_blk = blk;
723 ra_sectors = 8; 722 ra_sectors = 8;
@@ -899,10 +898,8 @@ int ocfs2_find_files_on_disk(const char *name,
899leave: 898leave:
900 if (status < 0) { 899 if (status < 0) {
901 *dirent = NULL; 900 *dirent = NULL;
902 if (*dirent_bh) { 901 brelse(*dirent_bh);
903 brelse(*dirent_bh); 902 *dirent_bh = NULL;
904 *dirent_bh = NULL;
905 }
906 } 903 }
907 904
908 mlog_exit(status); 905 mlog_exit(status);
@@ -951,8 +948,7 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
951 948
952 ret = 0; 949 ret = 0;
953bail: 950bail:
954 if (dirent_bh) 951 brelse(dirent_bh);
955 brelse(dirent_bh);
956 952
957 mlog_exit(ret); 953 mlog_exit(ret);
958 return ret; 954 return ret;
@@ -1127,8 +1123,7 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
1127 1123
1128 status = 0; 1124 status = 0;
1129bail: 1125bail:
1130 if (new_bh) 1126 brelse(new_bh);
1131 brelse(new_bh);
1132 1127
1133 mlog_exit(status); 1128 mlog_exit(status);
1134 return status; 1129 return status;
@@ -1574,8 +1569,7 @@ bail:
1574 if (meta_ac) 1569 if (meta_ac)
1575 ocfs2_free_alloc_context(meta_ac); 1570 ocfs2_free_alloc_context(meta_ac);
1576 1571
1577 if (new_bh) 1572 brelse(new_bh);
1578 brelse(new_bh);
1579 1573
1580 mlog_exit(status); 1574 mlog_exit(status);
1581 return status; 1575 return status;
@@ -1702,8 +1696,7 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
1702 1696
1703 status = 0; 1697 status = 0;
1704bail: 1698bail:
1705 if (bh) 1699 brelse(bh);
1706 brelse(bh);
1707 1700
1708 mlog_exit(status); 1701 mlog_exit(status);
1709 return status; 1702 return status;
@@ -1762,7 +1755,6 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
1762 *ret_de_bh = bh; 1755 *ret_de_bh = bh;
1763 bh = NULL; 1756 bh = NULL;
1764out: 1757out:
1765 if (bh) 1758 brelse(bh);
1766 brelse(bh);
1767 return ret; 1759 return ret;
1768} 1760}
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index c95318bc00cb..408d5a66591d 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -671,10 +671,8 @@ leave:
671 restart_func = 0; 671 restart_func = 0;
672 goto restart_all; 672 goto restart_all;
673 } 673 }
674 if (bh) { 674 brelse(bh);
675 brelse(bh); 675 bh = NULL;
676 bh = NULL;
677 }
678 676
679 mlog_exit(status); 677 mlog_exit(status);
680 return status; 678 return status;
@@ -991,8 +989,7 @@ bail_unlock_rw:
991 if (size_change) 989 if (size_change)
992 ocfs2_rw_unlock(inode, 1); 990 ocfs2_rw_unlock(inode, 1);
993bail: 991bail:
994 if (bh) 992 brelse(bh);
995 brelse(bh);
996 993
997 mlog_exit(status); 994 mlog_exit(status);
998 return status; 995 return status;
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 9d92c859ac94..05ad1186a167 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -1174,10 +1174,9 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
1174 return bh; 1174 return bh;
1175 1175
1176fail: 1176fail:
1177 if (bh) { 1177 brelse(bh);
1178 brelse(bh); 1178 bh = NULL;
1179 bh = NULL; 1179
1180 }
1181 *err = -EIO; 1180 *err = -EIO;
1182 return NULL; 1181 return NULL;
1183} 1182}
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 7b142f0ce995..9fcd36dcc9a0 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -102,8 +102,7 @@ bail_unlock:
102bail: 102bail:
103 mutex_unlock(&inode->i_mutex); 103 mutex_unlock(&inode->i_mutex);
104 104
105 if (bh) 105 brelse(bh);
106 brelse(bh);
107 106
108 mlog_exit(status); 107 mlog_exit(status);
109 return status; 108 return status;
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 373d94366a4c..562ba652593e 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -554,8 +554,7 @@ done:
554 if (status < 0) { 554 if (status < 0) {
555 if (inode_lock) 555 if (inode_lock)
556 ocfs2_inode_unlock(inode, 1); 556 ocfs2_inode_unlock(inode, 1);
557 if (bh != NULL) 557 brelse(bh);
558 brelse(bh);
559 if (inode) { 558 if (inode) {
560 OCFS2_I(inode)->ip_open_count--; 559 OCFS2_I(inode)->ip_open_count--;
561 iput(inode); 560 iput(inode);
@@ -869,8 +868,7 @@ static int ocfs2_force_read_journal(struct inode *inode)
869 868
870bail: 869bail:
871 for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++) 870 for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++)
872 if (bhs[i]) 871 brelse(bhs[i]);
873 brelse(bhs[i]);
874 mlog_exit(status); 872 mlog_exit(status);
875 return status; 873 return status;
876} 874}
@@ -1286,8 +1284,7 @@ done:
1286 if (inode) 1284 if (inode)
1287 iput(inode); 1285 iput(inode);
1288 1286
1289 if (bh) 1287 brelse(bh);
1290 brelse(bh);
1291 1288
1292 mlog_exit(status); 1289 mlog_exit(status);
1293 return status; 1290 return status;
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index b1c634d676a0..1c4f0645fb37 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -294,8 +294,7 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
294 294
295bail: 295bail:
296 if (status < 0) 296 if (status < 0)
297 if (alloc_bh) 297 brelse(alloc_bh);
298 brelse(alloc_bh);
299 if (inode) 298 if (inode)
300 iput(inode); 299 iput(inode);
301 300
@@ -411,8 +410,7 @@ out_commit:
411 ocfs2_commit_trans(osb, handle); 410 ocfs2_commit_trans(osb, handle);
412 411
413out_unlock: 412out_unlock:
414 if (main_bm_bh) 413 brelse(main_bm_bh);
415 brelse(main_bm_bh);
416 414
417 ocfs2_inode_unlock(main_bm_inode, 1); 415 ocfs2_inode_unlock(main_bm_inode, 1);
418 416
@@ -488,8 +486,7 @@ bail:
488 *alloc_copy = NULL; 486 *alloc_copy = NULL;
489 } 487 }
490 488
491 if (alloc_bh) 489 brelse(alloc_bh);
492 brelse(alloc_bh);
493 490
494 if (inode) { 491 if (inode) {
495 mutex_unlock(&inode->i_mutex); 492 mutex_unlock(&inode->i_mutex);
@@ -557,8 +554,7 @@ out_unlock:
557out_mutex: 554out_mutex:
558 mutex_unlock(&main_bm_inode->i_mutex); 555 mutex_unlock(&main_bm_inode->i_mutex);
559 556
560 if (main_bm_bh) 557 brelse(main_bm_bh);
561 brelse(main_bm_bh);
562 558
563 iput(main_bm_inode); 559 iput(main_bm_inode);
564 560
@@ -1281,8 +1277,7 @@ bail:
1281 if (handle) 1277 if (handle)
1282 ocfs2_commit_trans(osb, handle); 1278 ocfs2_commit_trans(osb, handle);
1283 1279
1284 if (main_bm_bh) 1280 brelse(main_bm_bh);
1285 brelse(main_bm_bh);
1286 1281
1287 if (main_bm_inode) 1282 if (main_bm_inode)
1288 iput(main_bm_inode); 1283 iput(main_bm_inode);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 76d1d1314308..7d0dd5c95eb3 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -328,14 +328,9 @@ leave:
328 if (status == -ENOSPC) 328 if (status == -ENOSPC)
329 mlog(0, "Disk is full\n"); 329 mlog(0, "Disk is full\n");
330 330
331 if (new_fe_bh) 331 brelse(new_fe_bh);
332 brelse(new_fe_bh); 332 brelse(de_bh);
333 333 brelse(parent_fe_bh);
334 if (de_bh)
335 brelse(de_bh);
336
337 if (parent_fe_bh)
338 brelse(parent_fe_bh);
339 334
340 if ((status < 0) && inode) 335 if ((status < 0) && inode)
341 iput(inode); 336 iput(inode);
@@ -648,12 +643,9 @@ out_unlock_inode:
648out: 643out:
649 ocfs2_inode_unlock(dir, 1); 644 ocfs2_inode_unlock(dir, 1);
650 645
651 if (de_bh) 646 brelse(de_bh);
652 brelse(de_bh); 647 brelse(fe_bh);
653 if (fe_bh) 648 brelse(parent_fe_bh);
654 brelse(fe_bh);
655 if (parent_fe_bh)
656 brelse(parent_fe_bh);
657 649
658 mlog_exit(err); 650 mlog_exit(err);
659 651
@@ -852,17 +844,10 @@ leave:
852 iput(orphan_dir); 844 iput(orphan_dir);
853 } 845 }
854 846
855 if (fe_bh) 847 brelse(fe_bh);
856 brelse(fe_bh); 848 brelse(dirent_bh);
857 849 brelse(parent_node_bh);
858 if (dirent_bh) 850 brelse(orphan_entry_bh);
859 brelse(dirent_bh);
860
861 if (parent_node_bh)
862 brelse(parent_node_bh);
863
864 if (orphan_entry_bh)
865 brelse(orphan_entry_bh);
866 851
867 mlog_exit(status); 852 mlog_exit(status);
868 853
@@ -1373,24 +1358,15 @@ bail:
1373 1358
1374 if (new_inode) 1359 if (new_inode)
1375 iput(new_inode); 1360 iput(new_inode);
1376 if (newfe_bh) 1361 brelse(newfe_bh);
1377 brelse(newfe_bh); 1362 brelse(old_inode_bh);
1378 if (old_inode_bh) 1363 brelse(old_dir_bh);
1379 brelse(old_inode_bh); 1364 brelse(new_dir_bh);
1380 if (old_dir_bh) 1365 brelse(new_de_bh);
1381 brelse(old_dir_bh); 1366 brelse(old_de_bh);
1382 if (new_dir_bh) 1367 brelse(old_inode_de_bh);
1383 brelse(new_dir_bh); 1368 brelse(orphan_entry_bh);
1384 if (new_de_bh) 1369 brelse(insert_entry_bh);
1385 brelse(new_de_bh);
1386 if (old_de_bh)
1387 brelse(old_de_bh);
1388 if (old_inode_de_bh)
1389 brelse(old_inode_de_bh);
1390 if (orphan_entry_bh)
1391 brelse(orphan_entry_bh);
1392 if (insert_entry_bh)
1393 brelse(insert_entry_bh);
1394 1370
1395 mlog_exit(status); 1371 mlog_exit(status);
1396 1372
@@ -1493,8 +1469,7 @@ bail:
1493 1469
1494 if (bhs) { 1470 if (bhs) {
1495 for(i = 0; i < blocks; i++) 1471 for(i = 0; i < blocks; i++)
1496 if (bhs[i]) 1472 brelse(bhs[i]);
1497 brelse(bhs[i]);
1498 kfree(bhs); 1473 kfree(bhs);
1499 } 1474 }
1500 1475
@@ -1660,12 +1635,9 @@ bail:
1660 1635
1661 ocfs2_inode_unlock(dir, 1); 1636 ocfs2_inode_unlock(dir, 1);
1662 1637
1663 if (new_fe_bh) 1638 brelse(new_fe_bh);
1664 brelse(new_fe_bh); 1639 brelse(parent_fe_bh);
1665 if (parent_fe_bh) 1640 brelse(de_bh);
1666 brelse(parent_fe_bh);
1667 if (de_bh)
1668 brelse(de_bh);
1669 if (inode_ac) 1641 if (inode_ac)
1670 ocfs2_free_alloc_context(inode_ac); 1642 ocfs2_free_alloc_context(inode_ac);
1671 if (data_ac) 1643 if (data_ac)
@@ -1760,8 +1732,7 @@ leave:
1760 iput(orphan_dir_inode); 1732 iput(orphan_dir_inode);
1761 } 1733 }
1762 1734
1763 if (orphan_dir_bh) 1735 brelse(orphan_dir_bh);
1764 brelse(orphan_dir_bh);
1765 1736
1766 mlog_exit(status); 1737 mlog_exit(status);
1767 return status; 1738 return status;
@@ -1830,8 +1801,7 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
1830 (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num); 1801 (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num);
1831 1802
1832leave: 1803leave:
1833 if (orphan_dir_bh) 1804 brelse(orphan_dir_bh);
1834 brelse(orphan_dir_bh);
1835 1805
1836 mlog_exit(status); 1806 mlog_exit(status);
1837 return status; 1807 return status;
@@ -1899,8 +1869,7 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
1899 } 1869 }
1900 1870
1901leave: 1871leave:
1902 if (target_de_bh) 1872 brelse(target_de_bh);
1903 brelse(target_de_bh);
1904 1873
1905 mlog_exit(status); 1874 mlog_exit(status);
1906 return status; 1875 return status;
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index d7a6f928c317..08d8844a3c2d 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -130,10 +130,8 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac)
130 iput(inode); 130 iput(inode);
131 ac->ac_inode = NULL; 131 ac->ac_inode = NULL;
132 } 132 }
133 if (ac->ac_bh) { 133 brelse(ac->ac_bh);
134 brelse(ac->ac_bh); 134 ac->ac_bh = NULL;
135 ac->ac_bh = NULL;
136 }
137} 135}
138 136
139void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac) 137void ocfs2_free_alloc_context(struct ocfs2_alloc_context *ac)
@@ -401,8 +399,7 @@ bail:
401 if (ac) 399 if (ac)
402 ocfs2_free_alloc_context(ac); 400 ocfs2_free_alloc_context(ac);
403 401
404 if (bg_bh) 402 brelse(bg_bh);
405 brelse(bg_bh);
406 403
407 mlog_exit(status); 404 mlog_exit(status);
408 return status; 405 return status;
@@ -494,8 +491,7 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
494 get_bh(bh); 491 get_bh(bh);
495 ac->ac_bh = bh; 492 ac->ac_bh = bh;
496bail: 493bail:
497 if (bh) 494 brelse(bh);
498 brelse(bh);
499 495
500 mlog_exit(status); 496 mlog_exit(status);
501 return status; 497 return status;
@@ -1269,10 +1265,10 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1269 &tmp_bits)) == -ENOSPC) { 1265 &tmp_bits)) == -ENOSPC) {
1270 if (!bg->bg_next_group) 1266 if (!bg->bg_next_group)
1271 break; 1267 break;
1272 if (prev_group_bh) { 1268
1273 brelse(prev_group_bh); 1269 brelse(prev_group_bh);
1274 prev_group_bh = NULL; 1270 prev_group_bh = NULL;
1275 } 1271
1276 next_group = le64_to_cpu(bg->bg_next_group); 1272 next_group = le64_to_cpu(bg->bg_next_group);
1277 prev_group_bh = group_bh; 1273 prev_group_bh = group_bh;
1278 group_bh = NULL; 1274 group_bh = NULL;
@@ -1367,10 +1363,8 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1367 *bg_blkno = le64_to_cpu(bg->bg_blkno); 1363 *bg_blkno = le64_to_cpu(bg->bg_blkno);
1368 *bits_left = le16_to_cpu(bg->bg_free_bits_count); 1364 *bits_left = le16_to_cpu(bg->bg_free_bits_count);
1369bail: 1365bail:
1370 if (group_bh) 1366 brelse(group_bh);
1371 brelse(group_bh); 1367 brelse(prev_group_bh);
1372 if (prev_group_bh)
1373 brelse(prev_group_bh);
1374 1368
1375 mlog_exit(status); 1369 mlog_exit(status);
1376 return status; 1370 return status;
@@ -1844,8 +1838,7 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1844 } 1838 }
1845 1839
1846bail: 1840bail:
1847 if (group_bh) 1841 brelse(group_bh);
1848 brelse(group_bh);
1849 1842
1850 mlog_exit(status); 1843 mlog_exit(status);
1851 return status; 1844 return status;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index d2027cec8f3b..304b63ac78cf 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -762,8 +762,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
762 return status; 762 return status;
763 763
764read_super_error: 764read_super_error:
765 if (bh != NULL) 765 brelse(bh);
766 brelse(bh);
767 766
768 if (inode) 767 if (inode)
769 iput(inode); 768 iput(inode);
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index 8c5879c7f846..c6c94b55774f 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -158,8 +158,7 @@ bail:
158 kunmap(page); 158 kunmap(page);
159 page_cache_release(page); 159 page_cache_release(page);
160 } 160 }
161 if (bh) 161 brelse(bh);
162 brelse(bh);
163 162
164 return ERR_PTR(status); 163 return ERR_PTR(status);
165} 164}