Btrfs: tree logging checksum fixes
This patch contains following things. 1) Limit the max size of btrfs_ordered_sum structure to PAGE_SIZE. This struct is kmalloced so we want to keep it reasonable. 2) Replace copy_extent_csums by btrfs_lookup_csums_range. This was duplicated code in tree-log.c 3) Remove replay_one_csum. csum items are replayed at the same time as replaying file extents. This guarantees we only replay useful csums. 4) nbytes accounting fix. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
This commit is contained in:
@@ -157,7 +157,6 @@ static noinline int insert_inline_extent(struct btrfs_trans_handle *trans,
|
||||
key.objectid = inode->i_ino;
|
||||
key.offset = start;
|
||||
btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY);
|
||||
inode_add_bytes(inode, size);
|
||||
datasize = btrfs_file_extent_calc_inline_size(cur_size);
|
||||
|
||||
inode_add_bytes(inode, size);
|
||||
@@ -920,8 +919,8 @@ static noinline int csum_exist_in_range(struct btrfs_root *root,
|
||||
struct btrfs_ordered_sum *sums;
|
||||
LIST_HEAD(list);
|
||||
|
||||
ret = btrfs_lookup_csums_range(root, bytenr, bytenr + num_bytes - 1,
|
||||
&list);
|
||||
ret = btrfs_lookup_csums_range(root->fs_info->csum_root, bytenr,
|
||||
bytenr + num_bytes - 1, &list);
|
||||
if (ret == 0 && list_empty(&list))
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user