aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2012-12-03 10:58:15 -0500
committerChris Mason <chris.mason@fusionio.com>2012-12-16 20:46:23 -0500
commitb11e234d21e73df94099e473a080bca502b9a496 (patch)
treeeb931368e5b4111b8eb95fff5921d78220c590ff /fs
parentb493968096944a11422c4d80fb87af537ca1cac7 (diff)
Btrfs: do not mark ems as prealloc if we are writing to them
We are going to use EM's to log extents in the future, so we need to not mark them as prealloc if they aren't actually prealloc extents. Instead mark them with FILLING so we know to ammend mod_start/mod_len and that way we don't confuse the extent logging code. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_map.c4
-rw-r--r--fs/btrfs/extent_map.h1
-rw-r--r--fs/btrfs/inode.c4
3 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index b8cbc8d5c7f..85ae2b6fe03 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -266,9 +266,9 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
266 em->mod_start = em->start; 266 em->mod_start = em->start;
267 em->mod_len = em->len; 267 em->mod_len = em->len;
268 268
269 if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) { 269 if (test_bit(EXTENT_FLAG_FILLING, &em->flags)) {
270 prealloc = true; 270 prealloc = true;
271 clear_bit(EXTENT_FLAG_PREALLOC, &em->flags); 271 clear_bit(EXTENT_FLAG_FILLING, &em->flags);
272 } 272 }
273 273
274 try_merge_map(tree, em); 274 try_merge_map(tree, em);
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h
index 99a0dcb5ba2..922943ce29e 100644
--- a/fs/btrfs/extent_map.h
+++ b/fs/btrfs/extent_map.h
@@ -14,6 +14,7 @@
14#define EXTENT_FLAG_VACANCY 2 /* no file extent item found */ 14#define EXTENT_FLAG_VACANCY 2 /* no file extent item found */
15#define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */ 15#define EXTENT_FLAG_PREALLOC 3 /* pre-allocated extent */
16#define EXTENT_FLAG_LOGGING 4 /* Logging this extent */ 16#define EXTENT_FLAG_LOGGING 4 /* Logging this extent */
17#define EXTENT_FLAG_FILLING 5 /* Filling in a preallocated extent */
17 18
18struct extent_map { 19struct extent_map {
19 struct rb_node rb_node; 20 struct rb_node rb_node;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index bfd59bcc50d..73e6833dcc2 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1327,7 +1327,7 @@ out_check:
1327 em->orig_block_len = disk_num_bytes; 1327 em->orig_block_len = disk_num_bytes;
1328 em->bdev = root->fs_info->fs_devices->latest_bdev; 1328 em->bdev = root->fs_info->fs_devices->latest_bdev;
1329 set_bit(EXTENT_FLAG_PINNED, &em->flags); 1329 set_bit(EXTENT_FLAG_PINNED, &em->flags);
1330 set_bit(EXTENT_FLAG_PREALLOC, &em->flags); 1330 set_bit(EXTENT_FLAG_FILLING, &em->flags);
1331 while (1) { 1331 while (1) {
1332 write_lock(&em_tree->lock); 1332 write_lock(&em_tree->lock);
1333 ret = add_extent_mapping(em_tree, em); 1333 ret = add_extent_mapping(em_tree, em);
@@ -5945,7 +5945,7 @@ static struct extent_map *create_pinned_em(struct inode *inode, u64 start,
5945 em->orig_block_len = orig_block_len; 5945 em->orig_block_len = orig_block_len;
5946 set_bit(EXTENT_FLAG_PINNED, &em->flags); 5946 set_bit(EXTENT_FLAG_PINNED, &em->flags);
5947 if (type == BTRFS_ORDERED_PREALLOC) 5947 if (type == BTRFS_ORDERED_PREALLOC)
5948 set_bit(EXTENT_FLAG_PREALLOC, &em->flags); 5948 set_bit(EXTENT_FLAG_FILLING, &em->flags);
5949 5949
5950 do { 5950 do {
5951 btrfs_drop_extent_cache(inode, em->start, 5951 btrfs_drop_extent_cache(inode, em->start,