disk-io.c (fcebe4562dec83b3f8d3088d77584727b09130b2) | disk-io.c (faa2dbf004e89e8f7ccd28fbe6f07c308417b8ae) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 1096 unchanged lines hidden (view full) --- 1105 u64 bytenr, u32 blocksize) 1106{ 1107 return find_extent_buffer(root->fs_info, bytenr); 1108} 1109 1110struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, 1111 u64 bytenr, u32 blocksize) 1112{ | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 1096 unchanged lines hidden (view full) --- 1105 u64 bytenr, u32 blocksize) 1106{ 1107 return find_extent_buffer(root->fs_info, bytenr); 1108} 1109 1110struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, 1111 u64 bytenr, u32 blocksize) 1112{ |
1113#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS 1114 if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) 1115 return alloc_test_extent_buffer(root->fs_info, bytenr, 1116 blocksize); 1117#endif |
|
1113 return alloc_extent_buffer(root->fs_info, bytenr, blocksize); 1114} 1115 1116 1117int btrfs_write_tree_block(struct extent_buffer *buf) 1118{ 1119 return filemap_fdatawrite_range(buf->pages[0]->mapping, buf->start, 1120 buf->start + buf->len - 1); --- 162 unchanged lines hidden (view full) --- 1283{ 1284 struct btrfs_root *root; 1285 1286 root = btrfs_alloc_root(NULL); 1287 if (!root) 1288 return ERR_PTR(-ENOMEM); 1289 __setup_root(4096, 4096, 4096, 4096, root, NULL, 1); 1290 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state); | 1118 return alloc_extent_buffer(root->fs_info, bytenr, blocksize); 1119} 1120 1121 1122int btrfs_write_tree_block(struct extent_buffer *buf) 1123{ 1124 return filemap_fdatawrite_range(buf->pages[0]->mapping, buf->start, 1125 buf->start + buf->len - 1); --- 162 unchanged lines hidden (view full) --- 1288{ 1289 struct btrfs_root *root; 1290 1291 root = btrfs_alloc_root(NULL); 1292 if (!root) 1293 return ERR_PTR(-ENOMEM); 1294 __setup_root(4096, 4096, 4096, 4096, root, NULL, 1); 1295 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state); |
1296 root->alloc_bytenr = 0; |
|
1291 1292 return root; 1293} 1294#endif 1295 1296struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, 1297 struct btrfs_fs_info *fs_info, 1298 u64 objectid) --- 785 unchanged lines hidden (view full) --- 2084 free_root_extent_buffers(info->extent_root); 2085 free_root_extent_buffers(info->csum_root); 2086 free_root_extent_buffers(info->quota_root); 2087 free_root_extent_buffers(info->uuid_root); 2088 if (chunk_root) 2089 free_root_extent_buffers(info->chunk_root); 2090} 2091 | 1297 1298 return root; 1299} 1300#endif 1301 1302struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, 1303 struct btrfs_fs_info *fs_info, 1304 u64 objectid) --- 785 unchanged lines hidden (view full) --- 2090 free_root_extent_buffers(info->extent_root); 2091 free_root_extent_buffers(info->csum_root); 2092 free_root_extent_buffers(info->quota_root); 2093 free_root_extent_buffers(info->uuid_root); 2094 if (chunk_root) 2095 free_root_extent_buffers(info->chunk_root); 2096} 2097 |
2092static void del_fs_roots(struct btrfs_fs_info *fs_info) | 2098void btrfs_free_fs_roots(struct btrfs_fs_info *fs_info) |
2093{ 2094 int ret; 2095 struct btrfs_root *gang[8]; 2096 int i; 2097 2098 while (!list_empty(&fs_info->dead_roots)) { 2099 gang[0] = list_entry(fs_info->dead_roots.next, 2100 struct btrfs_root, root_list); --- 863 unchanged lines hidden (view full) --- 2964 2965 return 0; 2966 2967fail_qgroup: 2968 btrfs_free_qgroup_config(fs_info); 2969fail_trans_kthread: 2970 kthread_stop(fs_info->transaction_kthread); 2971 btrfs_cleanup_transaction(fs_info->tree_root); | 2099{ 2100 int ret; 2101 struct btrfs_root *gang[8]; 2102 int i; 2103 2104 while (!list_empty(&fs_info->dead_roots)) { 2105 gang[0] = list_entry(fs_info->dead_roots.next, 2106 struct btrfs_root, root_list); --- 863 unchanged lines hidden (view full) --- 2970 2971 return 0; 2972 2973fail_qgroup: 2974 btrfs_free_qgroup_config(fs_info); 2975fail_trans_kthread: 2976 kthread_stop(fs_info->transaction_kthread); 2977 btrfs_cleanup_transaction(fs_info->tree_root); |
2972 del_fs_roots(fs_info); | 2978 btrfs_free_fs_roots(fs_info); |
2973fail_cleaner: 2974 kthread_stop(fs_info->cleaner_kthread); 2975 2976 /* 2977 * make sure we're done with the btree inode before we stop our 2978 * kthreads 2979 */ 2980 filemap_write_and_wait(fs_info->btree_inode->i_mapping); --- 518 unchanged lines hidden (view full) --- 3499 spin_unlock(&fs_info->fs_roots_radix_lock); 3500 3501 if (btrfs_root_refs(&root->root_item) == 0) 3502 synchronize_srcu(&fs_info->subvol_srcu); 3503 3504 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) 3505 btrfs_free_log(NULL, root); 3506 | 2979fail_cleaner: 2980 kthread_stop(fs_info->cleaner_kthread); 2981 2982 /* 2983 * make sure we're done with the btree inode before we stop our 2984 * kthreads 2985 */ 2986 filemap_write_and_wait(fs_info->btree_inode->i_mapping); --- 518 unchanged lines hidden (view full) --- 3505 spin_unlock(&fs_info->fs_roots_radix_lock); 3506 3507 if (btrfs_root_refs(&root->root_item) == 0) 3508 synchronize_srcu(&fs_info->subvol_srcu); 3509 3510 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) 3511 btrfs_free_log(NULL, root); 3512 |
3507 __btrfs_remove_free_space_cache(root->free_ino_pinned); 3508 __btrfs_remove_free_space_cache(root->free_ino_ctl); | 3513 if (root->free_ino_pinned) 3514 __btrfs_remove_free_space_cache(root->free_ino_pinned); 3515 if (root->free_ino_ctl) 3516 __btrfs_remove_free_space_cache(root->free_ino_ctl); |
3509 free_fs_root(root); 3510} 3511 3512static void free_fs_root(struct btrfs_root *root) 3513{ 3514 iput(root->cache_inode); 3515 WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree)); 3516 btrfs_free_block_rsv(root, root->orphan_block_rsv); --- 133 unchanged lines hidden (view full) --- 3650 3651 if (percpu_counter_sum(&fs_info->delalloc_bytes)) { 3652 btrfs_info(root->fs_info, "at unmount delalloc count %lld", 3653 percpu_counter_sum(&fs_info->delalloc_bytes)); 3654 } 3655 3656 btrfs_sysfs_remove_one(fs_info); 3657 | 3517 free_fs_root(root); 3518} 3519 3520static void free_fs_root(struct btrfs_root *root) 3521{ 3522 iput(root->cache_inode); 3523 WARN_ON(!RB_EMPTY_ROOT(&root->inode_tree)); 3524 btrfs_free_block_rsv(root, root->orphan_block_rsv); --- 133 unchanged lines hidden (view full) --- 3658 3659 if (percpu_counter_sum(&fs_info->delalloc_bytes)) { 3660 btrfs_info(root->fs_info, "at unmount delalloc count %lld", 3661 percpu_counter_sum(&fs_info->delalloc_bytes)); 3662 } 3663 3664 btrfs_sysfs_remove_one(fs_info); 3665 |
3658 del_fs_roots(fs_info); | 3666 btrfs_free_fs_roots(fs_info); |
3659 3660 btrfs_put_block_group_cache(fs_info); 3661 3662 btrfs_free_block_groups(fs_info); 3663 3664 /* 3665 * we must make sure there is not any read request to 3666 * submit after we stopping all workers. --- 499 unchanged lines hidden --- | 3667 3668 btrfs_put_block_group_cache(fs_info); 3669 3670 btrfs_free_block_groups(fs_info); 3671 3672 /* 3673 * we must make sure there is not any read request to 3674 * submit after we stopping all workers. --- 499 unchanged lines hidden --- |