Commit 580afd76 authored by Chris Mason's avatar Chris Mason

Btrfs: Fix compressed checksum fsync log copies

The fsync logging code makes sure to onl copy the relevant checksum for each
extent based on the file extent pointers it finds.

But for compressed extents, it needs to copy the checksum for the
entire extent.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent c3027eb5
...@@ -1228,7 +1228,8 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) ...@@ -1228,7 +1228,8 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
mutex_unlock(&root->fs_info->trans_mutex); mutex_unlock(&root->fs_info->trans_mutex);
root->fs_info->tree_log_batch++; root->fs_info->tree_log_batch++;
filemap_fdatawait(inode->i_mapping); filemap_fdatawrite(inode->i_mapping);
btrfs_wait_ordered_range(inode, 0, (u64)-1);
root->fs_info->tree_log_batch++; root->fs_info->tree_log_batch++;
/* /*
......
...@@ -2610,6 +2610,11 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, ...@@ -2610,6 +2610,11 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
u64 cs = btrfs_file_extent_offset(src, extent); u64 cs = btrfs_file_extent_offset(src, extent);
u64 cl = btrfs_file_extent_num_bytes(src, u64 cl = btrfs_file_extent_num_bytes(src,
extent);; extent);;
if (btrfs_file_extent_compression(src,
extent)) {
cs = 0;
cl = dl;
}
/* ds == 0 is a hole */ /* ds == 0 is a hole */
if (ds != 0) { if (ds != 0) {
ret = btrfs_inc_extent_ref(trans, log, ret = btrfs_inc_extent_ref(trans, log,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment