aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-08-30 11:54:02 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-08-30 11:54:02 -0400
commit2bf5a725a3b82efeaf7b292c085e69a9388a89ea (patch)
tree47f76cf43ba6cea2e07fc34d708ac2915d6bdaa9 /fs/btrfs/extent_map.c
parent07157aacb1ecd394a5494910b5f80d7e7d407d37 (diff)
Btrfs: fsx delalloc fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 6053f9db0739..8ad6f8efc5a0 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -77,6 +77,8 @@ EXPORT_SYMBOL(alloc_extent_map);
77 77
78void free_extent_map(struct extent_map *em) 78void free_extent_map(struct extent_map *em)
79{ 79{
80 if (!em)
81 return;
80 if (atomic_dec_and_test(&em->refs)) { 82 if (atomic_dec_and_test(&em->refs)) {
81 WARN_ON(em->in_tree); 83 WARN_ON(em->in_tree);
82 kmem_cache_free(extent_map_cache, em); 84 kmem_cache_free(extent_map_cache, em);
@@ -102,6 +104,8 @@ EXPORT_SYMBOL(alloc_extent_state);
102 104
103void free_extent_state(struct extent_state *state) 105void free_extent_state(struct extent_state *state)
104{ 106{
107 if (!state)
108 return;
105 if (atomic_dec_and_test(&state->refs)) { 109 if (atomic_dec_and_test(&state->refs)) {
106 WARN_ON(state->in_tree); 110 WARN_ON(state->in_tree);
107 kmem_cache_free(extent_state_cache, state); 111 kmem_cache_free(extent_state_cache, state);
@@ -1395,8 +1399,8 @@ int extent_read_full_page(struct extent_map_tree *tree, struct page *page,
1395 1399
1396 if (!PagePrivate(page)) { 1400 if (!PagePrivate(page)) {
1397 SetPagePrivate(page); 1401 SetPagePrivate(page);
1398 set_page_private(page, 1);
1399 WARN_ON(!page->mapping->a_ops->invalidatepage); 1402 WARN_ON(!page->mapping->a_ops->invalidatepage);
1403 set_page_private(page, 1);
1400 page_cache_get(page); 1404 page_cache_get(page);
1401 } 1405 }
1402 1406
@@ -1638,7 +1642,8 @@ int extent_invalidatepage(struct extent_map_tree *tree,
1638 1642
1639 lock_extent(tree, start, end, GFP_NOFS); 1643 lock_extent(tree, start, end, GFP_NOFS);
1640 wait_on_extent_writeback(tree, start, end); 1644 wait_on_extent_writeback(tree, start, end);
1641 clear_extent_bit(tree, start, end, EXTENT_LOCKED | EXTENT_DIRTY, 1645 clear_extent_bit(tree, start, end,
1646 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC,
1642 1, 1, GFP_NOFS); 1647 1, 1, GFP_NOFS);
1643 return 0; 1648 return 0;
1644} 1649}