diff options
Diffstat (limited to 'fs/btrfs/ordered-data.c')
-rw-r--r-- | fs/btrfs/ordered-data.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index a8ffecd0b491..5c99882b9763 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -303,6 +303,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
303 | struct btrfs_ordered_extent *entry) | 303 | struct btrfs_ordered_extent *entry) |
304 | { | 304 | { |
305 | struct btrfs_ordered_inode_tree *tree; | 305 | struct btrfs_ordered_inode_tree *tree; |
306 | struct btrfs_root *root = BTRFS_I(inode)->root; | ||
306 | struct rb_node *node; | 307 | struct rb_node *node; |
307 | 308 | ||
308 | tree = &BTRFS_I(inode)->ordered_tree; | 309 | tree = &BTRFS_I(inode)->ordered_tree; |
@@ -312,12 +313,13 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
312 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); | 313 | set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); |
313 | 314 | ||
314 | spin_lock(&BTRFS_I(inode)->accounting_lock); | 315 | spin_lock(&BTRFS_I(inode)->accounting_lock); |
316 | WARN_ON(!BTRFS_I(inode)->outstanding_extents); | ||
315 | BTRFS_I(inode)->outstanding_extents--; | 317 | BTRFS_I(inode)->outstanding_extents--; |
316 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 318 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
317 | btrfs_unreserve_metadata_for_delalloc(BTRFS_I(inode)->root, | 319 | btrfs_unreserve_metadata_for_delalloc(BTRFS_I(inode)->root, |
318 | inode, 1); | 320 | inode, 1); |
319 | 321 | ||
320 | spin_lock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock); | 322 | spin_lock(&root->fs_info->ordered_extent_lock); |
321 | list_del_init(&entry->root_extent_list); | 323 | list_del_init(&entry->root_extent_list); |
322 | 324 | ||
323 | /* | 325 | /* |
@@ -329,7 +331,7 @@ static int __btrfs_remove_ordered_extent(struct inode *inode, | |||
329 | !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) { | 331 | !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_DIRTY)) { |
330 | list_del_init(&BTRFS_I(inode)->ordered_operations); | 332 | list_del_init(&BTRFS_I(inode)->ordered_operations); |
331 | } | 333 | } |
332 | spin_unlock(&BTRFS_I(inode)->root->fs_info->ordered_extent_lock); | 334 | spin_unlock(&root->fs_info->ordered_extent_lock); |
333 | 335 | ||
334 | return 0; | 336 | return 0; |
335 | } | 337 | } |