diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d28d29c95f7c..15831d5c7367 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1352,6 +1352,7 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) | |||
1352 | { | 1352 | { |
1353 | int err; | 1353 | int err; |
1354 | 1354 | ||
1355 | bdi->name = "btrfs"; | ||
1355 | bdi->capabilities = BDI_CAP_MAP_COPY; | 1356 | bdi->capabilities = BDI_CAP_MAP_COPY; |
1356 | err = bdi_init(bdi); | 1357 | err = bdi_init(bdi); |
1357 | if (err) | 1358 | if (err) |
@@ -1639,6 +1640,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1639 | mutex_init(&fs_info->cleaner_mutex); | 1640 | mutex_init(&fs_info->cleaner_mutex); |
1640 | mutex_init(&fs_info->volume_mutex); | 1641 | mutex_init(&fs_info->volume_mutex); |
1641 | mutex_init(&fs_info->tree_reloc_mutex); | 1642 | mutex_init(&fs_info->tree_reloc_mutex); |
1643 | init_rwsem(&fs_info->extent_commit_sem); | ||
1642 | 1644 | ||
1643 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); | 1645 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); |
1644 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); | 1646 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); |
@@ -1799,6 +1801,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1799 | btrfs_super_chunk_root(disk_super), | 1801 | btrfs_super_chunk_root(disk_super), |
1800 | blocksize, generation); | 1802 | blocksize, generation); |
1801 | BUG_ON(!chunk_root->node); | 1803 | BUG_ON(!chunk_root->node); |
1804 | if (!test_bit(EXTENT_BUFFER_UPTODATE, &chunk_root->node->bflags)) { | ||
1805 | printk(KERN_WARNING "btrfs: failed to read chunk root on %s\n", | ||
1806 | sb->s_id); | ||
1807 | goto fail_chunk_root; | ||
1808 | } | ||
1802 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); | 1809 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); |
1803 | chunk_root->commit_root = btrfs_root_node(chunk_root); | 1810 | chunk_root->commit_root = btrfs_root_node(chunk_root); |
1804 | 1811 | ||
@@ -1826,6 +1833,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1826 | blocksize, generation); | 1833 | blocksize, generation); |
1827 | if (!tree_root->node) | 1834 | if (!tree_root->node) |
1828 | goto fail_chunk_root; | 1835 | goto fail_chunk_root; |
1836 | if (!test_bit(EXTENT_BUFFER_UPTODATE, &tree_root->node->bflags)) { | ||
1837 | printk(KERN_WARNING "btrfs: failed to read tree root on %s\n", | ||
1838 | sb->s_id); | ||
1839 | goto fail_tree_root; | ||
1840 | } | ||
1829 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); | 1841 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); |
1830 | tree_root->commit_root = btrfs_root_node(tree_root); | 1842 | tree_root->commit_root = btrfs_root_node(tree_root); |
1831 | 1843 | ||
@@ -2322,6 +2334,9 @@ int close_ctree(struct btrfs_root *root) | |||
2322 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); | 2334 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); |
2323 | } | 2335 | } |
2324 | 2336 | ||
2337 | fs_info->closing = 2; | ||
2338 | smp_mb(); | ||
2339 | |||
2325 | if (fs_info->delalloc_bytes) { | 2340 | if (fs_info->delalloc_bytes) { |
2326 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", | 2341 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", |
2327 | (unsigned long long)fs_info->delalloc_bytes); | 2342 | (unsigned long long)fs_info->delalloc_bytes); |
@@ -2343,6 +2358,7 @@ int close_ctree(struct btrfs_root *root) | |||
2343 | free_extent_buffer(root->fs_info->csum_root->commit_root); | 2358 | free_extent_buffer(root->fs_info->csum_root->commit_root); |
2344 | 2359 | ||
2345 | btrfs_free_block_groups(root->fs_info); | 2360 | btrfs_free_block_groups(root->fs_info); |
2361 | btrfs_free_pinned_extents(root->fs_info); | ||
2346 | 2362 | ||
2347 | del_fs_roots(fs_info); | 2363 | del_fs_roots(fs_info); |
2348 | 2364 | ||