aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/suballoc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-03-19 17:13:52 -0400
committerJoel Becker <joel.becker@oracle.com>2010-05-05 21:17:29 -0400
commitec20cec7a351584ca6c70ead012e73d61f9a8e04 (patch)
tree39af308ae07ab168313bb50ced1bb1ae7ef7e6a3 /fs/ocfs2/suballoc.c
parentb4414eea0e7b9c134262c801a87e338bf675962c (diff)
ocfs2: Make ocfs2_journal_dirty() void.
jbd[2]_journal_dirty_metadata() only returns 0. It's been returning 0 since before the kernel moved to git. There is no point in checking this error. ocfs2_journal_dirty() has been faithfully returning the status since the beginning. All over ocfs2, we have blocks of code checking this can't fail status. In the past few years, we've tried to avoid adding these checks, because they are pointless. But anyone who looks at our code assumes they are needed. Finally, ocfs2_journal_dirty() is made a void function. All error checking is removed from other files. We'll BUG_ON() the status of jbd2_journal_dirty_metadata() just in case they change it someday. They won't. Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r--fs/ocfs2/suballoc.c64
1 files changed, 10 insertions, 54 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 19ba00f28547..d4babfba4f04 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -369,9 +369,7 @@ static int ocfs2_block_group_fill(handle_t *handle,
369 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap); 369 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap);
370 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1); 370 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1);
371 371
372 status = ocfs2_journal_dirty(handle, bg_bh); 372 ocfs2_journal_dirty(handle, bg_bh);
373 if (status < 0)
374 mlog_errno(status);
375 373
376 /* There is no need to zero out or otherwise initialize the 374 /* There is no need to zero out or otherwise initialize the
377 * other blocks in a group - All valid FS metadata in a block 375 * other blocks in a group - All valid FS metadata in a block
@@ -506,11 +504,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
506 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits)); 504 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits));
507 le32_add_cpu(&fe->i_clusters, le16_to_cpu(cl->cl_cpg)); 505 le32_add_cpu(&fe->i_clusters, le16_to_cpu(cl->cl_cpg));
508 506
509 status = ocfs2_journal_dirty(handle, bh); 507 ocfs2_journal_dirty(handle, bh);
510 if (status < 0) {
511 mlog_errno(status);
512 goto bail;
513 }
514 508
515 spin_lock(&OCFS2_I(alloc_inode)->ip_lock); 509 spin_lock(&OCFS2_I(alloc_inode)->ip_lock);
516 OCFS2_I(alloc_inode)->ip_clusters = le32_to_cpu(fe->i_clusters); 510 OCFS2_I(alloc_inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
@@ -1129,16 +1123,10 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
1129 } 1123 }
1130 1124
1131 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); 1125 le16_add_cpu(&bg->bg_free_bits_count, -num_bits);
1132
1133 while(num_bits--) 1126 while(num_bits--)
1134 ocfs2_set_bit(bit_off++, bitmap); 1127 ocfs2_set_bit(bit_off++, bitmap);
1135 1128
1136 status = ocfs2_journal_dirty(handle, 1129 ocfs2_journal_dirty(handle, group_bh);
1137 group_bh);
1138 if (status < 0) {
1139 mlog_errno(status);
1140 goto bail;
1141 }
1142 1130
1143bail: 1131bail:
1144 mlog_exit(status); 1132 mlog_exit(status);
@@ -1202,12 +1190,7 @@ static int ocfs2_relink_block_group(handle_t *handle,
1202 } 1190 }
1203 1191
1204 prev_bg->bg_next_group = bg->bg_next_group; 1192 prev_bg->bg_next_group = bg->bg_next_group;
1205 1193 ocfs2_journal_dirty(handle, prev_bg_bh);
1206 status = ocfs2_journal_dirty(handle, prev_bg_bh);
1207 if (status < 0) {
1208 mlog_errno(status);
1209 goto out_rollback;
1210 }
1211 1194
1212 status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), 1195 status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode),
1213 bg_bh, OCFS2_JOURNAL_ACCESS_WRITE); 1196 bg_bh, OCFS2_JOURNAL_ACCESS_WRITE);
@@ -1217,12 +1200,7 @@ static int ocfs2_relink_block_group(handle_t *handle,
1217 } 1200 }
1218 1201
1219 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; 1202 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno;
1220 1203 ocfs2_journal_dirty(handle, bg_bh);
1221 status = ocfs2_journal_dirty(handle, bg_bh);
1222 if (status < 0) {
1223 mlog_errno(status);
1224 goto out_rollback;
1225 }
1226 1204
1227 status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode), 1205 status = ocfs2_journal_access_di(handle, INODE_CACHE(alloc_inode),
1228 fe_bh, OCFS2_JOURNAL_ACCESS_WRITE); 1206 fe_bh, OCFS2_JOURNAL_ACCESS_WRITE);
@@ -1232,14 +1210,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1232 } 1210 }
1233 1211
1234 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; 1212 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno;
1213 ocfs2_journal_dirty(handle, fe_bh);
1235 1214
1236 status = ocfs2_journal_dirty(handle, fe_bh);
1237 if (status < 0) {
1238 mlog_errno(status);
1239 goto out_rollback;
1240 }
1241
1242 status = 0;
1243out_rollback: 1215out_rollback:
1244 if (status < 0) { 1216 if (status < 0) {
1245 fe->id2.i_chain.cl_recs[chain].c_blkno = cpu_to_le64(fe_ptr); 1217 fe->id2.i_chain.cl_recs[chain].c_blkno = cpu_to_le64(fe_ptr);
@@ -1386,10 +1358,7 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,
1386 tmp_used = le32_to_cpu(di->id1.bitmap1.i_used); 1358 tmp_used = le32_to_cpu(di->id1.bitmap1.i_used);
1387 di->id1.bitmap1.i_used = cpu_to_le32(num_bits + tmp_used); 1359 di->id1.bitmap1.i_used = cpu_to_le32(num_bits + tmp_used);
1388 le32_add_cpu(&cl->cl_recs[chain].c_free, -num_bits); 1360 le32_add_cpu(&cl->cl_recs[chain].c_free, -num_bits);
1389 1361 ocfs2_journal_dirty(handle, di_bh);
1390 ret = ocfs2_journal_dirty(handle, di_bh);
1391 if (ret < 0)
1392 mlog_errno(ret);
1393 1362
1394out: 1363out:
1395 return ret; 1364 return ret;
@@ -1560,13 +1529,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1560 tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used); 1529 tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used);
1561 fe->id1.bitmap1.i_used = cpu_to_le32(*num_bits + tmp_used); 1530 fe->id1.bitmap1.i_used = cpu_to_le32(*num_bits + tmp_used);
1562 le32_add_cpu(&cl->cl_recs[chain].c_free, -(*num_bits)); 1531 le32_add_cpu(&cl->cl_recs[chain].c_free, -(*num_bits));
1563 1532 ocfs2_journal_dirty(handle, ac->ac_bh);
1564 status = ocfs2_journal_dirty(handle,
1565 ac->ac_bh);
1566 if (status < 0) {
1567 mlog_errno(status);
1568 goto bail;
1569 }
1570 1533
1571 status = ocfs2_block_group_set_bits(handle, 1534 status = ocfs2_block_group_set_bits(handle,
1572 alloc_inode, 1535 alloc_inode,
@@ -2023,9 +1986,7 @@ static int ocfs2_block_group_clear_bits(handle_t *handle,
2023 if (undo_fn) 1986 if (undo_fn)
2024 jbd_unlock_bh_state(group_bh); 1987 jbd_unlock_bh_state(group_bh);
2025 1988
2026 status = ocfs2_journal_dirty(handle, group_bh); 1989 ocfs2_journal_dirty(handle, group_bh);
2027 if (status < 0)
2028 mlog_errno(status);
2029bail: 1990bail:
2030 return status; 1991 return status;
2031} 1992}
@@ -2092,12 +2053,7 @@ static int _ocfs2_free_suballoc_bits(handle_t *handle,
2092 count); 2053 count);
2093 tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used); 2054 tmp_used = le32_to_cpu(fe->id1.bitmap1.i_used);
2094 fe->id1.bitmap1.i_used = cpu_to_le32(tmp_used - count); 2055 fe->id1.bitmap1.i_used = cpu_to_le32(tmp_used - count);
2095 2056 ocfs2_journal_dirty(handle, alloc_bh);
2096 status = ocfs2_journal_dirty(handle, alloc_bh);
2097 if (status < 0) {
2098 mlog_errno(status);
2099 goto bail;
2100 }
2101 2057
2102bail: 2058bail:
2103 brelse(group_bh); 2059 brelse(group_bh);