aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-12-12 10:03:38 -0500
committerChris Mason <chris.mason@oracle.com>2008-12-12 10:03:38 -0500
commit17d217fe970d34720f4f1633dca73a6aa2f3d9d1 (patch)
tree4e2e716400cc45a6697475629f4c046b96ff76e7 /fs/btrfs/file.c
parente4404d6e8da678d852b7f767f665f8edf76c9e9f (diff)
Btrfs: fix nodatasum handling in balancing code
Checksums on data can be disabled by mount option, so it's possible some data extents don't have checksums or have invalid checksums. This causes trouble for data relocation. This patch contains following things to make data relocation work. 1) make nodatasum/nodatacow mount option only affects new files. Checksums and COW on data are only controlled by the inode flags. 2) check the existence of checksum in the nodatacow checker. If checksums exist, force COW the data extent. This ensure that checksum for a given block is either valid or does not exist. 3) update data relocation code to properly handle the case of checksum missing. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 71bfe3a6a444..507081059d97 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1060,14 +1060,6 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
1060 last_index = (pos + count) >> PAGE_CACHE_SHIFT; 1060 last_index = (pos + count) >> PAGE_CACHE_SHIFT;
1061 1061
1062 /* 1062 /*
1063 * if this is a nodatasum mount, force summing off for the inode
1064 * all the time. That way a later mount with summing on won't
1065 * get confused
1066 */
1067 if (btrfs_test_opt(root, NODATASUM))
1068 btrfs_set_flag(inode, NODATASUM);
1069
1070 /*
1071 * there are lots of better ways to do this, but this code 1063 * there are lots of better ways to do this, but this code
1072 * makes sure the first and last page in the file range are 1064 * makes sure the first and last page in the file range are
1073 * up to date and ready for cow 1065 * up to date and ready for cow