Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151089
b: refs/heads/master
c: ad081f1
h: refs/heads/master
i:
  151087: 00f8126
v: v3
  • Loading branch information
Jens Axboe committed Jun 16, 2009
1 parent f36a248 commit 082dd57
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0989a025d2f4f9f51ea641bd26c563c53dc63f55
refs/heads/master: ad081f1430515d0b727eba99ec435a526c61a599
26 changes: 21 additions & 5 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
static struct extent_io_ops btree_extent_io_ops;
static void end_workqueue_fn(struct btrfs_work *work);

static atomic_t btrfs_bdi_num = ATOMIC_INIT(0);

/*
* end_io_wq structs are used to do processing in task context when an IO is
* complete. This is used during reads to verify checksums, and it is used
Expand Down Expand Up @@ -1342,12 +1344,25 @@ static void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
free_extent_map(em);
}

/*
* If this fails, caller must call bdi_destroy() to get rid of the
* bdi again.
*/
static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi)
{
bdi_init(bdi);
int err;

bdi->capabilities = BDI_CAP_MAP_COPY;
err = bdi_init(bdi);
if (err)
return err;

err = bdi_register(bdi, NULL, "btrfs-%d",
atomic_inc_return(&btrfs_bdi_num));
if (err)
return err;

bdi->ra_pages = default_backing_dev_info.ra_pages;
bdi->state = 0;
bdi->capabilities = default_backing_dev_info.capabilities;
bdi->unplug_io_fn = btrfs_unplug_io_fn;
bdi->unplug_io_data = info;
bdi->congested_fn = btrfs_congested_fn;
Expand Down Expand Up @@ -1569,7 +1584,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
fs_info->sb = sb;
fs_info->max_extent = (u64)-1;
fs_info->max_inline = 8192 * 1024;
setup_bdi(fs_info, &fs_info->bdi);
if (setup_bdi(fs_info, &fs_info->bdi))
goto fail_bdi;
fs_info->btree_inode = new_inode(sb);
fs_info->btree_inode->i_ino = 1;
fs_info->btree_inode->i_nlink = 1;
Expand Down Expand Up @@ -1946,8 +1962,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,

btrfs_close_devices(fs_info->fs_devices);
btrfs_mapping_tree_free(&fs_info->mapping_tree);
fail_bdi:
bdi_destroy(&fs_info->bdi);

fail:
kfree(extent_root);
kfree(tree_root);
Expand Down

0 comments on commit 082dd57

Please sign in to comment.