diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2013-03-28 04:08:20 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-03-28 09:51:30 -0400 |
commit | 39847c4d3d91f487f9ab3d083ee5d0f8419f105c (patch) | |
tree | 9de238dbe4fbe627d4b8914561827cf6b3d9c19e /fs | |
parent | a7975026ff9ddf91ba190ae2b71699dd156395e3 (diff) |
Btrfs: fix wrong reservation of csums
We reserve the space for csums only when we write data into a file, in
the other cases, such as tree log, log replay, we don't do reservation,
so we can use the reservation of the transaction handle just for the former.
And for the latter, we should use the tree's own reservation. But the
function - btrfs_csum_file_blocks() didn't differentiate between these
two types of the cases, fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file-item.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index ec160202be3e..b7e529d2860f 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -728,7 +728,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, | |||
728 | return -ENOMEM; | 728 | return -ENOMEM; |
729 | 729 | ||
730 | sector_sum = sums->sums; | 730 | sector_sum = sums->sums; |
731 | trans->adding_csums = 1; | ||
732 | again: | 731 | again: |
733 | next_offset = (u64)-1; | 732 | next_offset = (u64)-1; |
734 | found_next = 0; | 733 | found_next = 0; |
@@ -899,7 +898,6 @@ next_sector: | |||
899 | goto again; | 898 | goto again; |
900 | } | 899 | } |
901 | out: | 900 | out: |
902 | trans->adding_csums = 0; | ||
903 | btrfs_free_path(path); | 901 | btrfs_free_path(path); |
904 | return ret; | 902 | return ret; |
905 | 903 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8cab424c75f8..b88381582dab 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1757,8 +1757,10 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, | |||
1757 | struct btrfs_ordered_sum *sum; | 1757 | struct btrfs_ordered_sum *sum; |
1758 | 1758 | ||
1759 | list_for_each_entry(sum, list, list) { | 1759 | list_for_each_entry(sum, list, list) { |
1760 | trans->adding_csums = 1; | ||
1760 | btrfs_csum_file_blocks(trans, | 1761 | btrfs_csum_file_blocks(trans, |
1761 | BTRFS_I(inode)->root->fs_info->csum_root, sum); | 1762 | BTRFS_I(inode)->root->fs_info->csum_root, sum); |
1763 | trans->adding_csums = 0; | ||
1762 | } | 1764 | } |
1763 | return 0; | 1765 | return 0; |
1764 | } | 1766 | } |