diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 11d0ad30e203..feca04197d02 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kthread.h> | 27 | #include <linux/kthread.h> |
28 | #include <linux/freezer.h> | 28 | #include <linux/freezer.h> |
29 | #include <linux/crc32c.h> | 29 | #include <linux/crc32c.h> |
30 | #include <linux/slab.h> | ||
30 | #include "compat.h" | 31 | #include "compat.h" |
31 | #include "ctree.h" | 32 | #include "ctree.h" |
32 | #include "disk-io.h" | 33 | #include "disk-io.h" |
@@ -43,8 +44,6 @@ static struct extent_io_ops btree_extent_io_ops; | |||
43 | static void end_workqueue_fn(struct btrfs_work *work); | 44 | static void end_workqueue_fn(struct btrfs_work *work); |
44 | static void free_fs_root(struct btrfs_root *root); | 45 | static void free_fs_root(struct btrfs_root *root); |
45 | 46 | ||
46 | static atomic_t btrfs_bdi_num = ATOMIC_INIT(0); | ||
47 | |||
48 | /* | 47 | /* |
49 | * end_io_wq structs are used to do processing in task context when an IO is | 48 | * end_io_wq structs are used to do processing in task context when an IO is |
50 | * complete. This is used during reads to verify checksums, and it is used | 49 | * complete. This is used during reads to verify checksums, and it is used |
@@ -1374,19 +1373,11 @@ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) | |||
1374 | { | 1373 | { |
1375 | int err; | 1374 | int err; |
1376 | 1375 | ||
1377 | bdi->name = "btrfs"; | ||
1378 | bdi->capabilities = BDI_CAP_MAP_COPY; | 1376 | bdi->capabilities = BDI_CAP_MAP_COPY; |
1379 | err = bdi_init(bdi); | 1377 | err = bdi_setup_and_register(bdi, "btrfs", BDI_CAP_MAP_COPY); |
1380 | if (err) | 1378 | if (err) |
1381 | return err; | 1379 | return err; |
1382 | 1380 | ||
1383 | err = bdi_register(bdi, NULL, "btrfs-%d", | ||
1384 | atomic_inc_return(&btrfs_bdi_num)); | ||
1385 | if (err) { | ||
1386 | bdi_destroy(bdi); | ||
1387 | return err; | ||
1388 | } | ||
1389 | |||
1390 | bdi->ra_pages = default_backing_dev_info.ra_pages; | 1381 | bdi->ra_pages = default_backing_dev_info.ra_pages; |
1391 | bdi->unplug_io_fn = btrfs_unplug_io_fn; | 1382 | bdi->unplug_io_fn = btrfs_unplug_io_fn; |
1392 | bdi->unplug_io_data = info; | 1383 | bdi->unplug_io_data = info; |
@@ -1634,7 +1625,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1634 | atomic_set(&fs_info->async_submit_draining, 0); | 1625 | atomic_set(&fs_info->async_submit_draining, 0); |
1635 | atomic_set(&fs_info->nr_async_bios, 0); | 1626 | atomic_set(&fs_info->nr_async_bios, 0); |
1636 | fs_info->sb = sb; | 1627 | fs_info->sb = sb; |
1637 | fs_info->max_extent = (u64)-1; | ||
1638 | fs_info->max_inline = 8192 * 1024; | 1628 | fs_info->max_inline = 8192 * 1024; |
1639 | fs_info->metadata_ratio = 0; | 1629 | fs_info->metadata_ratio = 0; |
1640 | 1630 | ||
@@ -1922,7 +1912,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1922 | 1912 | ||
1923 | csum_root->track_dirty = 1; | 1913 | csum_root->track_dirty = 1; |
1924 | 1914 | ||
1925 | btrfs_read_block_groups(extent_root); | 1915 | ret = btrfs_read_block_groups(extent_root); |
1916 | if (ret) { | ||
1917 | printk(KERN_ERR "Failed to read block groups: %d\n", ret); | ||
1918 | goto fail_block_groups; | ||
1919 | } | ||
1926 | 1920 | ||
1927 | fs_info->generation = generation; | 1921 | fs_info->generation = generation; |
1928 | fs_info->last_trans_committed = generation; | 1922 | fs_info->last_trans_committed = generation; |
@@ -1932,7 +1926,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1932 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 1926 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
1933 | "btrfs-cleaner"); | 1927 | "btrfs-cleaner"); |
1934 | if (IS_ERR(fs_info->cleaner_kthread)) | 1928 | if (IS_ERR(fs_info->cleaner_kthread)) |
1935 | goto fail_csum_root; | 1929 | goto fail_block_groups; |
1936 | 1930 | ||
1937 | fs_info->transaction_kthread = kthread_run(transaction_kthread, | 1931 | fs_info->transaction_kthread = kthread_run(transaction_kthread, |
1938 | tree_root, | 1932 | tree_root, |
@@ -2020,7 +2014,8 @@ fail_cleaner: | |||
2020 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); | 2014 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); |
2021 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 2015 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
2022 | 2016 | ||
2023 | fail_csum_root: | 2017 | fail_block_groups: |
2018 | btrfs_free_block_groups(fs_info); | ||
2024 | free_extent_buffer(csum_root->node); | 2019 | free_extent_buffer(csum_root->node); |
2025 | free_extent_buffer(csum_root->commit_root); | 2020 | free_extent_buffer(csum_root->commit_root); |
2026 | fail_dev_root: | 2021 | fail_dev_root: |