Btrfs: Add data=ordered support
This forces file data extents down the disk along with the metadata that
references them. The current implementation is fairly simple, and just
writes out all of the dirty pages in an inode before the commit.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 94c9337..0a5f4de 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -34,6 +34,7 @@
#include "disk-io.h"
#include "transaction.h"
#include "btrfs_inode.h"
+#include "ordered-data.h"
#include "ioctl.h"
#include "print-tree.h"
@@ -329,6 +330,7 @@
root->fs_info->delalloc_bytes += (end_of_last_block + 1 -
start_pos) - existing_delalloc;
spin_unlock(&root->fs_info->delalloc_lock);
+ btrfs_add_ordered_inode(inode);
} else {
u64 aligned_end;
/* step one, delete the existing extents in this range */
@@ -724,8 +726,6 @@
pages = kmalloc(nrptrs * sizeof(struct page *), GFP_KERNEL);
- down_read(&BTRFS_I(inode)->root->snap_sem);
-
mutex_lock(&inode->i_mutex);
first_index = pos >> PAGE_CACHE_SHIFT;
last_index = (pos + count) >> PAGE_CACHE_SHIFT;
@@ -804,7 +804,6 @@
}
out:
mutex_unlock(&inode->i_mutex);
- up_read(&BTRFS_I(inode)->root->snap_sem);
out_nolock:
kfree(pages);