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>
This commit is contained in:
parent
a7975026ff
commit
39847c4d3d
2 changed files with 2 additions and 2 deletions
|
@ -728,7 +728,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
sector_sum = sums->sums;
|
sector_sum = sums->sums;
|
||||||
trans->adding_csums = 1;
|
|
||||||
again:
|
again:
|
||||||
next_offset = (u64)-1;
|
next_offset = (u64)-1;
|
||||||
found_next = 0;
|
found_next = 0;
|
||||||
|
@ -899,7 +898,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
trans->adding_csums = 0;
|
|
||||||
btrfs_free_path(path);
|
btrfs_free_path(path);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -1757,8 +1757,10 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_ordered_sum *sum;
|
struct btrfs_ordered_sum *sum;
|
||||||
|
|
||||||
list_for_each_entry(sum, list, list) {
|
list_for_each_entry(sum, list, list) {
|
||||||
|
trans->adding_csums = 1;
|
||||||
btrfs_csum_file_blocks(trans,
|
btrfs_csum_file_blocks(trans,
|
||||||
BTRFS_I(inode)->root->fs_info->csum_root, sum);
|
BTRFS_I(inode)->root->fs_info->csum_root, sum);
|
||||||
|
trans->adding_csums = 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue