From: Chris Mason Date: Tue, 9 Dec 2008 00:15:39 +0000 (-0500) Subject: Btrfs: Fix compressed checksum fsync log copies X-Git-Tag: v2.6.29-rc1~27^2~9^2~28 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=580afd76e451deb6772d0507de580fb1df14da6c;p=linux-2.6-omap-h63xx.git 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: Chris Mason --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b5a6a2b6f66..71bfe3a6a44 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1228,7 +1228,8 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) mutex_unlock(&root->fs_info->trans_mutex); 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++; /* diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index d3f9c2c663c..6ac1b7f72e2 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2610,6 +2610,11 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, u64 cs = btrfs_file_extent_offset(src, extent); u64 cl = btrfs_file_extent_num_bytes(src, extent);; + if (btrfs_file_extent_compression(src, + extent)) { + cs = 0; + cl = dl; + } /* ds == 0 is a hole */ if (ds != 0) { ret = btrfs_inc_extent_ref(trans, log,