diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index d28d29c95f7c..8b8192790011 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) |
@@ -1599,6 +1600,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1599 | 1600 | ||
1600 | sb->s_blocksize = 4096; | 1601 | sb->s_blocksize = 4096; |
1601 | sb->s_blocksize_bits = blksize_bits(4096); | 1602 | sb->s_blocksize_bits = blksize_bits(4096); |
1603 | sb->s_bdi = &fs_info->bdi; | ||
1602 | 1604 | ||
1603 | /* | 1605 | /* |
1604 | * we set the i_size on the btree inode to the max possible int. | 1606 | * we set the i_size on the btree inode to the max possible int. |
@@ -1639,6 +1641,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1639 | mutex_init(&fs_info->cleaner_mutex); | 1641 | mutex_init(&fs_info->cleaner_mutex); |
1640 | mutex_init(&fs_info->volume_mutex); | 1642 | mutex_init(&fs_info->volume_mutex); |
1641 | mutex_init(&fs_info->tree_reloc_mutex); | 1643 | mutex_init(&fs_info->tree_reloc_mutex); |
1644 | init_rwsem(&fs_info->extent_commit_sem); | ||
1642 | 1645 | ||
1643 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); | 1646 | btrfs_init_free_cluster(&fs_info->meta_alloc_cluster); |
1644 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); | 1647 | btrfs_init_free_cluster(&fs_info->data_alloc_cluster); |
@@ -1799,6 +1802,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1799 | btrfs_super_chunk_root(disk_super), | 1802 | btrfs_super_chunk_root(disk_super), |
1800 | blocksize, generation); | 1803 | blocksize, generation); |
1801 | BUG_ON(!chunk_root->node); | 1804 | BUG_ON(!chunk_root->node); |
1805 | if (!test_bit(EXTENT_BUFFER_UPTODATE, &chunk_root->node->bflags)) { | ||
1806 | printk(KERN_WARNING "btrfs: failed to read chunk root on %s\n", | ||
1807 | sb->s_id); | ||
1808 | goto fail_chunk_root; | ||
1809 | } | ||
1802 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); | 1810 | btrfs_set_root_node(&chunk_root->root_item, chunk_root->node); |
1803 | chunk_root->commit_root = btrfs_root_node(chunk_root); | 1811 | chunk_root->commit_root = btrfs_root_node(chunk_root); |
1804 | 1812 | ||
@@ -1826,6 +1834,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1826 | blocksize, generation); | 1834 | blocksize, generation); |
1827 | if (!tree_root->node) | 1835 | if (!tree_root->node) |
1828 | goto fail_chunk_root; | 1836 | goto fail_chunk_root; |
1837 | if (!test_bit(EXTENT_BUFFER_UPTODATE, &tree_root->node->bflags)) { | ||
1838 | printk(KERN_WARNING "btrfs: failed to read tree root on %s\n", | ||
1839 | sb->s_id); | ||
1840 | goto fail_tree_root; | ||
1841 | } | ||
1829 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); | 1842 | btrfs_set_root_node(&tree_root->root_item, tree_root->node); |
1830 | tree_root->commit_root = btrfs_root_node(tree_root); | 1843 | tree_root->commit_root = btrfs_root_node(tree_root); |
1831 | 1844 | ||
@@ -2322,6 +2335,9 @@ int close_ctree(struct btrfs_root *root) | |||
2322 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); | 2335 | printk(KERN_ERR "btrfs: commit super ret %d\n", ret); |
2323 | } | 2336 | } |
2324 | 2337 | ||
2338 | fs_info->closing = 2; | ||
2339 | smp_mb(); | ||
2340 | |||
2325 | if (fs_info->delalloc_bytes) { | 2341 | if (fs_info->delalloc_bytes) { |
2326 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", | 2342 | printk(KERN_INFO "btrfs: at unmount delalloc count %llu\n", |
2327 | (unsigned long long)fs_info->delalloc_bytes); | 2343 | (unsigned long long)fs_info->delalloc_bytes); |
@@ -2343,6 +2359,7 @@ int close_ctree(struct btrfs_root *root) | |||
2343 | free_extent_buffer(root->fs_info->csum_root->commit_root); | 2359 | free_extent_buffer(root->fs_info->csum_root->commit_root); |
2344 | 2360 | ||
2345 | btrfs_free_block_groups(root->fs_info); | 2361 | btrfs_free_block_groups(root->fs_info); |
2362 | btrfs_free_pinned_extents(root->fs_info); | ||
2346 | 2363 | ||
2347 | del_fs_roots(fs_info); | 2364 | del_fs_roots(fs_info); |
2348 | 2365 | ||