Skip to content

Commit

Permalink
Btrfs: Set nodatasum on the inode when written by a nodatasum mount
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason committed Sep 25, 2008
1 parent 38b6698 commit 409c611
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 409c611

Please sign in to comment.