aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ordered-data.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-10-30 14:20:02 -0400
committerChris Mason <chris.mason@oracle.com>2008-10-30 14:20:02 -0400
commit80ff385665b7fca29fefe358a60ab0d09f9b8e87 (patch)
tree8a801d3f268d289b62f8dac87df8b757fb3b19d4 /fs/btrfs/ordered-data.c
parent6643558db29006825dbb10012b3f8890aca4bcd5 (diff)
Btrfs: update nodatacow code v2
This patch simplifies the nodatacow checker. If all references were created after the latest snapshot, then we can avoid COW safely. This patch also updates run_delalloc_nocow to do more fine-grained checking. Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r--fs/btrfs/ordered-data.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index b5745bb96d40..e7317c8fda29 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -165,8 +165,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree,
165 * inserted. 165 * inserted.
166 */ 166 */
167int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset, 167int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
168 u64 start, u64 len, u64 disk_len, int nocow, 168 u64 start, u64 len, u64 disk_len, int type)
169 int compressed)
170{ 169{
171 struct btrfs_ordered_inode_tree *tree; 170 struct btrfs_ordered_inode_tree *tree;
172 struct rb_node *node; 171 struct rb_node *node;
@@ -183,10 +182,8 @@ int btrfs_add_ordered_extent(struct inode *inode, u64 file_offset,
183 entry->len = len; 182 entry->len = len;
184 entry->disk_len = disk_len; 183 entry->disk_len = disk_len;
185 entry->inode = inode; 184 entry->inode = inode;
186 if (nocow) 185 if (type == BTRFS_ORDERED_NOCOW || type == BTRFS_ORDERED_COMPRESSED)
187 set_bit(BTRFS_ORDERED_NOCOW, &entry->flags); 186 set_bit(type, &entry->flags);
188 if (compressed)
189 set_bit(BTRFS_ORDERED_COMPRESSED, &entry->flags);
190 187
191 /* one ref for the tree */ 188 /* one ref for the tree */
192 atomic_set(&entry->refs, 1); 189 atomic_set(&entry->refs, 1);