aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-05-23 14:37:47 -0400
committerChris Mason <chris.mason@oracle.com>2011-05-23 14:37:47 -0400
commitd6c0cb379c5198487e4ac124728cbb2346d63b1f (patch)
tree167a97ac58c7a2fbf7c4e94b6abbfe1e03af014a /fs/btrfs/file-item.c
parent8e531cdfeb75269c6c5aae33651cca39707848da (diff)
parent1f78160ce1b1b8e657e2248118c4d91f881763f0 (diff)
Merge branch 'cleanups_and_fixes' into inode_numbers
Conflicts: fs/btrfs/tree-log.c fs/btrfs/volumes.c Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r--fs/btrfs/file-item.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index b437cc790bfb..90d4ee52cd45 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -502,7 +502,6 @@ static noinline int truncate_one_csum(struct btrfs_trans_handle *trans,
502 u32 new_size = (bytenr - key->offset) >> blocksize_bits; 502 u32 new_size = (bytenr - key->offset) >> blocksize_bits;
503 new_size *= csum_size; 503 new_size *= csum_size;
504 ret = btrfs_truncate_item(trans, root, path, new_size, 1); 504 ret = btrfs_truncate_item(trans, root, path, new_size, 1);
505 BUG_ON(ret);
506 } else if (key->offset >= bytenr && csum_end > end_byte && 505 } else if (key->offset >= bytenr && csum_end > end_byte &&
507 end_byte > key->offset) { 506 end_byte > key->offset) {
508 /* 507 /*
@@ -515,7 +514,6 @@ static noinline int truncate_one_csum(struct btrfs_trans_handle *trans,
515 new_size *= csum_size; 514 new_size *= csum_size;
516 515
517 ret = btrfs_truncate_item(trans, root, path, new_size, 0); 516 ret = btrfs_truncate_item(trans, root, path, new_size, 0);
518 BUG_ON(ret);
519 517
520 key->offset = end_byte; 518 key->offset = end_byte;
521 ret = btrfs_set_item_key_safe(trans, root, path, key); 519 ret = btrfs_set_item_key_safe(trans, root, path, key);
@@ -558,10 +556,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
558 ret = btrfs_search_slot(trans, root, &key, path, -1, 1); 556 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
559 if (ret > 0) { 557 if (ret > 0) {
560 if (path->slots[0] == 0) 558 if (path->slots[0] == 0)
561 goto out; 559 break;
562 path->slots[0]--; 560 path->slots[0]--;
563 } else if (ret < 0) { 561 } else if (ret < 0) {
564 goto out; 562 break;
565 } 563 }
566 564
567 leaf = path->nodes[0]; 565 leaf = path->nodes[0];
@@ -586,7 +584,8 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
586 /* delete the entire item, it is inside our range */ 584 /* delete the entire item, it is inside our range */
587 if (key.offset >= bytenr && csum_end <= end_byte) { 585 if (key.offset >= bytenr && csum_end <= end_byte) {
588 ret = btrfs_del_item(trans, root, path); 586 ret = btrfs_del_item(trans, root, path);
589 BUG_ON(ret); 587 if (ret)
588 goto out;
590 if (key.offset == bytenr) 589 if (key.offset == bytenr)
591 break; 590 break;
592 } else if (key.offset < bytenr && csum_end > end_byte) { 591 } else if (key.offset < bytenr && csum_end > end_byte) {
@@ -640,9 +639,10 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
640 } 639 }
641 btrfs_release_path(path); 640 btrfs_release_path(path);
642 } 641 }
642 ret = 0;
643out: 643out:
644 btrfs_free_path(path); 644 btrfs_free_path(path);
645 return 0; 645 return ret;
646} 646}
647 647
648int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, 648int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
@@ -768,7 +768,6 @@ again:
768 goto insert; 768 goto insert;
769 769
770 ret = btrfs_extend_item(trans, root, path, diff); 770 ret = btrfs_extend_item(trans, root, path, diff);
771 BUG_ON(ret);
772 goto csum; 771 goto csum;
773 } 772 }
774 773