aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/suballoc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-10-17 22:25:01 -0400
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:32 -0500
commit13723d00e374c2a6d6ccb5af6de965e89c3e1b01 (patch)
tree70dcd8f3d188bf2f62e4bf4b44a0662d8cd527ca /fs/ocfs2/suballoc.c
parentffdd7a54631f07918b75e324d86713a08c11ec06 (diff)
ocfs2: Use metadata-specific ocfs2_journal_access_*() functions.
The per-metadata-type ocfs2_journal_access_*() functions hook up jbd2 commit triggers and allow us to compute metadata ecc right before the buffers are written out. This commit provides ecc for inodes, extent blocks, group descriptors, and quota blocks. It is not safe to use extened attributes and metaecc at the same time yet. The ocfs2_extent_tree and ocfs2_path abstractions in alloc.c both hide the type of block at their root. Before, it didn't matter, but now the root block must use the appropriate ocfs2_journal_access_*() function. To keep this abstract, the structures now have a pointer to the matching journal_access function and a wrapper call to call it. A few places use naked ocfs2_write_block() calls instead of adding the blocks to the journal. We make sure to calculate their checksum and ecc before the write. Since we pass around the journal_access functions. Let's typedef them in ocfs2.h. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r--fs/ocfs2/suballoc.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 78755766c329..a69628603e18 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -261,7 +261,11 @@ int ocfs2_check_group_descriptor(struct super_block *sb,
261 * local to this block. 261 * local to this block.
262 */ 262 */
263 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &gd->bg_check); 263 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &gd->bg_check);
264 if (!rc) 264 if (rc) {
265 mlog(ML_ERROR,
266 "Checksum failed for group descriptor %llu\n",
267 (unsigned long long)bh->b_blocknr);
268 } else
265 rc = ocfs2_validate_gd_self(sb, bh, 1); 269 rc = ocfs2_validate_gd_self(sb, bh, 1);
266 if (!rc) 270 if (!rc)
267 rc = ocfs2_validate_gd_parent(sb, di, bh, 1); 271 rc = ocfs2_validate_gd_parent(sb, di, bh, 1);
@@ -343,10 +347,10 @@ static int ocfs2_block_group_fill(handle_t *handle,
343 goto bail; 347 goto bail;
344 } 348 }
345 349
346 status = ocfs2_journal_access(handle, 350 status = ocfs2_journal_access_gd(handle,
347 alloc_inode, 351 alloc_inode,
348 bg_bh, 352 bg_bh,
349 OCFS2_JOURNAL_ACCESS_CREATE); 353 OCFS2_JOURNAL_ACCESS_CREATE);
350 if (status < 0) { 354 if (status < 0) {
351 mlog_errno(status); 355 mlog_errno(status);
352 goto bail; 356 goto bail;
@@ -476,8 +480,8 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
476 480
477 bg = (struct ocfs2_group_desc *) bg_bh->b_data; 481 bg = (struct ocfs2_group_desc *) bg_bh->b_data;
478 482
479 status = ocfs2_journal_access(handle, alloc_inode, 483 status = ocfs2_journal_access_di(handle, alloc_inode,
480 bh, OCFS2_JOURNAL_ACCESS_WRITE); 484 bh, OCFS2_JOURNAL_ACCESS_WRITE);
481 if (status < 0) { 485 if (status < 0) {
482 mlog_errno(status); 486 mlog_errno(status);
483 goto bail; 487 goto bail;
@@ -986,10 +990,10 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
986 if (ocfs2_is_cluster_bitmap(alloc_inode)) 990 if (ocfs2_is_cluster_bitmap(alloc_inode))
987 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 991 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
988 992
989 status = ocfs2_journal_access(handle, 993 status = ocfs2_journal_access_gd(handle,
990 alloc_inode, 994 alloc_inode,
991 group_bh, 995 group_bh,
992 journal_type); 996 journal_type);
993 if (status < 0) { 997 if (status < 0) {
994 mlog_errno(status); 998 mlog_errno(status);
995 goto bail; 999 goto bail;
@@ -1060,8 +1064,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1060 bg_ptr = le64_to_cpu(bg->bg_next_group); 1064 bg_ptr = le64_to_cpu(bg->bg_next_group);
1061 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); 1065 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group);
1062 1066
1063 status = ocfs2_journal_access(handle, alloc_inode, prev_bg_bh, 1067 status = ocfs2_journal_access_gd(handle, alloc_inode, prev_bg_bh,
1064 OCFS2_JOURNAL_ACCESS_WRITE); 1068 OCFS2_JOURNAL_ACCESS_WRITE);
1065 if (status < 0) { 1069 if (status < 0) {
1066 mlog_errno(status); 1070 mlog_errno(status);
1067 goto out_rollback; 1071 goto out_rollback;
@@ -1075,8 +1079,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1075 goto out_rollback; 1079 goto out_rollback;
1076 } 1080 }
1077 1081
1078 status = ocfs2_journal_access(handle, alloc_inode, bg_bh, 1082 status = ocfs2_journal_access_gd(handle, alloc_inode, bg_bh,
1079 OCFS2_JOURNAL_ACCESS_WRITE); 1083 OCFS2_JOURNAL_ACCESS_WRITE);
1080 if (status < 0) { 1084 if (status < 0) {
1081 mlog_errno(status); 1085 mlog_errno(status);
1082 goto out_rollback; 1086 goto out_rollback;
@@ -1090,8 +1094,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
1090 goto out_rollback; 1094 goto out_rollback;
1091 } 1095 }
1092 1096
1093 status = ocfs2_journal_access(handle, alloc_inode, fe_bh, 1097 status = ocfs2_journal_access_di(handle, alloc_inode, fe_bh,
1094 OCFS2_JOURNAL_ACCESS_WRITE); 1098 OCFS2_JOURNAL_ACCESS_WRITE);
1095 if (status < 0) { 1099 if (status < 0) {
1096 mlog_errno(status); 1100 mlog_errno(status);
1097 goto out_rollback; 1101 goto out_rollback;
@@ -1242,8 +1246,8 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,
1242 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; 1246 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
1243 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; 1247 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain;
1244 1248
1245 ret = ocfs2_journal_access(handle, inode, di_bh, 1249 ret = ocfs2_journal_access_di(handle, inode, di_bh,
1246 OCFS2_JOURNAL_ACCESS_WRITE); 1250 OCFS2_JOURNAL_ACCESS_WRITE);
1247 if (ret < 0) { 1251 if (ret < 0) {
1248 mlog_errno(ret); 1252 mlog_errno(ret);
1249 goto out; 1253 goto out;
@@ -1414,10 +1418,10 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1414 1418
1415 /* Ok, claim our bits now: set the info on dinode, chainlist 1419 /* Ok, claim our bits now: set the info on dinode, chainlist
1416 * and then the group */ 1420 * and then the group */
1417 status = ocfs2_journal_access(handle, 1421 status = ocfs2_journal_access_di(handle,
1418 alloc_inode, 1422 alloc_inode,
1419 ac->ac_bh, 1423 ac->ac_bh,
1420 OCFS2_JOURNAL_ACCESS_WRITE); 1424 OCFS2_JOURNAL_ACCESS_WRITE);
1421 if (status < 0) { 1425 if (status < 0) {
1422 mlog_errno(status); 1426 mlog_errno(status);
1423 goto bail; 1427 goto bail;
@@ -1824,8 +1828,8 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
1824 if (ocfs2_is_cluster_bitmap(alloc_inode)) 1828 if (ocfs2_is_cluster_bitmap(alloc_inode))
1825 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 1829 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
1826 1830
1827 status = ocfs2_journal_access(handle, alloc_inode, group_bh, 1831 status = ocfs2_journal_access_gd(handle, alloc_inode, group_bh,
1828 journal_type); 1832 journal_type);
1829 if (status < 0) { 1833 if (status < 0) {
1830 mlog_errno(status); 1834 mlog_errno(status);
1831 goto bail; 1835 goto bail;
@@ -1900,8 +1904,8 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1900 goto bail; 1904 goto bail;
1901 } 1905 }
1902 1906
1903 status = ocfs2_journal_access(handle, alloc_inode, alloc_bh, 1907 status = ocfs2_journal_access_di(handle, alloc_inode, alloc_bh,
1904 OCFS2_JOURNAL_ACCESS_WRITE); 1908 OCFS2_JOURNAL_ACCESS_WRITE);
1905 if (status < 0) { 1909 if (status < 0) {
1906 mlog_errno(status); 1910 mlog_errno(status);
1907 goto bail; 1911 goto bail;