From: Chris Mason Date: Tue, 22 Apr 2008 13:24:20 +0000 (-0400) Subject: Btrfs: Set nodatasum on the inode when written by a nodatasum mount X-Git-Tag: firefly_0821_release~15789^2~11^2~55^2~56^2~30^2~208 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=409c6118d39cb2d8666bee3d61a1a9ae5bbd4f5d;p=firefly-linux-kernel-4.4.55.git Btrfs: Set nodatasum on the inode when written by a nodatasum mount Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3f5525f0834c..5d537f26dc83 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -863,6 +863,14 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf, first_index = pos >> PAGE_CACHE_SHIFT; last_index = (pos + count) >> PAGE_CACHE_SHIFT; + /* + * if this is a nodatasum mount, force summing off for the inode + * all the time. That way a later mount with summing on won't + * get confused + */ + if (btrfs_test_opt(root, NODATASUM)) + btrfs_set_flag(inode, NODATASUM); + /* * there are lots of better ways to do this, but this code * makes sure the first and last page in the file range are