alloc.c (ffdd7a54631f07918b75e324d86713a08c11ec06) | alloc.c (13723d00e374c2a6d6ccb5af6de965e89c3e1b01) |
---|---|
1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * alloc.c 5 * 6 * Extent allocs and frees 7 * 8 * Copyright (C) 2002, 2004 Oracle. All rights reserved. --- 284 unchanged lines hidden (view full) --- 293 .eo_update_clusters = ocfs2_xattr_tree_update_clusters, 294 .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el, 295 .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, 296}; 297 298static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, 299 struct inode *inode, 300 struct buffer_head *bh, | 1/* -*- mode: c; c-basic-offset: 8; -*- 2 * vim: noexpandtab sw=8 ts=8 sts=0: 3 * 4 * alloc.c 5 * 6 * Extent allocs and frees 7 * 8 * Copyright (C) 2002, 2004 Oracle. All rights reserved. --- 284 unchanged lines hidden (view full) --- 293 .eo_update_clusters = ocfs2_xattr_tree_update_clusters, 294 .eo_fill_root_el = ocfs2_xattr_tree_fill_root_el, 295 .eo_fill_max_leaf_clusters = ocfs2_xattr_tree_fill_max_leaf_clusters, 296}; 297 298static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, 299 struct inode *inode, 300 struct buffer_head *bh, |
301 ocfs2_journal_access_func access, |
|
301 void *obj, 302 struct ocfs2_extent_tree_operations *ops) 303{ 304 et->et_ops = ops; 305 et->et_root_bh = bh; | 302 void *obj, 303 struct ocfs2_extent_tree_operations *ops) 304{ 305 et->et_ops = ops; 306 et->et_root_bh = bh; |
307 et->et_root_journal_access = access; |
|
306 if (!obj) 307 obj = (void *)bh->b_data; 308 et->et_object = obj; 309 310 et->et_ops->eo_fill_root_el(et); 311 if (!et->et_ops->eo_fill_max_leaf_clusters) 312 et->et_max_leaf_clusters = 0; 313 else 314 et->et_ops->eo_fill_max_leaf_clusters(inode, et); 315} 316 317void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, 318 struct inode *inode, 319 struct buffer_head *bh) 320{ | 308 if (!obj) 309 obj = (void *)bh->b_data; 310 et->et_object = obj; 311 312 et->et_ops->eo_fill_root_el(et); 313 if (!et->et_ops->eo_fill_max_leaf_clusters) 314 et->et_max_leaf_clusters = 0; 315 else 316 et->et_ops->eo_fill_max_leaf_clusters(inode, et); 317} 318 319void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et, 320 struct inode *inode, 321 struct buffer_head *bh) 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} 323 324void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, 325 struct inode *inode, 326 struct buffer_head *bh) 327{ | 325} 326 327void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, 328 struct inode *inode, 329 struct buffer_head *bh) 330{ |
328 __ocfs2_init_extent_tree(et, inode, bh, NULL, 329 &ocfs2_xattr_tree_et_ops); | 331 __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_xb, 332 NULL, &ocfs2_xattr_tree_et_ops); |
330} 331 332void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, 333 struct inode *inode, 334 struct buffer_head *bh, 335 struct ocfs2_xattr_value_root *xv) 336{ | 333} 334 335void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, 336 struct inode *inode, 337 struct buffer_head *bh, 338 struct ocfs2_xattr_value_root *xv) 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); 339} 340 341static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, 342 u64 new_last_eb_blk) 343{ 344 et->et_ops->eo_set_last_eb_blk(et, new_last_eb_blk); 345} --- 5 unchanged lines hidden (view full) --- 351 352static inline void ocfs2_et_update_clusters(struct inode *inode, 353 struct ocfs2_extent_tree *et, 354 u32 clusters) 355{ 356 et->et_ops->eo_update_clusters(inode, et, clusters); 357} 358 | 341 &ocfs2_xattr_value_et_ops); 342} 343 344static inline void ocfs2_et_set_last_eb_blk(struct ocfs2_extent_tree *et, 345 u64 new_last_eb_blk) 346{ 347 et->et_ops->eo_set_last_eb_blk(et, new_last_eb_blk); 348} --- 5 unchanged lines hidden (view full) --- 354 355static inline void ocfs2_et_update_clusters(struct inode *inode, 356 struct ocfs2_extent_tree *et, 357 u32 clusters) 358{ 359 et->et_ops->eo_update_clusters(inode, et, clusters); 360} 361 |
362static 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 |
|
359static inline int ocfs2_et_insert_check(struct inode *inode, 360 struct ocfs2_extent_tree *et, 361 struct ocfs2_extent_rec *rec) 362{ 363 int ret = 0; 364 365 if (et->et_ops->eo_insert_check) 366 ret = et->et_ops->eo_insert_check(inode, et, rec); --- 24 unchanged lines hidden (view full) --- 391struct ocfs2_path_item { 392 struct buffer_head *bh; 393 struct ocfs2_extent_list *el; 394}; 395 396#define OCFS2_MAX_PATH_DEPTH 5 397 398struct ocfs2_path { | 371static inline int ocfs2_et_insert_check(struct inode *inode, 372 struct ocfs2_extent_tree *et, 373 struct ocfs2_extent_rec *rec) 374{ 375 int ret = 0; 376 377 if (et->et_ops->eo_insert_check) 378 ret = et->et_ops->eo_insert_check(inode, et, rec); --- 24 unchanged lines hidden (view full) --- 403struct ocfs2_path_item { 404 struct buffer_head *bh; 405 struct ocfs2_extent_list *el; 406}; 407 408#define OCFS2_MAX_PATH_DEPTH 5 409 410struct ocfs2_path { |
399 int p_tree_depth; 400 struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH]; | 411 int p_tree_depth; 412 ocfs2_journal_access_func p_root_access; 413 struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH]; |
401}; 402 403#define path_root_bh(_path) ((_path)->p_node[0].bh) 404#define path_root_el(_path) ((_path)->p_node[0].el) | 414}; 415 416#define path_root_bh(_path) ((_path)->p_node[0].bh) 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) 406#define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el) 407#define path_num_items(_path) ((_path)->p_tree_depth + 1) 408 409/* 410 * Reset the actual path elements so that we can re-use the structure 411 * to build another path. Generally, this involves freeing the buffer 412 * heads. --- 16 unchanged lines hidden (view full) --- 429 430 /* 431 * Tree depth may change during truncate, or insert. If we're 432 * keeping the root extent list, then make sure that our path 433 * structure reflects the proper depth. 434 */ 435 if (keep_root) 436 depth = le16_to_cpu(path_root_el(path)->l_tree_depth); | 419#define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh) 420#define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el) 421#define path_num_items(_path) ((_path)->p_tree_depth + 1) 422 423/* 424 * Reset the actual path elements so that we can re-use the structure 425 * to build another path. Generally, this involves freeing the buffer 426 * heads. --- 16 unchanged lines hidden (view full) --- 443 444 /* 445 * Tree depth may change during truncate, or insert. If we're 446 * keeping the root extent list, then make sure that our path 447 * structure reflects the proper depth. 448 */ 449 if (keep_root) 450 depth = le16_to_cpu(path_root_el(path)->l_tree_depth); |
451 else 452 path_root_access(path) = NULL; |
|
437 438 path->p_tree_depth = depth; 439} 440 441static void ocfs2_free_path(struct ocfs2_path *path) 442{ 443 if (path) { 444 ocfs2_reinit_path(path, 0); --- 9 unchanged lines hidden (view full) --- 454 * will be freed. 455 */ 456static void ocfs2_cp_path(struct ocfs2_path *dest, struct ocfs2_path *src) 457{ 458 int i; 459 460 BUG_ON(path_root_bh(dest) != path_root_bh(src)); 461 BUG_ON(path_root_el(dest) != path_root_el(src)); | 453 454 path->p_tree_depth = depth; 455} 456 457static void ocfs2_free_path(struct ocfs2_path *path) 458{ 459 if (path) { 460 ocfs2_reinit_path(path, 0); --- 9 unchanged lines hidden (view full) --- 470 * will be freed. 471 */ 472static void ocfs2_cp_path(struct ocfs2_path *dest, struct ocfs2_path *src) 473{ 474 int i; 475 476 BUG_ON(path_root_bh(dest) != path_root_bh(src)); 477 BUG_ON(path_root_el(dest) != path_root_el(src)); |
478 BUG_ON(path_root_access(dest) != path_root_access(src)); |
|
462 463 ocfs2_reinit_path(dest, 1); 464 465 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { 466 dest->p_node[i].bh = src->p_node[i].bh; 467 dest->p_node[i].el = src->p_node[i].el; 468 469 if (dest->p_node[i].bh) --- 5 unchanged lines hidden (view full) --- 475 * Make the *dest path the same as src and re-initialize src path to 476 * have a root only. 477 */ 478static void ocfs2_mv_path(struct ocfs2_path *dest, struct ocfs2_path *src) 479{ 480 int i; 481 482 BUG_ON(path_root_bh(dest) != path_root_bh(src)); | 479 480 ocfs2_reinit_path(dest, 1); 481 482 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { 483 dest->p_node[i].bh = src->p_node[i].bh; 484 dest->p_node[i].el = src->p_node[i].el; 485 486 if (dest->p_node[i].bh) --- 5 unchanged lines hidden (view full) --- 492 * Make the *dest path the same as src and re-initialize src path to 493 * have a root only. 494 */ 495static void ocfs2_mv_path(struct ocfs2_path *dest, struct ocfs2_path *src) 496{ 497 int i; 498 499 BUG_ON(path_root_bh(dest) != path_root_bh(src)); |
500 BUG_ON(path_root_access(dest) != path_root_access(src)); |
|
483 484 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { 485 brelse(dest->p_node[i].bh); 486 487 dest->p_node[i].bh = src->p_node[i].bh; 488 dest->p_node[i].el = src->p_node[i].el; 489 490 src->p_node[i].bh = NULL; --- 19 unchanged lines hidden (view full) --- 510 */ 511 BUG_ON(index == 0); 512 513 path->p_node[index].bh = eb_bh; 514 path->p_node[index].el = &eb->h_list; 515} 516 517static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, | 501 502 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { 503 brelse(dest->p_node[i].bh); 504 505 dest->p_node[i].bh = src->p_node[i].bh; 506 dest->p_node[i].el = src->p_node[i].el; 507 508 src->p_node[i].bh = NULL; --- 19 unchanged lines hidden (view full) --- 528 */ 529 BUG_ON(index == 0); 530 531 path->p_node[index].bh = eb_bh; 532 path->p_node[index].el = &eb->h_list; 533} 534 535static 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{ 520 struct ocfs2_path *path; 521 522 BUG_ON(le16_to_cpu(root_el->l_tree_depth) >= OCFS2_MAX_PATH_DEPTH); 523 524 path = kzalloc(sizeof(*path), GFP_NOFS); 525 if (path) { 526 path->p_tree_depth = le16_to_cpu(root_el->l_tree_depth); 527 get_bh(root_bh); 528 path_root_bh(path) = root_bh; 529 path_root_el(path) = root_el; | 538{ 539 struct ocfs2_path *path; 540 541 BUG_ON(le16_to_cpu(root_el->l_tree_depth) >= OCFS2_MAX_PATH_DEPTH); 542 543 path = kzalloc(sizeof(*path), GFP_NOFS); 544 if (path) { 545 path->p_tree_depth = le16_to_cpu(root_el->l_tree_depth); 546 get_bh(root_bh); 547 path_root_bh(path) = root_bh; 548 path_root_el(path) = root_el; |
549 path_root_access(path) = access; |
|
530 } 531 532 return path; 533} 534 535static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path) 536{ | 550 } 551 552 return path; 553} 554 555static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path) 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} 539 540static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et) 541{ | 559} 560 561static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et) 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); |
543} 544 545/* | 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 */ 574static 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); 589} 590 591/* |
|
546 * Convenience function to journal all components in a path. 547 */ 548static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, 549 struct ocfs2_path *path) 550{ 551 int i, ret = 0; 552 553 if (!path) 554 goto out; 555 556 for(i = 0; i < path_num_items(path); i++) { | 592 * Convenience function to journal all components in a path. 593 */ 594static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle, 595 struct ocfs2_path *path) 596{ 597 int i, ret = 0; 598 599 if (!path) 600 goto out; 601 602 for(i = 0; i < path_num_items(path); i++) { |
557 ret = ocfs2_journal_access(handle, inode, path->p_node[i].bh, 558 OCFS2_JOURNAL_ACCESS_WRITE); | 603 ret = ocfs2_path_bh_journal_access(handle, inode, path, i); |
559 if (ret < 0) { 560 mlog_errno(ret); 561 goto out; 562 } 563 } 564 565out: 566 return ret; --- 136 unchanged lines hidden (view full) --- 703 BUG_ON(!buffer_uptodate(bh)); 704 705 /* 706 * If the ecc fails, we return the error but otherwise 707 * leave the filesystem running. We know any error is 708 * local to this block. 709 */ 710 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &eb->h_check); | 604 if (ret < 0) { 605 mlog_errno(ret); 606 goto out; 607 } 608 } 609 610out: 611 return ret; --- 136 unchanged lines hidden (view full) --- 748 BUG_ON(!buffer_uptodate(bh)); 749 750 /* 751 * If the ecc fails, we return the error but otherwise 752 * leave the filesystem running. We know any error is 753 * local to this block. 754 */ 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 714 /* 715 * Errors after here are fatal. 716 */ 717 718 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { 719 ocfs2_error(sb, 720 "Extent block #%llu has bad signature %.*s", --- 116 unchanged lines hidden (view full) --- 837 bhs[i] = sb_getblk(osb->sb, first_blkno); 838 if (bhs[i] == NULL) { 839 status = -EIO; 840 mlog_errno(status); 841 goto bail; 842 } 843 ocfs2_set_new_buffer_uptodate(inode, bhs[i]); 844 | 761 762 /* 763 * Errors after here are fatal. 764 */ 765 766 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { 767 ocfs2_error(sb, 768 "Extent block #%llu has bad signature %.*s", --- 116 unchanged lines hidden (view full) --- 885 bhs[i] = sb_getblk(osb->sb, first_blkno); 886 if (bhs[i] == NULL) { 887 status = -EIO; 888 mlog_errno(status); 889 goto bail; 890 } 891 ocfs2_set_new_buffer_uptodate(inode, bhs[i]); 892 |
845 status = ocfs2_journal_access(handle, inode, bhs[i], 846 OCFS2_JOURNAL_ACCESS_CREATE); | 893 status = ocfs2_journal_access_eb(handle, inode, bhs[i], 894 OCFS2_JOURNAL_ACCESS_CREATE); |
847 if (status < 0) { 848 mlog_errno(status); 849 goto bail; 850 } 851 852 memset(bhs[i]->b_data, 0, osb->sb->s_blocksize); 853 eb = (struct ocfs2_extent_block *) bhs[i]->b_data; 854 /* Ok, setup the minimal stuff here. */ --- 126 unchanged lines hidden (view full) --- 981 next_blkno = new_last_eb_blk = 0; 982 for(i = 0; i < new_blocks; i++) { 983 bh = new_eb_bhs[i]; 984 eb = (struct ocfs2_extent_block *) bh->b_data; 985 /* ocfs2_create_new_meta_bhs() should create it right! */ 986 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); 987 eb_el = &eb->h_list; 988 | 895 if (status < 0) { 896 mlog_errno(status); 897 goto bail; 898 } 899 900 memset(bhs[i]->b_data, 0, osb->sb->s_blocksize); 901 eb = (struct ocfs2_extent_block *) bhs[i]->b_data; 902 /* Ok, setup the minimal stuff here. */ --- 126 unchanged lines hidden (view full) --- 1029 next_blkno = new_last_eb_blk = 0; 1030 for(i = 0; i < new_blocks; i++) { 1031 bh = new_eb_bhs[i]; 1032 eb = (struct ocfs2_extent_block *) bh->b_data; 1033 /* ocfs2_create_new_meta_bhs() should create it right! */ 1034 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); 1035 eb_el = &eb->h_list; 1036 |
989 status = ocfs2_journal_access(handle, inode, bh, 990 OCFS2_JOURNAL_ACCESS_CREATE); | 1037 status = ocfs2_journal_access_eb(handle, inode, bh, 1038 OCFS2_JOURNAL_ACCESS_CREATE); |
991 if (status < 0) { 992 mlog_errno(status); 993 goto bail; 994 } 995 996 eb->h_next_leaf_blk = 0; 997 eb_el->l_tree_depth = cpu_to_le16(i); 998 eb_el->l_next_free_rec = cpu_to_le16(1); --- 22 unchanged lines hidden (view full) --- 1021 } 1022 1023 /* This is a bit hairy. We want to update up to three blocks 1024 * here without leaving any of them in an inconsistent state 1025 * in case of error. We don't have to worry about 1026 * journal_dirty erroring as it won't unless we've aborted the 1027 * handle (in which case we would never be here) so reserving 1028 * the write with journal_access is all we need to do. */ | 1039 if (status < 0) { 1040 mlog_errno(status); 1041 goto bail; 1042 } 1043 1044 eb->h_next_leaf_blk = 0; 1045 eb_el->l_tree_depth = cpu_to_le16(i); 1046 eb_el->l_next_free_rec = cpu_to_le16(1); --- 22 unchanged lines hidden (view full) --- 1069 } 1070 1071 /* This is a bit hairy. We want to update up to three blocks 1072 * here without leaving any of them in an inconsistent state 1073 * in case of error. We don't have to worry about 1074 * journal_dirty erroring as it won't unless we've aborted the 1075 * handle (in which case we would never be here) so reserving 1076 * the write with journal_access is all we need to do. */ |
1029 status = ocfs2_journal_access(handle, inode, *last_eb_bh, 1030 OCFS2_JOURNAL_ACCESS_WRITE); | 1077 status = ocfs2_journal_access_eb(handle, inode, *last_eb_bh, 1078 OCFS2_JOURNAL_ACCESS_WRITE); |
1031 if (status < 0) { 1032 mlog_errno(status); 1033 goto bail; 1034 } | 1079 if (status < 0) { 1080 mlog_errno(status); 1081 goto bail; 1082 } |
1035 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 1036 OCFS2_JOURNAL_ACCESS_WRITE); | 1083 status = ocfs2_et_root_journal_access(handle, inode, et, 1084 OCFS2_JOURNAL_ACCESS_WRITE); |
1037 if (status < 0) { 1038 mlog_errno(status); 1039 goto bail; 1040 } 1041 if (eb_bh) { | 1085 if (status < 0) { 1086 mlog_errno(status); 1087 goto bail; 1088 } 1089 if (eb_bh) { |
1042 status = ocfs2_journal_access(handle, inode, eb_bh, 1043 OCFS2_JOURNAL_ACCESS_WRITE); | 1090 status = ocfs2_journal_access_eb(handle, inode, eb_bh, 1091 OCFS2_JOURNAL_ACCESS_WRITE); |
1044 if (status < 0) { 1045 mlog_errno(status); 1046 goto bail; 1047 } 1048 } 1049 1050 /* Link the new branch into the rest of the tree (el will 1051 * either be on the root_bh, or the extent block passed in. */ --- 72 unchanged lines hidden (view full) --- 1124 1125 eb = (struct ocfs2_extent_block *) new_eb_bh->b_data; 1126 /* ocfs2_create_new_meta_bhs() should create it right! */ 1127 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); 1128 1129 eb_el = &eb->h_list; 1130 root_el = et->et_root_el; 1131 | 1092 if (status < 0) { 1093 mlog_errno(status); 1094 goto bail; 1095 } 1096 } 1097 1098 /* Link the new branch into the rest of the tree (el will 1099 * either be on the root_bh, or the extent block passed in. */ --- 72 unchanged lines hidden (view full) --- 1172 1173 eb = (struct ocfs2_extent_block *) new_eb_bh->b_data; 1174 /* ocfs2_create_new_meta_bhs() should create it right! */ 1175 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb)); 1176 1177 eb_el = &eb->h_list; 1178 root_el = et->et_root_el; 1179 |
1132 status = ocfs2_journal_access(handle, inode, new_eb_bh, 1133 OCFS2_JOURNAL_ACCESS_CREATE); | 1180 status = ocfs2_journal_access_eb(handle, inode, new_eb_bh, 1181 OCFS2_JOURNAL_ACCESS_CREATE); |
1134 if (status < 0) { 1135 mlog_errno(status); 1136 goto bail; 1137 } 1138 1139 /* copy the root extent list data into the new extent block */ 1140 eb_el->l_tree_depth = root_el->l_tree_depth; 1141 eb_el->l_next_free_rec = root_el->l_next_free_rec; 1142 for (i = 0; i < le16_to_cpu(root_el->l_next_free_rec); i++) 1143 eb_el->l_recs[i] = root_el->l_recs[i]; 1144 1145 status = ocfs2_journal_dirty(handle, new_eb_bh); 1146 if (status < 0) { 1147 mlog_errno(status); 1148 goto bail; 1149 } 1150 | 1182 if (status < 0) { 1183 mlog_errno(status); 1184 goto bail; 1185 } 1186 1187 /* copy the root extent list data into the new extent block */ 1188 eb_el->l_tree_depth = root_el->l_tree_depth; 1189 eb_el->l_next_free_rec = root_el->l_next_free_rec; 1190 for (i = 0; i < le16_to_cpu(root_el->l_next_free_rec); i++) 1191 eb_el->l_recs[i] = root_el->l_recs[i]; 1192 1193 status = ocfs2_journal_dirty(handle, new_eb_bh); 1194 if (status < 0) { 1195 mlog_errno(status); 1196 goto bail; 1197 } 1198 |
1151 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 1152 OCFS2_JOURNAL_ACCESS_WRITE); | 1199 status = ocfs2_et_root_journal_access(handle, inode, et, 1200 OCFS2_JOURNAL_ACCESS_WRITE); |
1153 if (status < 0) { 1154 mlog_errno(status); 1155 goto bail; 1156 } 1157 1158 new_clusters = ocfs2_sum_rightmost_rec(eb_el); 1159 1160 /* update root_bh now */ --- 752 unchanged lines hidden (view full) --- 1913 * return early if so. 1914 */ 1915 if (ocfs2_is_empty_extent(&left_el->l_recs[0])) 1916 return 0; 1917 1918 root_bh = left_path->p_node[subtree_index].bh; 1919 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 1920 | 1201 if (status < 0) { 1202 mlog_errno(status); 1203 goto bail; 1204 } 1205 1206 new_clusters = ocfs2_sum_rightmost_rec(eb_el); 1207 1208 /* update root_bh now */ --- 752 unchanged lines hidden (view full) --- 1961 * return early if so. 1962 */ 1963 if (ocfs2_is_empty_extent(&left_el->l_recs[0])) 1964 return 0; 1965 1966 root_bh = left_path->p_node[subtree_index].bh; 1967 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 1968 |
1921 ret = ocfs2_journal_access(handle, inode, root_bh, 1922 OCFS2_JOURNAL_ACCESS_WRITE); | 1969 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 1970 subtree_index); |
1923 if (ret) { 1924 mlog_errno(ret); 1925 goto out; 1926 } 1927 1928 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { | 1971 if (ret) { 1972 mlog_errno(ret); 1973 goto out; 1974 } 1975 1976 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { |
1929 ret = ocfs2_journal_access(handle, inode, 1930 right_path->p_node[i].bh, 1931 OCFS2_JOURNAL_ACCESS_WRITE); | 1977 ret = ocfs2_path_bh_journal_access(handle, inode, 1978 right_path, i); |
1932 if (ret) { 1933 mlog_errno(ret); 1934 goto out; 1935 } 1936 | 1979 if (ret) { 1980 mlog_errno(ret); 1981 goto out; 1982 } 1983 |
1937 ret = ocfs2_journal_access(handle, inode, 1938 left_path->p_node[i].bh, 1939 OCFS2_JOURNAL_ACCESS_WRITE); | 1984 ret = ocfs2_path_bh_journal_access(handle, inode, 1985 left_path, i); |
1940 if (ret) { 1941 mlog_errno(ret); 1942 goto out; 1943 } 1944 } 1945 1946 right_leaf_bh = path_leaf_bh(right_path); 1947 right_el = path_leaf_el(right_path); --- 502 unchanged lines hidden (view full) --- 2450 * Non rightmost leaves will throw -EAGAIN and the 2451 * caller can manually move the subtree and retry. 2452 */ 2453 2454 if (eb->h_next_leaf_blk != 0ULL) 2455 return -EAGAIN; 2456 2457 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { | 1986 if (ret) { 1987 mlog_errno(ret); 1988 goto out; 1989 } 1990 } 1991 1992 right_leaf_bh = path_leaf_bh(right_path); 1993 right_el = path_leaf_el(right_path); --- 502 unchanged lines hidden (view full) --- 2496 * Non rightmost leaves will throw -EAGAIN and the 2497 * caller can manually move the subtree and retry. 2498 */ 2499 2500 if (eb->h_next_leaf_blk != 0ULL) 2501 return -EAGAIN; 2502 2503 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { |
2458 ret = ocfs2_journal_access(handle, inode, 2459 path_leaf_bh(right_path), 2460 OCFS2_JOURNAL_ACCESS_WRITE); | 2504 ret = ocfs2_journal_access_eb(handle, inode, 2505 path_leaf_bh(right_path), 2506 OCFS2_JOURNAL_ACCESS_WRITE); |
2461 if (ret) { 2462 mlog_errno(ret); 2463 goto out; 2464 } 2465 2466 ocfs2_remove_empty_extent(right_leaf_el); 2467 } else 2468 right_has_empty = 1; 2469 } 2470 2471 if (eb->h_next_leaf_blk == 0ULL && 2472 le16_to_cpu(right_leaf_el->l_next_free_rec) == 1) { 2473 /* 2474 * We have to update i_last_eb_blk during the meta 2475 * data delete. 2476 */ | 2507 if (ret) { 2508 mlog_errno(ret); 2509 goto out; 2510 } 2511 2512 ocfs2_remove_empty_extent(right_leaf_el); 2513 } else 2514 right_has_empty = 1; 2515 } 2516 2517 if (eb->h_next_leaf_blk == 0ULL && 2518 le16_to_cpu(right_leaf_el->l_next_free_rec) == 1) { 2519 /* 2520 * We have to update i_last_eb_blk during the meta 2521 * data delete. 2522 */ |
2477 ret = ocfs2_journal_access(handle, inode, et_root_bh, 2478 OCFS2_JOURNAL_ACCESS_WRITE); | 2523 ret = ocfs2_et_root_journal_access(handle, inode, et, 2524 OCFS2_JOURNAL_ACCESS_WRITE); |
2479 if (ret) { 2480 mlog_errno(ret); 2481 goto out; 2482 } 2483 2484 del_right_subtree = 1; 2485 } 2486 2487 /* 2488 * Getting here with an empty extent in the right path implies 2489 * that it's the rightmost path and will be deleted. 2490 */ 2491 BUG_ON(right_has_empty && !del_right_subtree); 2492 | 2525 if (ret) { 2526 mlog_errno(ret); 2527 goto out; 2528 } 2529 2530 del_right_subtree = 1; 2531 } 2532 2533 /* 2534 * Getting here with an empty extent in the right path implies 2535 * that it's the rightmost path and will be deleted. 2536 */ 2537 BUG_ON(right_has_empty && !del_right_subtree); 2538 |
2493 ret = ocfs2_journal_access(handle, inode, root_bh, 2494 OCFS2_JOURNAL_ACCESS_WRITE); | 2539 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 2540 subtree_index); |
2495 if (ret) { 2496 mlog_errno(ret); 2497 goto out; 2498 } 2499 2500 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { | 2541 if (ret) { 2542 mlog_errno(ret); 2543 goto out; 2544 } 2545 2546 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { |
2501 ret = ocfs2_journal_access(handle, inode, 2502 right_path->p_node[i].bh, 2503 OCFS2_JOURNAL_ACCESS_WRITE); | 2547 ret = ocfs2_path_bh_journal_access(handle, inode, 2548 right_path, i); |
2504 if (ret) { 2505 mlog_errno(ret); 2506 goto out; 2507 } 2508 | 2549 if (ret) { 2550 mlog_errno(ret); 2551 goto out; 2552 } 2553 |
2509 ret = ocfs2_journal_access(handle, inode, 2510 left_path->p_node[i].bh, 2511 OCFS2_JOURNAL_ACCESS_WRITE); | 2554 ret = ocfs2_path_bh_journal_access(handle, inode, 2555 left_path, i); |
2512 if (ret) { 2513 mlog_errno(ret); 2514 goto out; 2515 } 2516 } 2517 2518 if (!right_has_empty) { 2519 /* --- 128 unchanged lines hidden (view full) --- 2648 } 2649 2650out: 2651 return ret; 2652} 2653 2654static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, 2655 handle_t *handle, | 2556 if (ret) { 2557 mlog_errno(ret); 2558 goto out; 2559 } 2560 } 2561 2562 if (!right_has_empty) { 2563 /* --- 128 unchanged lines hidden (view full) --- 2692 } 2693 2694out: 2695 return ret; 2696} 2697 2698static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, 2699 handle_t *handle, |
2656 struct buffer_head *bh, 2657 struct ocfs2_extent_list *el) | 2700 struct ocfs2_path *path) |
2658{ 2659 int ret; | 2701{ 2702 int ret; |
2703 struct buffer_head *bh = path_leaf_bh(path); 2704 struct ocfs2_extent_list *el = path_leaf_el(path); |
|
2660 2661 if (!ocfs2_is_empty_extent(&el->l_recs[0])) 2662 return 0; 2663 | 2705 2706 if (!ocfs2_is_empty_extent(&el->l_recs[0])) 2707 return 0; 2708 |
2664 ret = ocfs2_journal_access(handle, inode, bh, 2665 OCFS2_JOURNAL_ACCESS_WRITE); | 2709 ret = ocfs2_path_bh_journal_access(handle, inode, path, 2710 path_num_items(path) - 1); |
2666 if (ret) { 2667 mlog_errno(ret); 2668 goto out; 2669 } 2670 2671 ocfs2_remove_empty_extent(el); 2672 2673 ret = ocfs2_journal_dirty(handle, bh); --- 65 unchanged lines hidden (view full) --- 2739 mlog_errno(ret); 2740 goto out; 2741 } 2742 2743 /* 2744 * Caller might still want to make changes to the 2745 * tree root, so re-add it to the journal here. 2746 */ | 2711 if (ret) { 2712 mlog_errno(ret); 2713 goto out; 2714 } 2715 2716 ocfs2_remove_empty_extent(el); 2717 2718 ret = ocfs2_journal_dirty(handle, bh); --- 65 unchanged lines hidden (view full) --- 2784 mlog_errno(ret); 2785 goto out; 2786 } 2787 2788 /* 2789 * Caller might still want to make changes to the 2790 * tree root, so re-add it to the journal here. 2791 */ |
2747 ret = ocfs2_journal_access(handle, inode, 2748 path_root_bh(left_path), 2749 OCFS2_JOURNAL_ACCESS_WRITE); | 2792 ret = ocfs2_path_bh_journal_access(handle, inode, 2793 left_path, 0); |
2750 if (ret) { 2751 mlog_errno(ret); 2752 goto out; 2753 } 2754 2755 ret = ocfs2_rotate_subtree_left(inode, handle, left_path, 2756 right_path, subtree_root, 2757 dealloc, &deleted, et); --- 166 unchanged lines hidden (view full) --- 2924 2925 if (path->p_tree_depth == 0) { 2926rightmost_no_delete: 2927 /* 2928 * Inline extents. This is trivially handled, so do 2929 * it up front. 2930 */ 2931 ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, | 2794 if (ret) { 2795 mlog_errno(ret); 2796 goto out; 2797 } 2798 2799 ret = ocfs2_rotate_subtree_left(inode, handle, left_path, 2800 right_path, subtree_root, 2801 dealloc, &deleted, et); --- 166 unchanged lines hidden (view full) --- 2968 2969 if (path->p_tree_depth == 0) { 2970rightmost_no_delete: 2971 /* 2972 * Inline extents. This is trivially handled, so do 2973 * it up front. 2974 */ 2975 ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, |
2932 path_leaf_bh(path), 2933 path_leaf_el(path)); | 2976 path); |
2934 if (ret) 2935 mlog_errno(ret); 2936 goto out; 2937 } 2938 2939 /* 2940 * Handle rightmost branch now. There's several cases: 2941 * 1) simple rotation leaving records in there. That's trivial. --- 217 unchanged lines hidden (view full) --- 3159 if (ret) { 3160 mlog_errno(ret); 3161 goto out; 3162 } 3163 3164 root_bh = left_path->p_node[subtree_index].bh; 3165 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3166 | 2977 if (ret) 2978 mlog_errno(ret); 2979 goto out; 2980 } 2981 2982 /* 2983 * Handle rightmost branch now. There's several cases: 2984 * 1) simple rotation leaving records in there. That's trivial. --- 217 unchanged lines hidden (view full) --- 3202 if (ret) { 3203 mlog_errno(ret); 3204 goto out; 3205 } 3206 3207 root_bh = left_path->p_node[subtree_index].bh; 3208 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3209 |
3167 ret = ocfs2_journal_access(handle, inode, root_bh, 3168 OCFS2_JOURNAL_ACCESS_WRITE); | 3210 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 3211 subtree_index); |
3169 if (ret) { 3170 mlog_errno(ret); 3171 goto out; 3172 } 3173 3174 for (i = subtree_index + 1; 3175 i < path_num_items(right_path); i++) { | 3212 if (ret) { 3213 mlog_errno(ret); 3214 goto out; 3215 } 3216 3217 for (i = subtree_index + 1; 3218 i < path_num_items(right_path); i++) { |
3176 ret = ocfs2_journal_access(handle, inode, 3177 right_path->p_node[i].bh, 3178 OCFS2_JOURNAL_ACCESS_WRITE); | 3219 ret = ocfs2_path_bh_journal_access(handle, inode, 3220 right_path, i); |
3179 if (ret) { 3180 mlog_errno(ret); 3181 goto out; 3182 } 3183 | 3221 if (ret) { 3222 mlog_errno(ret); 3223 goto out; 3224 } 3225 |
3184 ret = ocfs2_journal_access(handle, inode, 3185 left_path->p_node[i].bh, 3186 OCFS2_JOURNAL_ACCESS_WRITE); | 3226 ret = ocfs2_path_bh_journal_access(handle, inode, 3227 left_path, i); |
3187 if (ret) { 3188 mlog_errno(ret); 3189 goto out; 3190 } 3191 } 3192 3193 } else { 3194 BUG_ON(index == le16_to_cpu(el->l_next_free_rec) - 1); 3195 right_rec = &el->l_recs[index + 1]; 3196 } 3197 | 3228 if (ret) { 3229 mlog_errno(ret); 3230 goto out; 3231 } 3232 } 3233 3234 } else { 3235 BUG_ON(index == le16_to_cpu(el->l_next_free_rec) - 1); 3236 right_rec = &el->l_recs[index + 1]; 3237 } 3238 |
3198 ret = ocfs2_journal_access(handle, inode, bh, 3199 OCFS2_JOURNAL_ACCESS_WRITE); | 3239 ret = ocfs2_path_bh_journal_access(handle, inode, left_path, 3240 path_num_items(left_path) - 1); |
3200 if (ret) { 3201 mlog_errno(ret); 3202 goto out; 3203 } 3204 3205 le16_add_cpu(&left_rec->e_leaf_clusters, -split_clusters); 3206 3207 le32_add_cpu(&right_rec->e_cpos, -split_clusters); --- 122 unchanged lines hidden (view full) --- 3330 if (ret) { 3331 mlog_errno(ret); 3332 goto out; 3333 } 3334 3335 root_bh = left_path->p_node[subtree_index].bh; 3336 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3337 | 3241 if (ret) { 3242 mlog_errno(ret); 3243 goto out; 3244 } 3245 3246 le16_add_cpu(&left_rec->e_leaf_clusters, -split_clusters); 3247 3248 le32_add_cpu(&right_rec->e_cpos, -split_clusters); --- 122 unchanged lines hidden (view full) --- 3371 if (ret) { 3372 mlog_errno(ret); 3373 goto out; 3374 } 3375 3376 root_bh = left_path->p_node[subtree_index].bh; 3377 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3378 |
3338 ret = ocfs2_journal_access(handle, inode, root_bh, 3339 OCFS2_JOURNAL_ACCESS_WRITE); | 3379 ret = ocfs2_path_bh_journal_access(handle, inode, right_path, 3380 subtree_index); |
3340 if (ret) { 3341 mlog_errno(ret); 3342 goto out; 3343 } 3344 3345 for (i = subtree_index + 1; 3346 i < path_num_items(right_path); i++) { | 3381 if (ret) { 3382 mlog_errno(ret); 3383 goto out; 3384 } 3385 3386 for (i = subtree_index + 1; 3387 i < path_num_items(right_path); i++) { |
3347 ret = ocfs2_journal_access(handle, inode, 3348 right_path->p_node[i].bh, 3349 OCFS2_JOURNAL_ACCESS_WRITE); | 3388 ret = ocfs2_path_bh_journal_access(handle, inode, 3389 right_path, i); |
3350 if (ret) { 3351 mlog_errno(ret); 3352 goto out; 3353 } 3354 | 3390 if (ret) { 3391 mlog_errno(ret); 3392 goto out; 3393 } 3394 |
3355 ret = ocfs2_journal_access(handle, inode, 3356 left_path->p_node[i].bh, 3357 OCFS2_JOURNAL_ACCESS_WRITE); | 3395 ret = ocfs2_path_bh_journal_access(handle, inode, 3396 left_path, i); |
3358 if (ret) { 3359 mlog_errno(ret); 3360 goto out; 3361 } 3362 } 3363 } else { 3364 left_rec = &el->l_recs[index - 1]; 3365 if (ocfs2_is_empty_extent(&el->l_recs[0])) 3366 has_empty_extent = 1; 3367 } 3368 | 3397 if (ret) { 3398 mlog_errno(ret); 3399 goto out; 3400 } 3401 } 3402 } else { 3403 left_rec = &el->l_recs[index - 1]; 3404 if (ocfs2_is_empty_extent(&el->l_recs[0])) 3405 has_empty_extent = 1; 3406 } 3407 |
3369 ret = ocfs2_journal_access(handle, inode, bh, 3370 OCFS2_JOURNAL_ACCESS_WRITE); | 3408 ret = ocfs2_path_bh_journal_access(handle, inode, left_path, 3409 path_num_items(left_path) - 1); |
3371 if (ret) { 3372 mlog_errno(ret); 3373 goto out; 3374 } 3375 3376 if (has_empty_extent && index == 1) { 3377 /* 3378 * The easy case - we can just plop the record right in. --- 625 unchanged lines hidden (view full) --- 4004 int ret, rotate = 0; 4005 u32 cpos; 4006 struct ocfs2_path *right_path = NULL; 4007 struct ocfs2_path *left_path = NULL; 4008 struct ocfs2_extent_list *el; 4009 4010 el = et->et_root_el; 4011 | 3410 if (ret) { 3411 mlog_errno(ret); 3412 goto out; 3413 } 3414 3415 if (has_empty_extent && index == 1) { 3416 /* 3417 * The easy case - we can just plop the record right in. --- 625 unchanged lines hidden (view full) --- 4043 int ret, rotate = 0; 4044 u32 cpos; 4045 struct ocfs2_path *right_path = NULL; 4046 struct ocfs2_path *left_path = NULL; 4047 struct ocfs2_extent_list *el; 4048 4049 el = et->et_root_el; 4050 |
4012 ret = ocfs2_journal_access(handle, inode, et->et_root_bh, 4013 OCFS2_JOURNAL_ACCESS_WRITE); | 4051 ret = ocfs2_et_root_journal_access(handle, inode, et, 4052 OCFS2_JOURNAL_ACCESS_WRITE); |
4014 if (ret) { 4015 mlog_errno(ret); 4016 goto out; 4017 } 4018 4019 if (le16_to_cpu(el->l_tree_depth) == 0) { 4020 ocfs2_insert_at_leaf(insert_rec, el, type, inode); 4021 goto out_update_clusters; --- 44 unchanged lines hidden (view full) --- 4066 mlog_errno(ret); 4067 goto out; 4068 } 4069 4070 /* 4071 * ocfs2_rotate_tree_right() might have extended the 4072 * transaction without re-journaling our tree root. 4073 */ | 4053 if (ret) { 4054 mlog_errno(ret); 4055 goto out; 4056 } 4057 4058 if (le16_to_cpu(el->l_tree_depth) == 0) { 4059 ocfs2_insert_at_leaf(insert_rec, el, type, inode); 4060 goto out_update_clusters; --- 44 unchanged lines hidden (view full) --- 4105 mlog_errno(ret); 4106 goto out; 4107 } 4108 4109 /* 4110 * ocfs2_rotate_tree_right() might have extended the 4111 * transaction without re-journaling our tree root. 4112 */ |
4074 ret = ocfs2_journal_access(handle, inode, et->et_root_bh, 4075 OCFS2_JOURNAL_ACCESS_WRITE); | 4113 ret = ocfs2_et_root_journal_access(handle, inode, et, 4114 OCFS2_JOURNAL_ACCESS_WRITE); |
4076 if (ret) { 4077 mlog_errno(ret); 4078 goto out; 4079 } 4080 } else if (type->ins_appending == APPEND_TAIL 4081 && type->ins_contig != CONTIG_LEFT) { 4082 ret = ocfs2_append_rec_to_path(inode, handle, insert_rec, 4083 right_path, &left_path); --- 504 unchanged lines hidden (view full) --- 4588 if (status < 0) { 4589 if (status != -ENOSPC) 4590 mlog_errno(status); 4591 goto leave; 4592 } 4593 4594 BUG_ON(num_bits > clusters_to_add); 4595 | 4115 if (ret) { 4116 mlog_errno(ret); 4117 goto out; 4118 } 4119 } else if (type->ins_appending == APPEND_TAIL 4120 && type->ins_contig != CONTIG_LEFT) { 4121 ret = ocfs2_append_rec_to_path(inode, handle, insert_rec, 4122 right_path, &left_path); --- 504 unchanged lines hidden (view full) --- 4627 if (status < 0) { 4628 if (status != -ENOSPC) 4629 mlog_errno(status); 4630 goto leave; 4631 } 4632 4633 BUG_ON(num_bits > clusters_to_add); 4634 |
4596 /* reserve our write early -- insert_extent may update the inode */ 4597 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 4598 OCFS2_JOURNAL_ACCESS_WRITE); | 4635 /* reserve our write early -- insert_extent may update the tree root */ 4636 status = ocfs2_et_root_journal_access(handle, inode, et, 4637 OCFS2_JOURNAL_ACCESS_WRITE); |
4599 if (status < 0) { 4600 mlog_errno(status); 4601 goto leave; 4602 } 4603 4604 block = ocfs2_clusters_to_blocks(osb->sb, bit_off); 4605 mlog(0, "Allocating %u clusters at block %u for inode %llu\n", 4606 num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno); --- 735 unchanged lines hidden (view full) --- 5342 5343 handle = ocfs2_start_trans(osb, ocfs2_remove_extent_credits(osb->sb)); 5344 if (IS_ERR(handle)) { 5345 ret = PTR_ERR(handle); 5346 mlog_errno(ret); 5347 goto out; 5348 } 5349 | 4638 if (status < 0) { 4639 mlog_errno(status); 4640 goto leave; 4641 } 4642 4643 block = ocfs2_clusters_to_blocks(osb->sb, bit_off); 4644 mlog(0, "Allocating %u clusters at block %u for inode %llu\n", 4645 num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno); --- 735 unchanged lines hidden (view full) --- 5381 5382 handle = ocfs2_start_trans(osb, ocfs2_remove_extent_credits(osb->sb)); 5383 if (IS_ERR(handle)) { 5384 ret = PTR_ERR(handle); 5385 mlog_errno(ret); 5386 goto out; 5387 } 5388 |
5350 ret = ocfs2_journal_access(handle, inode, et->et_root_bh, 5351 OCFS2_JOURNAL_ACCESS_WRITE); | 5389 ret = ocfs2_et_root_journal_access(handle, inode, et, 5390 OCFS2_JOURNAL_ACCESS_WRITE); |
5352 if (ret) { 5353 mlog_errno(ret); 5354 goto out; 5355 } 5356 5357 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, 5358 dealloc); 5359 if (ret) { --- 96 unchanged lines hidden (view full) --- 5456 /* Caller should have known to flush before calling us. */ 5457 index = le16_to_cpu(tl->tl_used); 5458 if (index >= tl_count) { 5459 status = -ENOSPC; 5460 mlog_errno(status); 5461 goto bail; 5462 } 5463 | 5391 if (ret) { 5392 mlog_errno(ret); 5393 goto out; 5394 } 5395 5396 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac, 5397 dealloc); 5398 if (ret) { --- 96 unchanged lines hidden (view full) --- 5495 /* Caller should have known to flush before calling us. */ 5496 index = le16_to_cpu(tl->tl_used); 5497 if (index >= tl_count) { 5498 status = -ENOSPC; 5499 mlog_errno(status); 5500 goto bail; 5501 } 5502 |
5464 status = ocfs2_journal_access(handle, tl_inode, tl_bh, 5465 OCFS2_JOURNAL_ACCESS_WRITE); | 5503 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, 5504 OCFS2_JOURNAL_ACCESS_WRITE); |
5466 if (status < 0) { 5467 mlog_errno(status); 5468 goto bail; 5469 } 5470 5471 mlog(0, "Log truncate of %u clusters starting at cluster %u to " 5472 "%llu (index = %d)\n", num_clusters, start_cluster, 5473 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index); --- 44 unchanged lines hidden (view full) --- 5518 mlog_entry_void(); 5519 5520 di = (struct ocfs2_dinode *) tl_bh->b_data; 5521 tl = &di->id2.i_dealloc; 5522 i = le16_to_cpu(tl->tl_used) - 1; 5523 while (i >= 0) { 5524 /* Caller has given us at least enough credits to 5525 * update the truncate log dinode */ | 5505 if (status < 0) { 5506 mlog_errno(status); 5507 goto bail; 5508 } 5509 5510 mlog(0, "Log truncate of %u clusters starting at cluster %u to " 5511 "%llu (index = %d)\n", num_clusters, start_cluster, 5512 (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index); --- 44 unchanged lines hidden (view full) --- 5557 mlog_entry_void(); 5558 5559 di = (struct ocfs2_dinode *) tl_bh->b_data; 5560 tl = &di->id2.i_dealloc; 5561 i = le16_to_cpu(tl->tl_used) - 1; 5562 while (i >= 0) { 5563 /* Caller has given us at least enough credits to 5564 * update the truncate log dinode */ |
5526 status = ocfs2_journal_access(handle, tl_inode, tl_bh, 5527 OCFS2_JOURNAL_ACCESS_WRITE); | 5565 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh, 5566 OCFS2_JOURNAL_ACCESS_WRITE); |
5528 if (status < 0) { 5529 mlog_errno(status); 5530 goto bail; 5531 } 5532 5533 tl->tl_used = cpu_to_le16(i); 5534 5535 status = ocfs2_journal_dirty(handle, tl_bh); --- 239 unchanged lines hidden (view full) --- 5775 /* Assuming the write-out below goes well, this copy 5776 * will be passed back to recovery for processing. */ 5777 memcpy(*tl_copy, tl_bh->b_data, tl_bh->b_size); 5778 5779 /* All we need to do to clear the truncate log is set 5780 * tl_used. */ 5781 tl->tl_used = 0; 5782 | 5567 if (status < 0) { 5568 mlog_errno(status); 5569 goto bail; 5570 } 5571 5572 tl->tl_used = cpu_to_le16(i); 5573 5574 status = ocfs2_journal_dirty(handle, tl_bh); --- 239 unchanged lines hidden (view full) --- 5814 /* Assuming the write-out below goes well, this copy 5815 * will be passed back to recovery for processing. */ 5816 memcpy(*tl_copy, tl_bh->b_data, tl_bh->b_size); 5817 5818 /* All we need to do to clear the truncate log is set 5819 * tl_used. */ 5820 tl->tl_used = 0; 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); 5784 if (status < 0) { 5785 mlog_errno(status); 5786 goto bail; 5787 } 5788 } 5789 5790bail: --- 750 unchanged lines hidden (view full) --- 6541 */ 6542 status = ocfs2_journal_access_path(inode, handle, path); 6543 if (status < 0) { 6544 mlog_errno(status); 6545 goto bail; 6546 } 6547 6548 if (last_eb_bh) { | 5823 status = ocfs2_write_block(osb, tl_bh, tl_inode); 5824 if (status < 0) { 5825 mlog_errno(status); 5826 goto bail; 5827 } 5828 } 5829 5830bail: --- 750 unchanged lines hidden (view full) --- 6581 */ 6582 status = ocfs2_journal_access_path(inode, handle, path); 6583 if (status < 0) { 6584 mlog_errno(status); 6585 goto bail; 6586 } 6587 6588 if (last_eb_bh) { |
6549 status = ocfs2_journal_access(handle, inode, last_eb_bh, 6550 OCFS2_JOURNAL_ACCESS_WRITE); | 6589 status = ocfs2_journal_access_eb(handle, inode, last_eb_bh, 6590 OCFS2_JOURNAL_ACCESS_WRITE); |
6551 if (status < 0) { 6552 mlog_errno(status); 6553 goto bail; 6554 } 6555 6556 last_eb = (struct ocfs2_extent_block *) last_eb_bh->b_data; 6557 } 6558 --- 344 unchanged lines hidden (view full) --- 6903 handle = ocfs2_start_trans(osb, 6904 ocfs2_inline_to_extents_credits(osb->sb)); 6905 if (IS_ERR(handle)) { 6906 ret = PTR_ERR(handle); 6907 mlog_errno(ret); 6908 goto out_unlock; 6909 } 6910 | 6591 if (status < 0) { 6592 mlog_errno(status); 6593 goto bail; 6594 } 6595 6596 last_eb = (struct ocfs2_extent_block *) last_eb_bh->b_data; 6597 } 6598 --- 344 unchanged lines hidden (view full) --- 6943 handle = ocfs2_start_trans(osb, 6944 ocfs2_inline_to_extents_credits(osb->sb)); 6945 if (IS_ERR(handle)) { 6946 ret = PTR_ERR(handle); 6947 mlog_errno(ret); 6948 goto out_unlock; 6949 } 6950 |
6911 ret = ocfs2_journal_access(handle, inode, di_bh, 6912 OCFS2_JOURNAL_ACCESS_WRITE); | 6951 ret = ocfs2_journal_access_di(handle, inode, di_bh, 6952 OCFS2_JOURNAL_ACCESS_WRITE); |
6913 if (ret) { 6914 mlog_errno(ret); 6915 goto out_commit; 6916 } 6917 6918 if (has_data) { 6919 u32 bit_off, num; 6920 unsigned int page_end; --- 117 unchanged lines hidden (view full) --- 7038 struct ocfs2_path *path = NULL; 7039 struct ocfs2_dinode *di = (struct ocfs2_dinode *)fe_bh->b_data; 7040 7041 mlog_entry_void(); 7042 7043 new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, 7044 i_size_read(inode)); 7045 | 6953 if (ret) { 6954 mlog_errno(ret); 6955 goto out_commit; 6956 } 6957 6958 if (has_data) { 6959 u32 bit_off, num; 6960 unsigned int page_end; --- 117 unchanged lines hidden (view full) --- 7078 struct ocfs2_path *path = NULL; 7079 struct ocfs2_dinode *di = (struct ocfs2_dinode *)fe_bh->b_data; 7080 7081 mlog_entry_void(); 7082 7083 new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, 7084 i_size_read(inode)); 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) { 7048 status = -ENOMEM; 7049 mlog_errno(status); 7050 goto bail; 7051 } 7052 7053 ocfs2_extent_map_trunc(inode, new_highest_cpos); 7054 --- 216 unchanged lines hidden (view full) --- 7271 7272 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 7273 if (IS_ERR(handle)) { 7274 ret = PTR_ERR(handle); 7275 mlog_errno(ret); 7276 goto out; 7277 } 7278 | 7088 if (!path) { 7089 status = -ENOMEM; 7090 mlog_errno(status); 7091 goto bail; 7092 } 7093 7094 ocfs2_extent_map_trunc(inode, new_highest_cpos); 7095 --- 216 unchanged lines hidden (view full) --- 7312 7313 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 7314 if (IS_ERR(handle)) { 7315 ret = PTR_ERR(handle); 7316 mlog_errno(ret); 7317 goto out; 7318 } 7319 |
7279 ret = ocfs2_journal_access(handle, inode, di_bh, 7280 OCFS2_JOURNAL_ACCESS_WRITE); | 7320 ret = ocfs2_journal_access_di(handle, inode, di_bh, 7321 OCFS2_JOURNAL_ACCESS_WRITE); |
7281 if (ret) { 7282 mlog_errno(ret); 7283 goto out_commit; 7284 } 7285 7286 numbytes = end - start; 7287 memset(idata->id_data + start, 0, numbytes); 7288 --- 40 unchanged lines hidden --- | 7322 if (ret) { 7323 mlog_errno(ret); 7324 goto out_commit; 7325 } 7326 7327 numbytes = end - start; 7328 memset(idata->id_data + start, 0, numbytes); 7329 --- 40 unchanged lines hidden --- |