diff options
-rw-r--r-- | fs/ocfs2/alloc.c | 233 | ||||
-rw-r--r-- | fs/ocfs2/alloc.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 48 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 17 | ||||
-rw-r--r-- | fs/ocfs2/journal.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/journal.h | 3 | ||||
-rw-r--r-- | fs/ocfs2/localalloc.c | 18 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 38 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 4 | ||||
-rw-r--r-- | fs/ocfs2/quota_global.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/quota_local.c | 18 | ||||
-rw-r--r-- | fs/ocfs2/resize.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 58 |
15 files changed, 280 insertions, 206 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index c22ff49b5e33..6e58fd557e5b 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -298,11 +298,13 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = { | |||
298 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, | 298 | static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, |
299 | struct inode *inode, | 299 | struct inode *inode, |
300 | struct buffer_head *bh, | 300 | struct buffer_head *bh, |
301 | ocfs2_journal_access_func access, | ||
301 | void *obj, | 302 | void *obj, |
302 | struct ocfs2_extent_tree_operations *ops) | 303 | struct ocfs2_extent_tree_operations *ops) |
303 | { | 304 | { |
304 | et->et_ops = ops; | 305 | et->et_ops = ops; |
305 | et->et_root_bh = bh; | 306 | et->et_root_bh = bh; |
307 | et->et_root_journal_access = access; | ||
306 | if (!obj) | 308 | if (!obj) |
307 | obj = (void *)bh->b_data; | 309 | obj = (void *)bh->b_data; |
308 | et->et_object = obj; | 310 | et->et_object = obj; |
@@ -318,15 +320,16 @@ void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, | |||
318 | struct inode *inode, | 320 | struct inode *inode, |
319 | struct buffer_head *bh) | 321 | struct buffer_head *bh) |
320 | { | 322 | { |
321 | __ocfs2_init_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops); | 323 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_di, |
324 | NULL, &ocfs2_dinode_et_ops); | ||
322 | } | 325 | } |
323 | 326 | ||
324 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, | 327 | void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, |
325 | struct inode *inode, | 328 | struct inode *inode, |
326 | struct buffer_head *bh) | 329 | struct buffer_head *bh) |
327 | { | 330 | { |
328 | __ocfs2_init_extent_tree(et, inode, bh, NULL, | 331 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_xb, |
329 | &ocfs2_xattr_tree_et_ops); | 332 | NULL, &ocfs2_xattr_tree_et_ops); |
330 | } | 333 | } |
331 | 334 | ||
332 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, | 335 | void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, |
@@ -334,7 +337,7 @@ void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, | |||
334 | struct buffer_head *bh, | 337 | struct buffer_head *bh, |
335 | struct ocfs2_xattr_value_root *xv) | 338 | struct ocfs2_xattr_value_root *xv) |
336 | { | 339 | { |
337 | __ocfs2_init_extent_tree(et, inode, bh, xv, | 340 | __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access, xv, |
338 | &ocfs2_xattr_value_et_ops); | 341 | &ocfs2_xattr_value_et_ops); |
339 | } | 342 | } |
340 | 343 | ||
@@ -356,6 +359,15 @@ static inline void ocfs2_et_update_clusters(struct inode *inode, | |||
356 | et->et_ops->eo_update_clusters(inode, et, clusters); | 359 | et->et_ops->eo_update_clusters(inode, et, clusters); |
357 | } | 360 | } |
358 | 361 | ||
362 | static inline int ocfs2_et_root_journal_access(handle_t *handle, | ||
363 | struct inode *inode, | ||
364 | struct ocfs2_extent_tree *et, | ||
365 | int type) | ||
366 | { | ||
367 | return et->et_root_journal_access(handle, inode, et->et_root_bh, | ||
368 | type); | ||
369 | } | ||
370 | |||
359 | static inline int ocfs2_et_insert_check(struct inode *inode, | 371 | static inline int ocfs2_et_insert_check(struct inode *inode, |
360 | struct ocfs2_extent_tree *et, | 372 | struct ocfs2_extent_tree *et, |
361 | struct ocfs2_extent_rec *rec) | 373 | struct ocfs2_extent_rec *rec) |
@@ -396,12 +408,14 @@ struct ocfs2_path_item { | |||
396 | #define OCFS2_MAX_PATH_DEPTH 5 | 408 | #define OCFS2_MAX_PATH_DEPTH 5 |
397 | 409 | ||
398 | struct ocfs2_path { | 410 | struct ocfs2_path { |
399 | int p_tree_depth; | 411 | int p_tree_depth; |
400 | struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH]; | 412 | ocfs2_journal_access_func p_root_access; |
413 | struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH]; | ||
401 | }; | 414 | }; |
402 | 415 | ||
403 | #define path_root_bh(_path) ((_path)->p_node[0].bh) | 416 | #define path_root_bh(_path) ((_path)->p_node[0].bh) |
404 | #define path_root_el(_path) ((_path)->p_node[0].el) | 417 | #define path_root_el(_path) ((_path)->p_node[0].el) |
418 | #define path_root_access(_path)((_path)->p_root_access) | ||
405 | #define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh) | 419 | #define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh) |
406 | #define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el) | 420 | #define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el) |
407 | #define path_num_items(_path) ((_path)->p_tree_depth + 1) | 421 | #define path_num_items(_path) ((_path)->p_tree_depth + 1) |
@@ -434,6 +448,8 @@ static void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root) | |||
434 | */ | 448 | */ |
435 | if (keep_root) | 449 | if (keep_root) |
436 | depth = le16_to_cpu(path_root_el(path)->l_tree_depth); | 450 | depth = le16_to_cpu(path_root_el(path)->l_tree_depth); |
451 | else | ||
452 | path_root_access(path) = NULL; | ||
437 | 453 | ||
438 | path->p_tree_depth = depth; | 454 | path->p_tree_depth = depth; |
439 | } | 455 | } |
@@ -459,6 +475,7 @@ static void ocfs2_cp_path(struct ocfs2_path *dest, struct ocfs2_path *src) | |||
459 | 475 | ||
460 | BUG_ON(path_root_bh(dest) != path_root_bh(src)); | 476 | BUG_ON(path_root_bh(dest) != path_root_bh(src)); |
461 | BUG_ON(path_root_el(dest) != path_root_el(src)); | 477 | BUG_ON(path_root_el(dest) != path_root_el(src)); |
478 | BUG_ON(path_root_access(dest) != path_root_access(src)); | ||
462 | 479 | ||
463 | ocfs2_reinit_path(dest, 1); | 480 | ocfs2_reinit_path(dest, 1); |
464 | 481 | ||
@@ -480,6 +497,7 @@ static void ocfs2_mv_path(struct ocfs2_path *dest, struct ocfs2_path *src) | |||
480 | int i; | 497 | int i; |
481 | 498 | ||
482 | BUG_ON(path_root_bh(dest) != path_root_bh(src)); | 499 | BUG_ON(path_root_bh(dest) != path_root_bh(src)); |
500 | BUG_ON(path_root_access(dest) != path_root_access(src)); | ||
483 | 501 | ||
484 | for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { | 502 | for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { |
485 | brelse(dest->p_node[i].bh); | 503 | brelse(dest->p_node[i].bh); |
@@ -515,7 +533,8 @@ static inline void ocfs2_path_insert_eb(struct ocfs2_path *path, int index, | |||
515 | } | 533 | } |
516 | 534 | ||
517 | static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, | 535 | static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, |
518 | struct ocfs2_extent_list *root_el) | 536 | struct ocfs2_extent_list *root_el, |
537 | ocfs2_journal_access_func access) | ||
519 | { | 538 | { |
520 | struct ocfs2_path *path; | 539 | struct ocfs2_path *path; |
521 | 540 | ||
@@ -527,6 +546,7 @@ static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, | |||
527 | get_bh(root_bh); | 546 | get_bh(root_bh); |
528 | path_root_bh(path) = root_bh; | 547 | path_root_bh(path) = root_bh; |
529 | path_root_el(path) = root_el; | 548 | path_root_el(path) = root_el; |
549 | path_root_access(path) = access; | ||
530 | } | 550 | } |
531 | 551 | ||
532 | return path; | 552 | return path; |
@@ -534,12 +554,38 @@ static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, | |||
534 | 554 | ||
535 | static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path) | 555 | static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path) |
536 | { | 556 | { |
537 | return ocfs2_new_path(path_root_bh(path), path_root_el(path)); | 557 | return ocfs2_new_path(path_root_bh(path), path_root_el(path), |
558 | path_root_access(path)); | ||
538 | } | 559 | } |
539 | 560 | ||
540 | static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et) | 561 | static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et) |
541 | { | 562 | { |
542 | return ocfs2_new_path(et->et_root_bh, et->et_root_el); | 563 | return ocfs2_new_path(et->et_root_bh, et->et_root_el, |
564 | et->et_root_journal_access); | ||
565 | } | ||
566 | |||
567 | /* | ||
568 | * Journal the buffer at depth idx. All idx>0 are extent_blocks, | ||
569 | * otherwise it's the root_access function. | ||
570 | * | ||
571 | * I don't like the way this function's name looks next to | ||
572 | * ocfs2_journal_access_path(), but I don't have a better one. | ||
573 | */ | ||
574 | static int ocfs2_path_bh_journal_access(handle_t *handle, | ||
575 | struct inode *inode, | ||
576 | struct ocfs2_path *path, | ||
577 | int idx) | ||
578 | { | ||
579 | ocfs2_journal_access_func access = path_root_access(path); | ||
580 | |||
581 | if (!access) | ||
582 | access = ocfs2_journal_access; | ||
583 | |||
584 | if (idx) | ||
585 | access = ocfs2_journal_access_eb; | ||
586 | |||
587 | return access(handle, inode, path->p_node[idx].bh, | ||
588 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
543 | } | 589 | } |
544 | 590 | ||
545 | /* | 591 | /* |
@@ -554,8 +600,7 @@ static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, | |||
554 | goto out; | 600 | goto out; |
555 | 601 | ||
556 | for(i = 0; i < path_num_items(path); i++) { | 602 | for(i = 0; i < path_num_items(path); i++) { |
557 | ret = ocfs2_journal_access(handle, inode, path->p_node[i].bh, | 603 | ret = ocfs2_path_bh_journal_access(handle, inode, path, i); |
558 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
559 | if (ret < 0) { | 604 | if (ret < 0) { |
560 | mlog_errno(ret); | 605 | mlog_errno(ret); |
561 | goto out; | 606 | goto out; |
@@ -708,8 +753,11 @@ static int ocfs2_validate_extent_block(struct super_block *sb, | |||
708 | * local to this block. | 753 | * local to this block. |
709 | */ | 754 | */ |
710 | rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &eb->h_check); | 755 | rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &eb->h_check); |
711 | if (rc) | 756 | if (rc) { |
757 | mlog(ML_ERROR, "Checksum failed for extent block %llu\n", | ||
758 | (unsigned long long)bh->b_blocknr); | ||
712 | return rc; | 759 | return rc; |
760 | } | ||
713 | 761 | ||
714 | /* | 762 | /* |
715 | * Errors after here are fatal. | 763 | * Errors after here are fatal. |
@@ -842,8 +890,8 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb, | |||
842 | } | 890 | } |
843 | ocfs2_set_new_buffer_uptodate(inode, bhs[i]); | 891 | ocfs2_set_new_buffer_uptodate(inode, bhs[i]); |
844 | 892 | ||
845 | status = ocfs2_journal_access(handle, inode, bhs[i], | 893 | status = ocfs2_journal_access_eb(handle, inode, bhs[i], |
846 | OCFS2_JOURNAL_ACCESS_CREATE); | 894 | OCFS2_JOURNAL_ACCESS_CREATE); |
847 | if (status < 0) { | 895 | if (status < 0) { |
848 | mlog_errno(status); | 896 | mlog_errno(status); |
849 | goto bail; | 897 | goto bail; |
@@ -986,8 +1034,8 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |||
986 | BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); | 1034 | BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); |
987 | eb_el = &eb->h_list; | 1035 | eb_el = &eb->h_list; |
988 | 1036 | ||
989 | status = ocfs2_journal_access(handle, inode, bh, | 1037 | status = ocfs2_journal_access_eb(handle, inode, bh, |
990 | OCFS2_JOURNAL_ACCESS_CREATE); | 1038 | OCFS2_JOURNAL_ACCESS_CREATE); |
991 | if (status < 0) { | 1039 | if (status < 0) { |
992 | mlog_errno(status); | 1040 | mlog_errno(status); |
993 | goto bail; | 1041 | goto bail; |
@@ -1026,21 +1074,21 @@ static int ocfs2_add_branch(struct ocfs2_super *osb, | |||
1026 | * journal_dirty erroring as it won't unless we've aborted the | 1074 | * journal_dirty erroring as it won't unless we've aborted the |
1027 | * handle (in which case we would never be here) so reserving | 1075 | * handle (in which case we would never be here) so reserving |
1028 | * the write with journal_access is all we need to do. */ | 1076 | * the write with journal_access is all we need to do. */ |
1029 | status = ocfs2_journal_access(handle, inode, *last_eb_bh, | 1077 | status = ocfs2_journal_access_eb(handle, inode, *last_eb_bh, |
1030 | OCFS2_JOURNAL_ACCESS_WRITE); | 1078 | OCFS2_JOURNAL_ACCESS_WRITE); |
1031 | if (status < 0) { | 1079 | if (status < 0) { |
1032 | mlog_errno(status); | 1080 | mlog_errno(status); |
1033 | goto bail; | 1081 | goto bail; |
1034 | } | 1082 | } |
1035 | status = ocfs2_journal_access(handle, inode, et->et_root_bh, | 1083 | status = ocfs2_et_root_journal_access(handle, inode, et, |
1036 | OCFS2_JOURNAL_ACCESS_WRITE); | 1084 | OCFS2_JOURNAL_ACCESS_WRITE); |
1037 | if (status < 0) { | 1085 | if (status < 0) { |
1038 | mlog_errno(status); | 1086 | mlog_errno(status); |
1039 | goto bail; | 1087 | goto bail; |
1040 | } | 1088 | } |
1041 | if (eb_bh) { | 1089 | if (eb_bh) { |
1042 | status = ocfs2_journal_access(handle, inode, eb_bh, | 1090 | status = ocfs2_journal_access_eb(handle, inode, eb_bh, |
1043 | OCFS2_JOURNAL_ACCESS_WRITE); | 1091 | OCFS2_JOURNAL_ACCESS_WRITE); |
1044 | if (status < 0) { | 1092 | if (status < 0) { |
1045 | mlog_errno(status); | 1093 | mlog_errno(status); |
1046 | goto bail; | 1094 | goto bail; |
@@ -1129,8 +1177,8 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |||
1129 | eb_el = &eb->h_list; | 1177 | eb_el = &eb->h_list; |
1130 | root_el = et->et_root_el; | 1178 | root_el = et->et_root_el; |
1131 | 1179 | ||
1132 | status = ocfs2_journal_access(handle, inode, new_eb_bh, | 1180 | status = ocfs2_journal_access_eb(handle, inode, new_eb_bh, |
1133 | OCFS2_JOURNAL_ACCESS_CREATE); | 1181 | OCFS2_JOURNAL_ACCESS_CREATE); |
1134 | if (status < 0) { | 1182 | if (status < 0) { |
1135 | mlog_errno(status); | 1183 | mlog_errno(status); |
1136 | goto bail; | 1184 | goto bail; |
@@ -1148,8 +1196,8 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb, | |||
1148 | goto bail; | 1196 | goto bail; |
1149 | } | 1197 | } |
1150 | 1198 | ||
1151 | status = ocfs2_journal_access(handle, inode, et->et_root_bh, | 1199 | status = ocfs2_et_root_journal_access(handle, inode, et, |
1152 | OCFS2_JOURNAL_ACCESS_WRITE); | 1200 | OCFS2_JOURNAL_ACCESS_WRITE); |
1153 | if (status < 0) { | 1201 | if (status < 0) { |
1154 | mlog_errno(status); | 1202 | mlog_errno(status); |
1155 | goto bail; | 1203 | goto bail; |
@@ -1918,25 +1966,23 @@ static int ocfs2_rotate_subtree_right(struct inode *inode, | |||
1918 | root_bh = left_path->p_node[subtree_index].bh; | 1966 | root_bh = left_path->p_node[subtree_index].bh; |
1919 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); | 1967 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); |
1920 | 1968 | ||
1921 | ret = ocfs2_journal_access(handle, inode, root_bh, | 1969 | ret = ocfs2_path_bh_journal_access(handle, inode, right_path, |
1922 | OCFS2_JOURNAL_ACCESS_WRITE); | 1970 | subtree_index); |
1923 | if (ret) { | 1971 | if (ret) { |
1924 | mlog_errno(ret); | 1972 | mlog_errno(ret); |
1925 | goto out; | 1973 | goto out; |
1926 | } | 1974 | } |
1927 | 1975 | ||
1928 | for(i = subtree_index + 1; i < path_num_items(right_path); i++) { | 1976 | for(i = subtree_index + 1; i < path_num_items(right_path); i++) { |
1929 | ret = ocfs2_journal_access(handle, inode, | 1977 | ret = ocfs2_path_bh_journal_access(handle, inode, |
1930 | right_path->p_node[i].bh, | 1978 | right_path, i); |
1931 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
1932 | if (ret) { | 1979 | if (ret) { |
1933 | mlog_errno(ret); | 1980 | mlog_errno(ret); |
1934 | goto out; | 1981 | goto out; |
1935 | } | 1982 | } |
1936 | 1983 | ||
1937 | ret = ocfs2_journal_access(handle, inode, | 1984 | ret = ocfs2_path_bh_journal_access(handle, inode, |
1938 | left_path->p_node[i].bh, | 1985 | left_path, i); |
1939 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
1940 | if (ret) { | 1986 | if (ret) { |
1941 | mlog_errno(ret); | 1987 | mlog_errno(ret); |
1942 | goto out; | 1988 | goto out; |
@@ -2455,9 +2501,9 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2455 | return -EAGAIN; | 2501 | return -EAGAIN; |
2456 | 2502 | ||
2457 | if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { | 2503 | if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { |
2458 | ret = ocfs2_journal_access(handle, inode, | 2504 | ret = ocfs2_journal_access_eb(handle, inode, |
2459 | path_leaf_bh(right_path), | 2505 | path_leaf_bh(right_path), |
2460 | OCFS2_JOURNAL_ACCESS_WRITE); | 2506 | OCFS2_JOURNAL_ACCESS_WRITE); |
2461 | if (ret) { | 2507 | if (ret) { |
2462 | mlog_errno(ret); | 2508 | mlog_errno(ret); |
2463 | goto out; | 2509 | goto out; |
@@ -2474,8 +2520,8 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2474 | * We have to update i_last_eb_blk during the meta | 2520 | * We have to update i_last_eb_blk during the meta |
2475 | * data delete. | 2521 | * data delete. |
2476 | */ | 2522 | */ |
2477 | ret = ocfs2_journal_access(handle, inode, et_root_bh, | 2523 | ret = ocfs2_et_root_journal_access(handle, inode, et, |
2478 | OCFS2_JOURNAL_ACCESS_WRITE); | 2524 | OCFS2_JOURNAL_ACCESS_WRITE); |
2479 | if (ret) { | 2525 | if (ret) { |
2480 | mlog_errno(ret); | 2526 | mlog_errno(ret); |
2481 | goto out; | 2527 | goto out; |
@@ -2490,25 +2536,23 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle, | |||
2490 | */ | 2536 | */ |
2491 | BUG_ON(right_has_empty && !del_right_subtree); | 2537 | BUG_ON(right_has_empty && !del_right_subtree); |
2492 | 2538 | ||
2493 | ret = ocfs2_journal_access(handle, inode, root_bh, | 2539 | ret = ocfs2_path_bh_journal_access(handle, inode, right_path, |
2494 | OCFS2_JOURNAL_ACCESS_WRITE); | 2540 | subtree_index); |
2495 | if (ret) { | 2541 | if (ret) { |
2496 | mlog_errno(ret); | 2542 | mlog_errno(ret); |
2497 | goto out; | 2543 | goto out; |
2498 | } | 2544 | } |
2499 | 2545 | ||
2500 | for(i = subtree_index + 1; i < path_num_items(right_path); i++) { | 2546 | for(i = subtree_index + 1; i < path_num_items(right_path); i++) { |
2501 | ret = ocfs2_journal_access(handle, inode, | 2547 | ret = ocfs2_path_bh_journal_access(handle, inode, |
2502 | right_path->p_node[i].bh, | 2548 | right_path, i); |
2503 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2504 | if (ret) { | 2549 | if (ret) { |
2505 | mlog_errno(ret); | 2550 | mlog_errno(ret); |
2506 | goto out; | 2551 | goto out; |
2507 | } | 2552 | } |
2508 | 2553 | ||
2509 | ret = ocfs2_journal_access(handle, inode, | 2554 | ret = ocfs2_path_bh_journal_access(handle, inode, |
2510 | left_path->p_node[i].bh, | 2555 | left_path, i); |
2511 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2512 | if (ret) { | 2556 | if (ret) { |
2513 | mlog_errno(ret); | 2557 | mlog_errno(ret); |
2514 | goto out; | 2558 | goto out; |
@@ -2653,16 +2697,17 @@ out: | |||
2653 | 2697 | ||
2654 | static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, | 2698 | static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, |
2655 | handle_t *handle, | 2699 | handle_t *handle, |
2656 | struct buffer_head *bh, | 2700 | struct ocfs2_path *path) |
2657 | struct ocfs2_extent_list *el) | ||
2658 | { | 2701 | { |
2659 | int ret; | 2702 | int ret; |
2703 | struct buffer_head *bh = path_leaf_bh(path); | ||
2704 | struct ocfs2_extent_list *el = path_leaf_el(path); | ||
2660 | 2705 | ||
2661 | if (!ocfs2_is_empty_extent(&el->l_recs[0])) | 2706 | if (!ocfs2_is_empty_extent(&el->l_recs[0])) |
2662 | return 0; | 2707 | return 0; |
2663 | 2708 | ||
2664 | ret = ocfs2_journal_access(handle, inode, bh, | 2709 | ret = ocfs2_path_bh_journal_access(handle, inode, path, |
2665 | OCFS2_JOURNAL_ACCESS_WRITE); | 2710 | path_num_items(path) - 1); |
2666 | if (ret) { | 2711 | if (ret) { |
2667 | mlog_errno(ret); | 2712 | mlog_errno(ret); |
2668 | goto out; | 2713 | goto out; |
@@ -2744,9 +2789,8 @@ static int __ocfs2_rotate_tree_left(struct inode *inode, | |||
2744 | * Caller might still want to make changes to the | 2789 | * Caller might still want to make changes to the |
2745 | * tree root, so re-add it to the journal here. | 2790 | * tree root, so re-add it to the journal here. |
2746 | */ | 2791 | */ |
2747 | ret = ocfs2_journal_access(handle, inode, | 2792 | ret = ocfs2_path_bh_journal_access(handle, inode, |
2748 | path_root_bh(left_path), | 2793 | left_path, 0); |
2749 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
2750 | if (ret) { | 2794 | if (ret) { |
2751 | mlog_errno(ret); | 2795 | mlog_errno(ret); |
2752 | goto out; | 2796 | goto out; |
@@ -2929,8 +2973,7 @@ rightmost_no_delete: | |||
2929 | * it up front. | 2973 | * it up front. |
2930 | */ | 2974 | */ |
2931 | ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, | 2975 | ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, |
2932 | path_leaf_bh(path), | 2976 | path); |
2933 | path_leaf_el(path)); | ||
2934 | if (ret) | 2977 | if (ret) |
2935 | mlog_errno(ret); | 2978 | mlog_errno(ret); |
2936 | goto out; | 2979 | goto out; |
@@ -3164,8 +3207,8 @@ static int ocfs2_merge_rec_right(struct inode *inode, | |||
3164 | root_bh = left_path->p_node[subtree_index].bh; | 3207 | root_bh = left_path->p_node[subtree_index].bh; |
3165 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); | 3208 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); |
3166 | 3209 | ||
3167 | ret = ocfs2_journal_access(handle, inode, root_bh, | 3210 | ret = ocfs2_path_bh_journal_access(handle, inode, right_path, |
3168 | OCFS2_JOURNAL_ACCESS_WRITE); | 3211 | subtree_index); |
3169 | if (ret) { | 3212 | if (ret) { |
3170 | mlog_errno(ret); | 3213 | mlog_errno(ret); |
3171 | goto out; | 3214 | goto out; |
@@ -3173,17 +3216,15 @@ static int ocfs2_merge_rec_right(struct inode *inode, | |||
3173 | 3216 | ||
3174 | for (i = subtree_index + 1; | 3217 | for (i = subtree_index + 1; |
3175 | i < path_num_items(right_path); i++) { | 3218 | i < path_num_items(right_path); i++) { |
3176 | ret = ocfs2_journal_access(handle, inode, | 3219 | ret = ocfs2_path_bh_journal_access(handle, inode, |
3177 | right_path->p_node[i].bh, | 3220 | right_path, i); |
3178 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
3179 | if (ret) { | 3221 | if (ret) { |
3180 | mlog_errno(ret); | 3222 | mlog_errno(ret); |
3181 | goto out; | 3223 | goto out; |
3182 | } | 3224 | } |
3183 | 3225 | ||
3184 | ret = ocfs2_journal_access(handle, inode, | 3226 | ret = ocfs2_path_bh_journal_access(handle, inode, |
3185 | left_path->p_node[i].bh, | 3227 | left_path, i); |
3186 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
3187 | if (ret) { | 3228 | if (ret) { |
3188 | mlog_errno(ret); | 3229 | mlog_errno(ret); |
3189 | goto out; | 3230 | goto out; |
@@ -3195,8 +3236,8 @@ static int ocfs2_merge_rec_right(struct inode *inode, | |||
3195 | right_rec = &el->l_recs[index + 1]; | 3236 | right_rec = &el->l_recs[index + 1]; |
3196 | } | 3237 | } |
3197 | 3238 | ||
3198 | ret = ocfs2_journal_access(handle, inode, bh, | 3239 | ret = ocfs2_path_bh_journal_access(handle, inode, left_path, |
3199 | OCFS2_JOURNAL_ACCESS_WRITE); | 3240 | path_num_items(left_path) - 1); |
3200 | if (ret) { | 3241 | if (ret) { |
3201 | mlog_errno(ret); | 3242 | mlog_errno(ret); |
3202 | goto out; | 3243 | goto out; |
@@ -3335,8 +3376,8 @@ static int ocfs2_merge_rec_left(struct inode *inode, | |||
3335 | root_bh = left_path->p_node[subtree_index].bh; | 3376 | root_bh = left_path->p_node[subtree_index].bh; |
3336 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); | 3377 | BUG_ON(root_bh != right_path->p_node[subtree_index].bh); |
3337 | 3378 | ||
3338 | ret = ocfs2_journal_access(handle, inode, root_bh, | 3379 | ret = ocfs2_path_bh_journal_access(handle, inode, right_path, |
3339 | OCFS2_JOURNAL_ACCESS_WRITE); | 3380 | subtree_index); |
3340 | if (ret) { | 3381 | if (ret) { |
3341 | mlog_errno(ret); | 3382 | mlog_errno(ret); |
3342 | goto out; | 3383 | goto out; |
@@ -3344,17 +3385,15 @@ static int ocfs2_merge_rec_left(struct inode *inode, | |||
3344 | 3385 | ||
3345 | for (i = subtree_index + 1; | 3386 | for (i = subtree_index + 1; |
3346 | i < path_num_items(right_path); i++) { | 3387 | i < path_num_items(right_path); i++) { |
3347 | ret = ocfs2_journal_access(handle, inode, | 3388 | ret = ocfs2_path_bh_journal_access(handle, inode, |
3348 | right_path->p_node[i].bh, | 3389 | right_path, i); |
3349 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
3350 | if (ret) { | 3390 | if (ret) { |
3351 | mlog_errno(ret); | 3391 | mlog_errno(ret); |
3352 | goto out; | 3392 | goto out; |
3353 | } | 3393 | } |
3354 | 3394 | ||
3355 | ret = ocfs2_journal_access(handle, inode, | 3395 | ret = ocfs2_path_bh_journal_access(handle, inode, |
3356 | left_path->p_node[i].bh, | 3396 | left_path, i); |
3357 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
3358 | if (ret) { | 3397 | if (ret) { |
3359 | mlog_errno(ret); | 3398 | mlog_errno(ret); |
3360 | goto out; | 3399 | goto out; |
@@ -3366,8 +3405,8 @@ static int ocfs2_merge_rec_left(struct inode *inode, | |||
3366 | has_empty_extent = 1; | 3405 | has_empty_extent = 1; |
3367 | } | 3406 | } |
3368 | 3407 | ||
3369 | ret = ocfs2_journal_access(handle, inode, bh, | 3408 | ret = ocfs2_path_bh_journal_access(handle, inode, left_path, |
3370 | OCFS2_JOURNAL_ACCESS_WRITE); | 3409 | path_num_items(left_path) - 1); |
3371 | if (ret) { | 3410 | if (ret) { |
3372 | mlog_errno(ret); | 3411 | mlog_errno(ret); |
3373 | goto out; | 3412 | goto out; |
@@ -4009,8 +4048,8 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |||
4009 | 4048 | ||
4010 | el = et->et_root_el; | 4049 | el = et->et_root_el; |
4011 | 4050 | ||
4012 | ret = ocfs2_journal_access(handle, inode, et->et_root_bh, | 4051 | ret = ocfs2_et_root_journal_access(handle, inode, et, |
4013 | OCFS2_JOURNAL_ACCESS_WRITE); | 4052 | OCFS2_JOURNAL_ACCESS_WRITE); |
4014 | if (ret) { | 4053 | if (ret) { |
4015 | mlog_errno(ret); | 4054 | mlog_errno(ret); |
4016 | goto out; | 4055 | goto out; |
@@ -4071,8 +4110,8 @@ static int ocfs2_do_insert_extent(struct inode *inode, | |||
4071 | * ocfs2_rotate_tree_right() might have extended the | 4110 | * ocfs2_rotate_tree_right() might have extended the |
4072 | * transaction without re-journaling our tree root. | 4111 | * transaction without re-journaling our tree root. |
4073 | */ | 4112 | */ |
4074 | ret = ocfs2_journal_access(handle, inode, et->et_root_bh, | 4113 | ret = ocfs2_et_root_journal_access(handle, inode, et, |
4075 | OCFS2_JOURNAL_ACCESS_WRITE); | 4114 | OCFS2_JOURNAL_ACCESS_WRITE); |
4076 | if (ret) { | 4115 | if (ret) { |
4077 | mlog_errno(ret); | 4116 | mlog_errno(ret); |
4078 | goto out; | 4117 | goto out; |
@@ -4593,9 +4632,9 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb, | |||
4593 | 4632 | ||
4594 | BUG_ON(num_bits > clusters_to_add); | 4633 | BUG_ON(num_bits > clusters_to_add); |
4595 | 4634 | ||
4596 | /* reserve our write early -- insert_extent may update the inode */ | 4635 | /* reserve our write early -- insert_extent may update the tree root */ |
4597 | status = ocfs2_journal_access(handle, inode, et->et_root_bh, | 4636 | status = ocfs2_et_root_journal_access(handle, inode, et, |
4598 | OCFS2_JOURNAL_ACCESS_WRITE); | 4637 | OCFS2_JOURNAL_ACCESS_WRITE); |
4599 | if (status < 0) { | 4638 | if (status < 0) { |
4600 | mlog_errno(status); | 4639 | mlog_errno(status); |
4601 | goto leave; | 4640 | goto leave; |
@@ -5347,8 +5386,8 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5347 | goto out; | 5386 | goto out; |
5348 | } | 5387 | } |
5349 | 5388 | ||
5350 | ret = ocfs2_journal_access(handle, inode, et->et_root_bh, | 5389 | ret = ocfs2_et_root_journal_access(handle, inode, et, |
5351 | OCFS2_JOURNAL_ACCESS_WRITE); | 5390 | OCFS2_JOURNAL_ACCESS_WRITE); |
5352 | if (ret) { | 5391 | if (ret) { |
5353 | mlog_errno(ret); | 5392 | mlog_errno(ret); |
5354 | goto out; | 5393 | goto out; |
@@ -5461,8 +5500,8 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5461 | goto bail; | 5500 | goto bail; |
5462 | } | 5501 | } |
5463 | 5502 | ||
5464 | status = ocfs2_journal_access(handle, tl_inode, tl_bh, | 5503 | status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, |
5465 | OCFS2_JOURNAL_ACCESS_WRITE); | 5504 | OCFS2_JOURNAL_ACCESS_WRITE); |
5466 | if (status < 0) { | 5505 | if (status < 0) { |
5467 | mlog_errno(status); | 5506 | mlog_errno(status); |
5468 | goto bail; | 5507 | goto bail; |
@@ -5523,8 +5562,8 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5523 | while (i >= 0) { | 5562 | while (i >= 0) { |
5524 | /* Caller has given us at least enough credits to | 5563 | /* Caller has given us at least enough credits to |
5525 | * update the truncate log dinode */ | 5564 | * update the truncate log dinode */ |
5526 | status = ocfs2_journal_access(handle, tl_inode, tl_bh, | 5565 | status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, |
5527 | OCFS2_JOURNAL_ACCESS_WRITE); | 5566 | OCFS2_JOURNAL_ACCESS_WRITE); |
5528 | if (status < 0) { | 5567 | if (status < 0) { |
5529 | mlog_errno(status); | 5568 | mlog_errno(status); |
5530 | goto bail; | 5569 | goto bail; |
@@ -5780,6 +5819,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, | |||
5780 | * tl_used. */ | 5819 | * tl_used. */ |
5781 | tl->tl_used = 0; | 5820 | tl->tl_used = 0; |
5782 | 5821 | ||
5822 | ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check); | ||
5783 | status = ocfs2_write_block(osb, tl_bh, tl_inode); | 5823 | status = ocfs2_write_block(osb, tl_bh, tl_inode); |
5784 | if (status < 0) { | 5824 | if (status < 0) { |
5785 | mlog_errno(status); | 5825 | mlog_errno(status); |
@@ -6546,8 +6586,8 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, | |||
6546 | } | 6586 | } |
6547 | 6587 | ||
6548 | if (last_eb_bh) { | 6588 | if (last_eb_bh) { |
6549 | status = ocfs2_journal_access(handle, inode, last_eb_bh, | 6589 | status = ocfs2_journal_access_eb(handle, inode, last_eb_bh, |
6550 | OCFS2_JOURNAL_ACCESS_WRITE); | 6590 | OCFS2_JOURNAL_ACCESS_WRITE); |
6551 | if (status < 0) { | 6591 | if (status < 0) { |
6552 | mlog_errno(status); | 6592 | mlog_errno(status); |
6553 | goto bail; | 6593 | goto bail; |
@@ -6908,8 +6948,8 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6908 | goto out_unlock; | 6948 | goto out_unlock; |
6909 | } | 6949 | } |
6910 | 6950 | ||
6911 | ret = ocfs2_journal_access(handle, inode, di_bh, | 6951 | ret = ocfs2_journal_access_di(handle, inode, di_bh, |
6912 | OCFS2_JOURNAL_ACCESS_WRITE); | 6952 | OCFS2_JOURNAL_ACCESS_WRITE); |
6913 | if (ret) { | 6953 | if (ret) { |
6914 | mlog_errno(ret); | 6954 | mlog_errno(ret); |
6915 | goto out_commit; | 6955 | goto out_commit; |
@@ -7043,7 +7083,8 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, | |||
7043 | new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, | 7083 | new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, |
7044 | i_size_read(inode)); | 7084 | i_size_read(inode)); |
7045 | 7085 | ||
7046 | path = ocfs2_new_path(fe_bh, &di->id2.i_list); | 7086 | path = ocfs2_new_path(fe_bh, &di->id2.i_list, |
7087 | ocfs2_journal_access_di); | ||
7047 | if (!path) { | 7088 | if (!path) { |
7048 | status = -ENOMEM; | 7089 | status = -ENOMEM; |
7049 | mlog_errno(status); | 7090 | mlog_errno(status); |
@@ -7276,8 +7317,8 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh, | |||
7276 | goto out; | 7317 | goto out; |
7277 | } | 7318 | } |
7278 | 7319 | ||
7279 | ret = ocfs2_journal_access(handle, inode, di_bh, | 7320 | ret = ocfs2_journal_access_di(handle, inode, di_bh, |
7280 | OCFS2_JOURNAL_ACCESS_WRITE); | 7321 | OCFS2_JOURNAL_ACCESS_WRITE); |
7281 | if (ret) { | 7322 | if (ret) { |
7282 | mlog_errno(ret); | 7323 | mlog_errno(ret); |
7283 | goto out_commit; | 7324 | goto out_commit; |
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index 59d37d1b7d4c..4b6fea22748a 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -45,7 +45,9 @@ | |||
45 | * | 45 | * |
46 | * ocfs2_extent_tree contains info for the root of the b-tree, it must have a | 46 | * ocfs2_extent_tree contains info for the root of the b-tree, it must have a |
47 | * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree | 47 | * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree |
48 | * functions. | 48 | * functions. With metadata ecc, we now call different journal_access |
49 | * functions for each type of metadata, so it must have the | ||
50 | * root_journal_access function. | ||
49 | * ocfs2_extent_tree_operations abstract the normal operations we do for | 51 | * ocfs2_extent_tree_operations abstract the normal operations we do for |
50 | * the root of extent b-tree. | 52 | * the root of extent b-tree. |
51 | */ | 53 | */ |
@@ -54,6 +56,7 @@ struct ocfs2_extent_tree { | |||
54 | struct ocfs2_extent_tree_operations *et_ops; | 56 | struct ocfs2_extent_tree_operations *et_ops; |
55 | struct buffer_head *et_root_bh; | 57 | struct buffer_head *et_root_bh; |
56 | struct ocfs2_extent_list *et_root_el; | 58 | struct ocfs2_extent_list *et_root_el; |
59 | ocfs2_journal_access_func et_root_journal_access; | ||
57 | void *et_object; | 60 | void *et_object; |
58 | unsigned int et_max_leaf_clusters; | 61 | unsigned int et_max_leaf_clusters; |
59 | }; | 62 | }; |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 6b647ec87bb3..a067a6cffb01 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1512,8 +1512,8 @@ static int ocfs2_write_begin_inline(struct address_space *mapping, | |||
1512 | goto out; | 1512 | goto out; |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | ret = ocfs2_journal_access(handle, inode, wc->w_di_bh, | 1515 | ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, |
1516 | OCFS2_JOURNAL_ACCESS_WRITE); | 1516 | OCFS2_JOURNAL_ACCESS_WRITE); |
1517 | if (ret) { | 1517 | if (ret) { |
1518 | ocfs2_commit_trans(osb, handle); | 1518 | ocfs2_commit_trans(osb, handle); |
1519 | 1519 | ||
@@ -1740,8 +1740,8 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1740 | * We don't want this to fail in ocfs2_write_end(), so do it | 1740 | * We don't want this to fail in ocfs2_write_end(), so do it |
1741 | * here. | 1741 | * here. |
1742 | */ | 1742 | */ |
1743 | ret = ocfs2_journal_access(handle, inode, wc->w_di_bh, | 1743 | ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh, |
1744 | OCFS2_JOURNAL_ACCESS_WRITE); | 1744 | OCFS2_JOURNAL_ACCESS_WRITE); |
1745 | if (ret) { | 1745 | if (ret) { |
1746 | mlog_errno(ret); | 1746 | mlog_errno(ret); |
1747 | goto out_quota; | 1747 | goto out_quota; |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 3708fe482e3e..45e4e03d8f71 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -378,14 +378,18 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle, | |||
378 | struct inode *new_entry_inode) | 378 | struct inode *new_entry_inode) |
379 | { | 379 | { |
380 | int ret; | 380 | int ret; |
381 | ocfs2_journal_access_func access = ocfs2_journal_access_db; | ||
381 | 382 | ||
382 | /* | 383 | /* |
383 | * The same code works fine for both inline-data and extent | 384 | * The same code works fine for both inline-data and extent |
384 | * based directories, so no need to split this up. | 385 | * based directories, so no need to split this up. The only |
386 | * difference is the journal_access function. | ||
385 | */ | 387 | */ |
386 | 388 | ||
387 | ret = ocfs2_journal_access(handle, dir, de_bh, | 389 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
388 | OCFS2_JOURNAL_ACCESS_WRITE); | 390 | access = ocfs2_journal_access_di; |
391 | |||
392 | ret = access(handle, dir, de_bh, OCFS2_JOURNAL_ACCESS_WRITE); | ||
389 | if (ret) { | 393 | if (ret) { |
390 | mlog_errno(ret); | 394 | mlog_errno(ret); |
391 | goto out; | 395 | goto out; |
@@ -407,9 +411,13 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
407 | { | 411 | { |
408 | struct ocfs2_dir_entry *de, *pde; | 412 | struct ocfs2_dir_entry *de, *pde; |
409 | int i, status = -ENOENT; | 413 | int i, status = -ENOENT; |
414 | ocfs2_journal_access_func access = ocfs2_journal_access_db; | ||
410 | 415 | ||
411 | mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh); | 416 | mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh); |
412 | 417 | ||
418 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | ||
419 | access = ocfs2_journal_access_di; | ||
420 | |||
413 | i = 0; | 421 | i = 0; |
414 | pde = NULL; | 422 | pde = NULL; |
415 | de = (struct ocfs2_dir_entry *) first_de; | 423 | de = (struct ocfs2_dir_entry *) first_de; |
@@ -420,8 +428,8 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
420 | goto bail; | 428 | goto bail; |
421 | } | 429 | } |
422 | if (de == de_del) { | 430 | if (de == de_del) { |
423 | status = ocfs2_journal_access(handle, dir, bh, | 431 | status = access(handle, dir, bh, |
424 | OCFS2_JOURNAL_ACCESS_WRITE); | 432 | OCFS2_JOURNAL_ACCESS_WRITE); |
425 | if (status < 0) { | 433 | if (status < 0) { |
426 | status = -EIO; | 434 | status = -EIO; |
427 | mlog_errno(status); | 435 | mlog_errno(status); |
@@ -581,8 +589,14 @@ int __ocfs2_add_entry(handle_t *handle, | |||
581 | goto bail; | 589 | goto bail; |
582 | } | 590 | } |
583 | 591 | ||
584 | status = ocfs2_journal_access(handle, dir, insert_bh, | 592 | if (insert_bh == parent_fe_bh) |
585 | OCFS2_JOURNAL_ACCESS_WRITE); | 593 | status = ocfs2_journal_access_di(handle, dir, |
594 | insert_bh, | ||
595 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
596 | else | ||
597 | status = ocfs2_journal_access_db(handle, dir, | ||
598 | insert_bh, | ||
599 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
586 | /* By now the buffer is marked for journaling */ | 600 | /* By now the buffer is marked for journaling */ |
587 | offset += le16_to_cpu(de->rec_len); | 601 | offset += le16_to_cpu(de->rec_len); |
588 | if (le64_to_cpu(de->inode)) { | 602 | if (le64_to_cpu(de->inode)) { |
@@ -1081,8 +1095,8 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb, | |||
1081 | struct ocfs2_inline_data *data = &di->id2.i_data; | 1095 | struct ocfs2_inline_data *data = &di->id2.i_data; |
1082 | unsigned int size = le16_to_cpu(data->id_count); | 1096 | unsigned int size = le16_to_cpu(data->id_count); |
1083 | 1097 | ||
1084 | ret = ocfs2_journal_access(handle, inode, di_bh, | 1098 | ret = ocfs2_journal_access_di(handle, inode, di_bh, |
1085 | OCFS2_JOURNAL_ACCESS_WRITE); | 1099 | OCFS2_JOURNAL_ACCESS_WRITE); |
1086 | if (ret) { | 1100 | if (ret) { |
1087 | mlog_errno(ret); | 1101 | mlog_errno(ret); |
1088 | goto out; | 1102 | goto out; |
@@ -1129,8 +1143,8 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb, | |||
1129 | 1143 | ||
1130 | ocfs2_set_new_buffer_uptodate(inode, new_bh); | 1144 | ocfs2_set_new_buffer_uptodate(inode, new_bh); |
1131 | 1145 | ||
1132 | status = ocfs2_journal_access(handle, inode, new_bh, | 1146 | status = ocfs2_journal_access_db(handle, inode, new_bh, |
1133 | OCFS2_JOURNAL_ACCESS_CREATE); | 1147 | OCFS2_JOURNAL_ACCESS_CREATE); |
1134 | if (status < 0) { | 1148 | if (status < 0) { |
1135 | mlog_errno(status); | 1149 | mlog_errno(status); |
1136 | goto bail; | 1150 | goto bail; |
@@ -1292,8 +1306,8 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1292 | 1306 | ||
1293 | ocfs2_set_new_buffer_uptodate(dir, dirdata_bh); | 1307 | ocfs2_set_new_buffer_uptodate(dir, dirdata_bh); |
1294 | 1308 | ||
1295 | ret = ocfs2_journal_access(handle, dir, dirdata_bh, | 1309 | ret = ocfs2_journal_access_db(handle, dir, dirdata_bh, |
1296 | OCFS2_JOURNAL_ACCESS_CREATE); | 1310 | OCFS2_JOURNAL_ACCESS_CREATE); |
1297 | if (ret) { | 1311 | if (ret) { |
1298 | mlog_errno(ret); | 1312 | mlog_errno(ret); |
1299 | goto out_commit; | 1313 | goto out_commit; |
@@ -1319,8 +1333,8 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
1319 | * We let the later dirent insert modify c/mtime - to the user | 1333 | * We let the later dirent insert modify c/mtime - to the user |
1320 | * the data hasn't changed. | 1334 | * the data hasn't changed. |
1321 | */ | 1335 | */ |
1322 | ret = ocfs2_journal_access(handle, dir, di_bh, | 1336 | ret = ocfs2_journal_access_di(handle, dir, di_bh, |
1323 | OCFS2_JOURNAL_ACCESS_CREATE); | 1337 | OCFS2_JOURNAL_ACCESS_CREATE); |
1324 | if (ret) { | 1338 | if (ret) { |
1325 | mlog_errno(ret); | 1339 | mlog_errno(ret); |
1326 | goto out_commit; | 1340 | goto out_commit; |
@@ -1583,8 +1597,8 @@ do_extend: | |||
1583 | 1597 | ||
1584 | ocfs2_set_new_buffer_uptodate(dir, new_bh); | 1598 | ocfs2_set_new_buffer_uptodate(dir, new_bh); |
1585 | 1599 | ||
1586 | status = ocfs2_journal_access(handle, dir, new_bh, | 1600 | status = ocfs2_journal_access_db(handle, dir, new_bh, |
1587 | OCFS2_JOURNAL_ACCESS_CREATE); | 1601 | OCFS2_JOURNAL_ACCESS_CREATE); |
1588 | if (status < 0) { | 1602 | if (status < 0) { |
1589 | mlog_errno(status); | 1603 | mlog_errno(status); |
1590 | goto bail; | 1604 | goto bail; |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 9374d374a264..e8f795f978aa 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -256,8 +256,8 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
256 | goto out; | 256 | goto out; |
257 | } | 257 | } |
258 | 258 | ||
259 | ret = ocfs2_journal_access(handle, inode, bh, | 259 | ret = ocfs2_journal_access_di(handle, inode, bh, |
260 | OCFS2_JOURNAL_ACCESS_WRITE); | 260 | OCFS2_JOURNAL_ACCESS_WRITE); |
261 | if (ret) { | 261 | if (ret) { |
262 | mlog_errno(ret); | 262 | mlog_errno(ret); |
263 | goto out_commit; | 263 | goto out_commit; |
@@ -353,8 +353,8 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, | |||
353 | goto out; | 353 | goto out; |
354 | } | 354 | } |
355 | 355 | ||
356 | status = ocfs2_journal_access(handle, inode, fe_bh, | 356 | status = ocfs2_journal_access_di(handle, inode, fe_bh, |
357 | OCFS2_JOURNAL_ACCESS_WRITE); | 357 | OCFS2_JOURNAL_ACCESS_WRITE); |
358 | if (status < 0) { | 358 | if (status < 0) { |
359 | mlog_errno(status); | 359 | mlog_errno(status); |
360 | goto out_commit; | 360 | goto out_commit; |
@@ -590,8 +590,8 @@ restarted_transaction: | |||
590 | /* reserve a write to the file entry early on - that we if we | 590 | /* reserve a write to the file entry early on - that we if we |
591 | * run out of credits in the allocation path, we can still | 591 | * run out of credits in the allocation path, we can still |
592 | * update i_size. */ | 592 | * update i_size. */ |
593 | status = ocfs2_journal_access(handle, inode, bh, | 593 | status = ocfs2_journal_access_di(handle, inode, bh, |
594 | OCFS2_JOURNAL_ACCESS_WRITE); | 594 | OCFS2_JOURNAL_ACCESS_WRITE); |
595 | if (status < 0) { | 595 | if (status < 0) { |
596 | mlog_errno(status); | 596 | mlog_errno(status); |
597 | goto leave; | 597 | goto leave; |
@@ -1121,8 +1121,8 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1121 | goto out; | 1121 | goto out; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | ret = ocfs2_journal_access(handle, inode, bh, | 1124 | ret = ocfs2_journal_access_di(handle, inode, bh, |
1125 | OCFS2_JOURNAL_ACCESS_WRITE); | 1125 | OCFS2_JOURNAL_ACCESS_WRITE); |
1126 | if (ret < 0) { | 1126 | if (ret < 0) { |
1127 | mlog_errno(ret); | 1127 | mlog_errno(ret); |
1128 | goto out_trans; | 1128 | goto out_trans; |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 9370b652ab94..229e707bc050 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -537,8 +537,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
537 | goto out; | 537 | goto out; |
538 | } | 538 | } |
539 | 539 | ||
540 | status = ocfs2_journal_access(handle, inode, fe_bh, | 540 | status = ocfs2_journal_access_di(handle, inode, fe_bh, |
541 | OCFS2_JOURNAL_ACCESS_WRITE); | 541 | OCFS2_JOURNAL_ACCESS_WRITE); |
542 | if (status < 0) { | 542 | if (status < 0) { |
543 | mlog_errno(status); | 543 | mlog_errno(status); |
544 | goto out; | 544 | goto out; |
@@ -621,8 +621,8 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
621 | } | 621 | } |
622 | 622 | ||
623 | /* set the inodes dtime */ | 623 | /* set the inodes dtime */ |
624 | status = ocfs2_journal_access(handle, inode, di_bh, | 624 | status = ocfs2_journal_access_di(handle, inode, di_bh, |
625 | OCFS2_JOURNAL_ACCESS_WRITE); | 625 | OCFS2_JOURNAL_ACCESS_WRITE); |
626 | if (status < 0) { | 626 | if (status < 0) { |
627 | mlog_errno(status); | 627 | mlog_errno(status); |
628 | goto bail_commit; | 628 | goto bail_commit; |
@@ -1190,8 +1190,8 @@ int ocfs2_mark_inode_dirty(handle_t *handle, | |||
1190 | mlog_entry("(inode %llu)\n", | 1190 | mlog_entry("(inode %llu)\n", |
1191 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1191 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
1192 | 1192 | ||
1193 | status = ocfs2_journal_access(handle, inode, bh, | 1193 | status = ocfs2_journal_access_di(handle, inode, bh, |
1194 | OCFS2_JOURNAL_ACCESS_WRITE); | 1194 | OCFS2_JOURNAL_ACCESS_WRITE); |
1195 | if (status < 0) { | 1195 | if (status < 0) { |
1196 | mlog_errno(status); | 1196 | mlog_errno(status); |
1197 | goto leave; | 1197 | goto leave; |
@@ -1277,8 +1277,11 @@ int ocfs2_validate_inode_block(struct super_block *sb, | |||
1277 | * local to this block. | 1277 | * local to this block. |
1278 | */ | 1278 | */ |
1279 | rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check); | 1279 | rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check); |
1280 | if (rc) | 1280 | if (rc) { |
1281 | mlog(ML_ERROR, "Checksum failed for dinode %llu\n", | ||
1282 | (unsigned long long)bh->b_blocknr); | ||
1281 | goto bail; | 1283 | goto bail; |
1284 | } | ||
1282 | 1285 | ||
1283 | /* | 1286 | /* |
1284 | * Errors after here are fatal. | 1287 | * Errors after here are fatal. |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 2daa5848faf2..3b54dba0f74b 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -752,6 +752,7 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
752 | if (replayed) | 752 | if (replayed) |
753 | ocfs2_bump_recovery_generation(fe); | 753 | ocfs2_bump_recovery_generation(fe); |
754 | 754 | ||
755 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); | ||
755 | status = ocfs2_write_block(osb, bh, journal->j_inode); | 756 | status = ocfs2_write_block(osb, bh, journal->j_inode); |
756 | if (status < 0) | 757 | if (status < 0) |
757 | mlog_errno(status); | 758 | mlog_errno(status); |
@@ -1486,6 +1487,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1486 | osb->slot_recovery_generations[slot_num] = | 1487 | osb->slot_recovery_generations[slot_num] = |
1487 | ocfs2_get_recovery_generation(fe); | 1488 | ocfs2_get_recovery_generation(fe); |
1488 | 1489 | ||
1490 | ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check); | ||
1489 | status = ocfs2_write_block(osb, bh, inode); | 1491 | status = ocfs2_write_block(osb, bh, inode); |
1490 | if (status < 0) | 1492 | if (status < 0) |
1491 | mlog_errno(status); | 1493 | mlog_errno(status); |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index bca370dab021..3c3532e1307c 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -247,9 +247,10 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks); | |||
247 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 | 247 | #define OCFS2_JOURNAL_ACCESS_WRITE 1 |
248 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 | 248 | #define OCFS2_JOURNAL_ACCESS_UNDO 2 |
249 | 249 | ||
250 | |||
250 | /* ocfs2_inode */ | 251 | /* ocfs2_inode */ |
251 | int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, | 252 | int ocfs2_journal_access_di(handle_t *handle, struct inode *inode, |
252 | struct buffer_head *bh, int type); | 253 | struct buffer_head *bh, int type); |
253 | /* ocfs2_extent_block */ | 254 | /* ocfs2_extent_block */ |
254 | int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, | 255 | int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode, |
255 | struct buffer_head *bh, int type); | 256 | struct buffer_head *bh, int type); |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index 19cfb1b9ce09..ec70cdbe77fc 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "ocfs2.h" | 36 | #include "ocfs2.h" |
37 | 37 | ||
38 | #include "alloc.h" | 38 | #include "alloc.h" |
39 | #include "blockcheck.h" | ||
39 | #include "dlmglue.h" | 40 | #include "dlmglue.h" |
40 | #include "inode.h" | 41 | #include "inode.h" |
41 | #include "journal.h" | 42 | #include "journal.h" |
@@ -382,8 +383,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) | |||
382 | } | 383 | } |
383 | memcpy(alloc_copy, alloc, bh->b_size); | 384 | memcpy(alloc_copy, alloc, bh->b_size); |
384 | 385 | ||
385 | status = ocfs2_journal_access(handle, local_alloc_inode, bh, | 386 | status = ocfs2_journal_access_di(handle, local_alloc_inode, bh, |
386 | OCFS2_JOURNAL_ACCESS_WRITE); | 387 | OCFS2_JOURNAL_ACCESS_WRITE); |
387 | if (status < 0) { | 388 | if (status < 0) { |
388 | mlog_errno(status); | 389 | mlog_errno(status); |
389 | goto out_commit; | 390 | goto out_commit; |
@@ -476,6 +477,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb, | |||
476 | alloc = (struct ocfs2_dinode *) alloc_bh->b_data; | 477 | alloc = (struct ocfs2_dinode *) alloc_bh->b_data; |
477 | ocfs2_clear_local_alloc(alloc); | 478 | ocfs2_clear_local_alloc(alloc); |
478 | 479 | ||
480 | ocfs2_compute_meta_ecc(osb->sb, alloc_bh->b_data, &alloc->i_check); | ||
479 | status = ocfs2_write_block(osb, alloc_bh, inode); | 481 | status = ocfs2_write_block(osb, alloc_bh, inode); |
480 | if (status < 0) | 482 | if (status < 0) |
481 | mlog_errno(status); | 483 | mlog_errno(status); |
@@ -762,9 +764,9 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
762 | * delete bits from it! */ | 764 | * delete bits from it! */ |
763 | *num_bits = bits_wanted; | 765 | *num_bits = bits_wanted; |
764 | 766 | ||
765 | status = ocfs2_journal_access(handle, local_alloc_inode, | 767 | status = ocfs2_journal_access_di(handle, local_alloc_inode, |
766 | osb->local_alloc_bh, | 768 | osb->local_alloc_bh, |
767 | OCFS2_JOURNAL_ACCESS_WRITE); | 769 | OCFS2_JOURNAL_ACCESS_WRITE); |
768 | if (status < 0) { | 770 | if (status < 0) { |
769 | mlog_errno(status); | 771 | mlog_errno(status); |
770 | goto bail; | 772 | goto bail; |
@@ -1240,9 +1242,9 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, | |||
1240 | } | 1242 | } |
1241 | memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); | 1243 | memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); |
1242 | 1244 | ||
1243 | status = ocfs2_journal_access(handle, local_alloc_inode, | 1245 | status = ocfs2_journal_access_di(handle, local_alloc_inode, |
1244 | osb->local_alloc_bh, | 1246 | osb->local_alloc_bh, |
1245 | OCFS2_JOURNAL_ACCESS_WRITE); | 1247 | OCFS2_JOURNAL_ACCESS_WRITE); |
1246 | if (status < 0) { | 1248 | if (status < 0) { |
1247 | mlog_errno(status); | 1249 | mlog_errno(status); |
1248 | goto bail; | 1250 | goto bail; |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 6173807ba23b..084aba86c3b2 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -361,8 +361,8 @@ static int ocfs2_mknod(struct inode *dir, | |||
361 | goto leave; | 361 | goto leave; |
362 | } | 362 | } |
363 | 363 | ||
364 | status = ocfs2_journal_access(handle, dir, parent_fe_bh, | 364 | status = ocfs2_journal_access_di(handle, dir, parent_fe_bh, |
365 | OCFS2_JOURNAL_ACCESS_WRITE); | 365 | OCFS2_JOURNAL_ACCESS_WRITE); |
366 | if (status < 0) { | 366 | if (status < 0) { |
367 | mlog_errno(status); | 367 | mlog_errno(status); |
368 | goto leave; | 368 | goto leave; |
@@ -493,8 +493,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
493 | } | 493 | } |
494 | ocfs2_set_new_buffer_uptodate(inode, *new_fe_bh); | 494 | ocfs2_set_new_buffer_uptodate(inode, *new_fe_bh); |
495 | 495 | ||
496 | status = ocfs2_journal_access(handle, inode, *new_fe_bh, | 496 | status = ocfs2_journal_access_di(handle, inode, *new_fe_bh, |
497 | OCFS2_JOURNAL_ACCESS_CREATE); | 497 | OCFS2_JOURNAL_ACCESS_CREATE); |
498 | if (status < 0) { | 498 | if (status < 0) { |
499 | mlog_errno(status); | 499 | mlog_errno(status); |
500 | goto leave; | 500 | goto leave; |
@@ -664,8 +664,8 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
664 | goto out_unlock_inode; | 664 | goto out_unlock_inode; |
665 | } | 665 | } |
666 | 666 | ||
667 | err = ocfs2_journal_access(handle, inode, fe_bh, | 667 | err = ocfs2_journal_access_di(handle, inode, fe_bh, |
668 | OCFS2_JOURNAL_ACCESS_WRITE); | 668 | OCFS2_JOURNAL_ACCESS_WRITE); |
669 | if (err < 0) { | 669 | if (err < 0) { |
670 | mlog_errno(err); | 670 | mlog_errno(err); |
671 | goto out_commit; | 671 | goto out_commit; |
@@ -851,8 +851,8 @@ static int ocfs2_unlink(struct inode *dir, | |||
851 | goto leave; | 851 | goto leave; |
852 | } | 852 | } |
853 | 853 | ||
854 | status = ocfs2_journal_access(handle, inode, fe_bh, | 854 | status = ocfs2_journal_access_di(handle, inode, fe_bh, |
855 | OCFS2_JOURNAL_ACCESS_WRITE); | 855 | OCFS2_JOURNAL_ACCESS_WRITE); |
856 | if (status < 0) { | 856 | if (status < 0) { |
857 | mlog_errno(status); | 857 | mlog_errno(status); |
858 | goto leave; | 858 | goto leave; |
@@ -1265,8 +1265,8 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1265 | goto bail; | 1265 | goto bail; |
1266 | } | 1266 | } |
1267 | } | 1267 | } |
1268 | status = ocfs2_journal_access(handle, new_inode, newfe_bh, | 1268 | status = ocfs2_journal_access_di(handle, new_inode, newfe_bh, |
1269 | OCFS2_JOURNAL_ACCESS_WRITE); | 1269 | OCFS2_JOURNAL_ACCESS_WRITE); |
1270 | if (status < 0) { | 1270 | if (status < 0) { |
1271 | mlog_errno(status); | 1271 | mlog_errno(status); |
1272 | goto bail; | 1272 | goto bail; |
@@ -1312,8 +1312,8 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1312 | old_inode->i_ctime = CURRENT_TIME; | 1312 | old_inode->i_ctime = CURRENT_TIME; |
1313 | mark_inode_dirty(old_inode); | 1313 | mark_inode_dirty(old_inode); |
1314 | 1314 | ||
1315 | status = ocfs2_journal_access(handle, old_inode, old_inode_bh, | 1315 | status = ocfs2_journal_access_di(handle, old_inode, old_inode_bh, |
1316 | OCFS2_JOURNAL_ACCESS_WRITE); | 1316 | OCFS2_JOURNAL_ACCESS_WRITE); |
1317 | if (status >= 0) { | 1317 | if (status >= 0) { |
1318 | old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; | 1318 | old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; |
1319 | 1319 | ||
@@ -1389,9 +1389,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1389 | (int)old_dir_nlink, old_dir->i_nlink); | 1389 | (int)old_dir_nlink, old_dir->i_nlink); |
1390 | } else { | 1390 | } else { |
1391 | struct ocfs2_dinode *fe; | 1391 | struct ocfs2_dinode *fe; |
1392 | status = ocfs2_journal_access(handle, old_dir, | 1392 | status = ocfs2_journal_access_di(handle, old_dir, |
1393 | old_dir_bh, | 1393 | old_dir_bh, |
1394 | OCFS2_JOURNAL_ACCESS_WRITE); | 1394 | OCFS2_JOURNAL_ACCESS_WRITE); |
1395 | fe = (struct ocfs2_dinode *) old_dir_bh->b_data; | 1395 | fe = (struct ocfs2_dinode *) old_dir_bh->b_data; |
1396 | fe->i_links_count = cpu_to_le16(old_dir->i_nlink); | 1396 | fe->i_links_count = cpu_to_le16(old_dir->i_nlink); |
1397 | status = ocfs2_journal_dirty(handle, old_dir_bh); | 1397 | status = ocfs2_journal_dirty(handle, old_dir_bh); |
@@ -1898,8 +1898,8 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
1898 | goto leave; | 1898 | goto leave; |
1899 | } | 1899 | } |
1900 | 1900 | ||
1901 | status = ocfs2_journal_access(handle, orphan_dir_inode, orphan_dir_bh, | 1901 | status = ocfs2_journal_access_di(handle, orphan_dir_inode, orphan_dir_bh, |
1902 | OCFS2_JOURNAL_ACCESS_WRITE); | 1902 | OCFS2_JOURNAL_ACCESS_WRITE); |
1903 | if (status < 0) { | 1903 | if (status < 0) { |
1904 | mlog_errno(status); | 1904 | mlog_errno(status); |
1905 | goto leave; | 1905 | goto leave; |
@@ -1986,8 +1986,8 @@ int ocfs2_orphan_del(struct ocfs2_super *osb, | |||
1986 | goto leave; | 1986 | goto leave; |
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | status = ocfs2_journal_access(handle,orphan_dir_inode, orphan_dir_bh, | 1989 | status = ocfs2_journal_access_di(handle,orphan_dir_inode, orphan_dir_bh, |
1990 | OCFS2_JOURNAL_ACCESS_WRITE); | 1990 | OCFS2_JOURNAL_ACCESS_WRITE); |
1991 | if (status < 0) { | 1991 | if (status < 0) { |
1992 | mlog_errno(status); | 1992 | mlog_errno(status); |
1993 | goto leave; | 1993 | goto leave; |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index 2bb389fe7397..bad87d0a03c9 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -339,6 +339,10 @@ struct ocfs2_super | |||
339 | 339 | ||
340 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) | 340 | #define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) |
341 | 341 | ||
342 | /* Useful typedef for passing around journal access functions */ | ||
343 | typedef int (*ocfs2_journal_access_func)(handle_t *handle, struct inode *inode, | ||
344 | struct buffer_head *bh, int type); | ||
345 | |||
342 | static inline int ocfs2_should_order_data(struct inode *inode) | 346 | static inline int ocfs2_should_order_data(struct inode *inode) |
343 | { | 347 | { |
344 | if (!S_ISREG(inode->i_mode)) | 348 | if (!S_ISREG(inode->i_mode)) |
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index a0b8b14cca8f..444aa5a467fb 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -244,7 +244,7 @@ ssize_t ocfs2_quota_write(struct super_block *sb, int type, | |||
244 | set_buffer_uptodate(bh); | 244 | set_buffer_uptodate(bh); |
245 | unlock_buffer(bh); | 245 | unlock_buffer(bh); |
246 | ocfs2_set_buffer_uptodate(gqinode, bh); | 246 | ocfs2_set_buffer_uptodate(gqinode, bh); |
247 | err = ocfs2_journal_access(handle, gqinode, bh, ja_type); | 247 | err = ocfs2_journal_access_dq(handle, gqinode, bh, ja_type); |
248 | if (err < 0) { | 248 | if (err < 0) { |
249 | brelse(bh); | 249 | brelse(bh); |
250 | goto out; | 250 | goto out; |
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index d451b715aefe..07deec5e9721 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -106,8 +106,8 @@ static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh, | |||
106 | mlog_errno(status); | 106 | mlog_errno(status); |
107 | return status; | 107 | return status; |
108 | } | 108 | } |
109 | status = ocfs2_journal_access(handle, inode, bh, | 109 | status = ocfs2_journal_access_dq(handle, inode, bh, |
110 | OCFS2_JOURNAL_ACCESS_WRITE); | 110 | OCFS2_JOURNAL_ACCESS_WRITE); |
111 | if (status < 0) { | 111 | if (status < 0) { |
112 | mlog_errno(status); | 112 | mlog_errno(status); |
113 | ocfs2_commit_trans(OCFS2_SB(sb), handle); | 113 | ocfs2_commit_trans(OCFS2_SB(sb), handle); |
@@ -506,7 +506,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, | |||
506 | goto out_commit; | 506 | goto out_commit; |
507 | } | 507 | } |
508 | /* Release local quota file entry */ | 508 | /* Release local quota file entry */ |
509 | status = ocfs2_journal_access(handle, lqinode, | 509 | status = ocfs2_journal_access_dq(handle, lqinode, |
510 | qbh, OCFS2_JOURNAL_ACCESS_WRITE); | 510 | qbh, OCFS2_JOURNAL_ACCESS_WRITE); |
511 | if (status < 0) { | 511 | if (status < 0) { |
512 | mlog_errno(status); | 512 | mlog_errno(status); |
@@ -614,8 +614,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
614 | mlog_errno(status); | 614 | mlog_errno(status); |
615 | goto out_bh; | 615 | goto out_bh; |
616 | } | 616 | } |
617 | status = ocfs2_journal_access(handle, lqinode, bh, | 617 | status = ocfs2_journal_access_dq(handle, lqinode, bh, |
618 | OCFS2_JOURNAL_ACCESS_WRITE); | 618 | OCFS2_JOURNAL_ACCESS_WRITE); |
619 | if (status < 0) { | 619 | if (status < 0) { |
620 | mlog_errno(status); | 620 | mlog_errno(status); |
621 | goto out_trans; | 621 | goto out_trans; |
@@ -981,8 +981,8 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( | |||
981 | goto out; | 981 | goto out; |
982 | } | 982 | } |
983 | 983 | ||
984 | status = ocfs2_journal_access(handle, lqinode, bh, | 984 | status = ocfs2_journal_access_dq(handle, lqinode, bh, |
985 | OCFS2_JOURNAL_ACCESS_WRITE); | 985 | OCFS2_JOURNAL_ACCESS_WRITE); |
986 | if (status < 0) { | 986 | if (status < 0) { |
987 | mlog_errno(status); | 987 | mlog_errno(status); |
988 | goto out_trans; | 988 | goto out_trans; |
@@ -1074,7 +1074,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( | |||
1074 | mlog_errno(status); | 1074 | mlog_errno(status); |
1075 | goto out; | 1075 | goto out; |
1076 | } | 1076 | } |
1077 | status = ocfs2_journal_access(handle, lqinode, chunk->qc_headerbh, | 1077 | status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh, |
1078 | OCFS2_JOURNAL_ACCESS_WRITE); | 1078 | OCFS2_JOURNAL_ACCESS_WRITE); |
1079 | if (status < 0) { | 1079 | if (status < 0) { |
1080 | mlog_errno(status); | 1080 | mlog_errno(status); |
@@ -1207,7 +1207,7 @@ static int ocfs2_local_release_dquot(struct dquot *dquot) | |||
1207 | goto out; | 1207 | goto out; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | status = ocfs2_journal_access(handle, sb_dqopt(sb)->files[type], | 1210 | status = ocfs2_journal_access_dq(handle, sb_dqopt(sb)->files[type], |
1211 | od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE); | 1211 | od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE); |
1212 | if (status < 0) { | 1212 | if (status < 0) { |
1213 | mlog_errno(status); | 1213 | mlog_errno(status); |
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c index 867de3ebfcaf..424adaa5f900 100644 --- a/fs/ocfs2/resize.c +++ b/fs/ocfs2/resize.c | |||
@@ -106,8 +106,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle, | |||
106 | mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", | 106 | mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", |
107 | new_clusters, first_new_cluster); | 107 | new_clusters, first_new_cluster); |
108 | 108 | ||
109 | ret = ocfs2_journal_access(handle, bm_inode, group_bh, | 109 | ret = ocfs2_journal_access_gd(handle, bm_inode, group_bh, |
110 | OCFS2_JOURNAL_ACCESS_WRITE); | 110 | OCFS2_JOURNAL_ACCESS_WRITE); |
111 | if (ret < 0) { | 111 | if (ret < 0) { |
112 | mlog_errno(ret); | 112 | mlog_errno(ret); |
113 | goto out; | 113 | goto out; |
@@ -141,8 +141,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle, | |||
141 | } | 141 | } |
142 | 142 | ||
143 | /* update the inode accordingly. */ | 143 | /* update the inode accordingly. */ |
144 | ret = ocfs2_journal_access(handle, bm_inode, bm_bh, | 144 | ret = ocfs2_journal_access_di(handle, bm_inode, bm_bh, |
145 | OCFS2_JOURNAL_ACCESS_WRITE); | 145 | OCFS2_JOURNAL_ACCESS_WRITE); |
146 | if (ret < 0) { | 146 | if (ret < 0) { |
147 | mlog_errno(ret); | 147 | mlog_errno(ret); |
148 | goto out_rollback; | 148 | goto out_rollback; |
@@ -536,8 +536,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
536 | cl = &fe->id2.i_chain; | 536 | cl = &fe->id2.i_chain; |
537 | cr = &cl->cl_recs[input->chain]; | 537 | cr = &cl->cl_recs[input->chain]; |
538 | 538 | ||
539 | ret = ocfs2_journal_access(handle, main_bm_inode, group_bh, | 539 | ret = ocfs2_journal_access_gd(handle, main_bm_inode, group_bh, |
540 | OCFS2_JOURNAL_ACCESS_WRITE); | 540 | OCFS2_JOURNAL_ACCESS_WRITE); |
541 | if (ret < 0) { | 541 | if (ret < 0) { |
542 | mlog_errno(ret); | 542 | mlog_errno(ret); |
543 | goto out_commit; | 543 | goto out_commit; |
@@ -552,8 +552,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
552 | goto out_commit; | 552 | goto out_commit; |
553 | } | 553 | } |
554 | 554 | ||
555 | ret = ocfs2_journal_access(handle, main_bm_inode, main_bm_bh, | 555 | ret = ocfs2_journal_access_di(handle, main_bm_inode, main_bm_bh, |
556 | OCFS2_JOURNAL_ACCESS_WRITE); | 556 | OCFS2_JOURNAL_ACCESS_WRITE); |
557 | if (ret < 0) { | 557 | if (ret < 0) { |
558 | mlog_errno(ret); | 558 | mlog_errno(ret); |
559 | goto out_commit; | 559 | goto out_commit; |
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; |