diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 228cf36ece83..ac1cd20d1c0d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "locking.h" | 41 | #include "locking.h" |
42 | #include "tree-log.h" | 42 | #include "tree-log.h" |
43 | #include "free-space-cache.h" | 43 | #include "free-space-cache.h" |
44 | #include "inode-map.h" | ||
44 | 45 | ||
45 | static struct extent_io_ops btree_extent_io_ops; | 46 | static struct extent_io_ops btree_extent_io_ops; |
46 | static void end_workqueue_fn(struct btrfs_work *work); | 47 | static void end_workqueue_fn(struct btrfs_work *work); |
@@ -1326,6 +1327,19 @@ again: | |||
1326 | if (IS_ERR(root)) | 1327 | if (IS_ERR(root)) |
1327 | return root; | 1328 | return root; |
1328 | 1329 | ||
1330 | root->free_ino_ctl = kzalloc(sizeof(*root->free_ino_ctl), GFP_NOFS); | ||
1331 | if (!root->free_ino_ctl) | ||
1332 | goto fail; | ||
1333 | root->free_ino_pinned = kzalloc(sizeof(*root->free_ino_pinned), | ||
1334 | GFP_NOFS); | ||
1335 | if (!root->free_ino_pinned) | ||
1336 | goto fail; | ||
1337 | |||
1338 | btrfs_init_free_ino_ctl(root); | ||
1339 | mutex_init(&root->fs_commit_mutex); | ||
1340 | spin_lock_init(&root->cache_lock); | ||
1341 | init_waitqueue_head(&root->cache_wait); | ||
1342 | |||
1329 | set_anon_super(&root->anon_super, NULL); | 1343 | set_anon_super(&root->anon_super, NULL); |
1330 | 1344 | ||
1331 | if (btrfs_root_refs(&root->root_item) == 0) { | 1345 | if (btrfs_root_refs(&root->root_item) == 0) { |
@@ -2404,12 +2418,15 @@ int btrfs_free_fs_root(struct btrfs_fs_info *fs_info, struct btrfs_root *root) | |||
2404 | if (btrfs_root_refs(&root->root_item) == 0) | 2418 | if (btrfs_root_refs(&root->root_item) == 0) |
2405 | synchronize_srcu(&fs_info->subvol_srcu); | 2419 | synchronize_srcu(&fs_info->subvol_srcu); |
2406 | 2420 | ||
2421 | __btrfs_remove_free_space_cache(root->free_ino_pinned); | ||
2422 | __btrfs_remove_free_space_cache(root->free_ino_ctl); | ||
2407 | free_fs_root(root); | 2423 | free_fs_root(root); |
2408 | return 0; | 2424 | return 0; |
2409 | } | 2425 | } |
2410 | 2426 | ||
2411 | static void free_fs_root(struct btrfs_root *root) | 2427 | static void free_fs_root(struct btrfs_root *root) |
2412 | { | 2428 | { |
2429 | iput(root->cache_inode); | ||
2413 | WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree)); | 2430 | WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree)); |
2414 | if (root->anon_super.s_dev) { | 2431 | if (root->anon_super.s_dev) { |
2415 | down_write(&root->anon_super.s_umount); | 2432 | down_write(&root->anon_super.s_umount); |
@@ -2417,6 +2434,8 @@ static void free_fs_root(struct btrfs_root *root) | |||
2417 | } | 2434 | } |
2418 | free_extent_buffer(root->node); | 2435 | free_extent_buffer(root->node); |
2419 | free_extent_buffer(root->commit_root); | 2436 | free_extent_buffer(root->commit_root); |
2437 | kfree(root->free_ino_ctl); | ||
2438 | kfree(root->free_ino_pinned); | ||
2420 | kfree(root->name); | 2439 | kfree(root->name); |
2421 | kfree(root); | 2440 | kfree(root); |
2422 | } | 2441 | } |