Btrfs: Fix cow semantic in run_delalloc_nocow()
authorLiu Hui <onlyflyer@gmail.com>
Tue, 2 Dec 2008 01:31:40 +0000 (20:31 -0500)
committerChris Mason <chris.mason@oracle.com>
Tue, 2 Dec 2008 01:31:40 +0000 (20:31 -0500)
The file preallocation code reversed the logic to force nodatacow.
This fixes it.

fs/btrfs/inode.c

index 7a8ad4292f75f1d523008ea0002a4cf7bd8be628..b3d4078b69a6ae315472056eb3bb78b1d86a6b43 100644 (file)
@@ -1114,10 +1114,10 @@ static int run_delalloc_range(struct inode *inode, struct page *locked_page,
        if (btrfs_test_opt(root, NODATACOW) ||
            btrfs_test_flag(inode, NODATACOW))
                ret = run_delalloc_nocow(inode, locked_page, start, end,
-                                        page_started, 0, nr_written);
+                                        page_started, 1, nr_written);
        else if (btrfs_test_flag(inode, PREALLOC))
                ret = run_delalloc_nocow(inode, locked_page, start, end,
-                                        page_started, 1, nr_written);
+                                        page_started, 0, nr_written);
        else
                ret = cow_file_range_async(inode, locked_page, start, end,
                                     page_started, nr_written);