aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4e9ebe1f1827..e7b3cb5286a5 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -152,7 +152,7 @@ static struct btrfs_lockdep_keyset {
152 { .id = BTRFS_DEV_TREE_OBJECTID, .name_stem = "dev" }, 152 { .id = BTRFS_DEV_TREE_OBJECTID, .name_stem = "dev" },
153 { .id = BTRFS_FS_TREE_OBJECTID, .name_stem = "fs" }, 153 { .id = BTRFS_FS_TREE_OBJECTID, .name_stem = "fs" },
154 { .id = BTRFS_CSUM_TREE_OBJECTID, .name_stem = "csum" }, 154 { .id = BTRFS_CSUM_TREE_OBJECTID, .name_stem = "csum" },
155 { .id = BTRFS_ORPHAN_OBJECTID, .name_stem = "orphan" }, 155 { .id = BTRFS_QUOTA_TREE_OBJECTID, .name_stem = "quota" },
156 { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" }, 156 { .id = BTRFS_TREE_LOG_OBJECTID, .name_stem = "log" },
157 { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" }, 157 { .id = BTRFS_TREE_RELOC_OBJECTID, .name_stem = "treloc" },
158 { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" }, 158 { .id = BTRFS_DATA_RELOC_TREE_OBJECTID, .name_stem = "dreloc" },
@@ -1513,7 +1513,6 @@ struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
1513 } 1513 }
1514 1514
1515 root->commit_root = btrfs_root_node(root); 1515 root->commit_root = btrfs_root_node(root);
1516 BUG_ON(!root->node); /* -ENOMEM */
1517out: 1516out:
1518 if (location->objectid != BTRFS_TREE_LOG_OBJECTID) { 1517 if (location->objectid != BTRFS_TREE_LOG_OBJECTID) {
1519 root->ref_cows = 1; 1518 root->ref_cows = 1;
@@ -1988,30 +1987,33 @@ static void free_root_pointers(struct btrfs_fs_info *info, int chunk_root)
1988{ 1987{
1989 free_extent_buffer(info->tree_root->node); 1988 free_extent_buffer(info->tree_root->node);
1990 free_extent_buffer(info->tree_root->commit_root); 1989 free_extent_buffer(info->tree_root->commit_root);
1991 free_extent_buffer(info->dev_root->node);
1992 free_extent_buffer(info->dev_root->commit_root);
1993 free_extent_buffer(info->extent_root->node);
1994 free_extent_buffer(info->extent_root->commit_root);
1995 free_extent_buffer(info->csum_root->node);
1996 free_extent_buffer(info->csum_root->commit_root);
1997 if (info->quota_root) {
1998 free_extent_buffer(info->quota_root->node);
1999 free_extent_buffer(info->quota_root->commit_root);
2000 }
2001
2002 info->tree_root->node = NULL; 1990 info->tree_root->node = NULL;
2003 info->tree_root->commit_root = NULL; 1991 info->tree_root->commit_root = NULL;
2004 info->dev_root->node = NULL; 1992
2005 info->dev_root->commit_root = NULL; 1993 if (info->dev_root) {
2006 info->extent_root->node = NULL; 1994 free_extent_buffer(info->dev_root->node);
2007 info->extent_root->commit_root = NULL; 1995 free_extent_buffer(info->dev_root->commit_root);
2008 info->csum_root->node = NULL; 1996 info->dev_root->node = NULL;
2009 info->csum_root->commit_root = NULL; 1997 info->dev_root->commit_root = NULL;
1998 }
1999 if (info->extent_root) {
2000 free_extent_buffer(info->extent_root->node);
2001 free_extent_buffer(info->extent_root->commit_root);
2002 info->extent_root->node = NULL;
2003 info->extent_root->commit_root = NULL;
2004 }
2005 if (info->csum_root) {
2006 free_extent_buffer(info->csum_root->node);
2007 free_extent_buffer(info->csum_root->commit_root);
2008 info->csum_root->node = NULL;
2009 info->csum_root->commit_root = NULL;
2010 }
2010 if (info->quota_root) { 2011 if (info->quota_root) {
2012 free_extent_buffer(info->quota_root->node);
2013 free_extent_buffer(info->quota_root->commit_root);
2011 info->quota_root->node = NULL; 2014 info->quota_root->node = NULL;
2012 info->quota_root->commit_root = NULL; 2015 info->quota_root->commit_root = NULL;
2013 } 2016 }
2014
2015 if (chunk_root) { 2017 if (chunk_root) {
2016 free_extent_buffer(info->chunk_root->node); 2018 free_extent_buffer(info->chunk_root->node);
2017 free_extent_buffer(info->chunk_root->commit_root); 2019 free_extent_buffer(info->chunk_root->commit_root);
@@ -3128,7 +3130,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
3128 * caller 3130 * caller
3129 */ 3131 */
3130 device->flush_bio = NULL; 3132 device->flush_bio = NULL;
3131 bio = bio_alloc(GFP_NOFS, 0); 3133 bio = btrfs_io_bio_alloc(GFP_NOFS, 0);
3132 if (!bio) 3134 if (!bio)
3133 return -ENOMEM; 3135 return -ENOMEM;
3134 3136
@@ -3659,8 +3661,11 @@ static void btrfs_destroy_ordered_operations(struct btrfs_transaction *t,
3659 ordered_operations); 3661 ordered_operations);
3660 3662
3661 list_del_init(&btrfs_inode->ordered_operations); 3663 list_del_init(&btrfs_inode->ordered_operations);
3664 spin_unlock(&root->fs_info->ordered_extent_lock);
3662 3665
3663 btrfs_invalidate_inodes(btrfs_inode->root); 3666 btrfs_invalidate_inodes(btrfs_inode->root);
3667
3668 spin_lock(&root->fs_info->ordered_extent_lock);
3664 } 3669 }
3665 3670
3666 spin_unlock(&root->fs_info->ordered_extent_lock); 3671 spin_unlock(&root->fs_info->ordered_extent_lock);
@@ -3782,8 +3787,11 @@ static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
3782 list_del_init(&btrfs_inode->delalloc_inodes); 3787 list_del_init(&btrfs_inode->delalloc_inodes);
3783 clear_bit(BTRFS_INODE_IN_DELALLOC_LIST, 3788 clear_bit(BTRFS_INODE_IN_DELALLOC_LIST,
3784 &btrfs_inode->runtime_flags); 3789 &btrfs_inode->runtime_flags);
3790 spin_unlock(&root->fs_info->delalloc_lock);
3785 3791
3786 btrfs_invalidate_inodes(btrfs_inode->root); 3792 btrfs_invalidate_inodes(btrfs_inode->root);
3793
3794 spin_lock(&root->fs_info->delalloc_lock);
3787 } 3795 }
3788 3796
3789 spin_unlock(&root->fs_info->delalloc_lock); 3797 spin_unlock(&root->fs_info->delalloc_lock);
@@ -3808,7 +3816,7 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
3808 while (start <= end) { 3816 while (start <= end) {
3809 eb = btrfs_find_tree_block(root, start, 3817 eb = btrfs_find_tree_block(root, start,
3810 root->leafsize); 3818 root->leafsize);
3811 start += eb->len; 3819 start += root->leafsize;
3812 if (!eb) 3820 if (!eb)
3813 continue; 3821 continue;
3814 wait_on_extent_buffer_writeback(eb); 3822 wait_on_extent_buffer_writeback(eb);