aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/inode.c64
1 files changed, 28 insertions, 36 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d53cad1afe26..f44425081c02 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3596,40 +3596,10 @@ again:
3596 return 0; 3596 return 0;
3597} 3597}
3598 3598
3599static noinline void init_btrfs_i(struct inode *inode)
3600{
3601 struct btrfs_inode *bi = BTRFS_I(inode);
3602
3603 bi->generation = 0;
3604 bi->sequence = 0;
3605 bi->last_trans = 0;
3606 bi->last_sub_trans = 0;
3607 bi->logged_trans = 0;
3608 bi->delalloc_bytes = 0;
3609 bi->reserved_bytes = 0;
3610 bi->disk_i_size = 0;
3611 bi->flags = 0;
3612 bi->index_cnt = (u64)-1;
3613 bi->last_unlink_trans = 0;
3614 bi->ordered_data_close = 0;
3615 bi->force_compress = 0;
3616 extent_map_tree_init(&BTRFS_I(inode)->extent_tree, GFP_NOFS);
3617 extent_io_tree_init(&BTRFS_I(inode)->io_tree,
3618 inode->i_mapping, GFP_NOFS);
3619 extent_io_tree_init(&BTRFS_I(inode)->io_failure_tree,
3620 inode->i_mapping, GFP_NOFS);
3621 INIT_LIST_HEAD(&BTRFS_I(inode)->delalloc_inodes);
3622 INIT_LIST_HEAD(&BTRFS_I(inode)->ordered_operations);
3623 RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
3624 btrfs_ordered_inode_tree_init(&BTRFS_I(inode)->ordered_tree);
3625 mutex_init(&BTRFS_I(inode)->log_mutex);
3626}
3627
3628static int btrfs_init_locked_inode(struct inode *inode, void *p) 3599static int btrfs_init_locked_inode(struct inode *inode, void *p)
3629{ 3600{
3630 struct btrfs_iget_args *args = p; 3601 struct btrfs_iget_args *args = p;
3631 inode->i_ino = args->ino; 3602 inode->i_ino = args->ino;
3632 init_btrfs_i(inode);
3633 BTRFS_I(inode)->root = args->root; 3603 BTRFS_I(inode)->root = args->root;
3634 btrfs_set_inode_space_info(args->root, inode); 3604 btrfs_set_inode_space_info(args->root, inode);
3635 return 0; 3605 return 0;
@@ -3692,8 +3662,6 @@ static struct inode *new_simple_dir(struct super_block *s,
3692 if (!inode) 3662 if (!inode)
3693 return ERR_PTR(-ENOMEM); 3663 return ERR_PTR(-ENOMEM);
3694 3664
3695 init_btrfs_i(inode);
3696
3697 BTRFS_I(inode)->root = root; 3665 BTRFS_I(inode)->root = root;
3698 memcpy(&BTRFS_I(inode)->location, key, sizeof(*key)); 3666 memcpy(&BTRFS_I(inode)->location, key, sizeof(*key));
3699 BTRFS_I(inode)->dummy_inode = 1; 3667 BTRFS_I(inode)->dummy_inode = 1;
@@ -4092,7 +4060,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
4092 * btrfs_get_inode_index_count has an explanation for the magic 4060 * btrfs_get_inode_index_count has an explanation for the magic
4093 * number 4061 * number
4094 */ 4062 */
4095 init_btrfs_i(inode);
4096 BTRFS_I(inode)->index_cnt = 2; 4063 BTRFS_I(inode)->index_cnt = 2;
4097 BTRFS_I(inode)->root = root; 4064 BTRFS_I(inode)->root = root;
4098 BTRFS_I(inode)->generation = trans->transid; 4065 BTRFS_I(inode)->generation = trans->transid;
@@ -5263,21 +5230,46 @@ unsigned long btrfs_force_ra(struct address_space *mapping,
5263struct inode *btrfs_alloc_inode(struct super_block *sb) 5230struct inode *btrfs_alloc_inode(struct super_block *sb)
5264{ 5231{
5265 struct btrfs_inode *ei; 5232 struct btrfs_inode *ei;
5233 struct inode *inode;
5266 5234
5267 ei = kmem_cache_alloc(btrfs_inode_cachep, GFP_NOFS); 5235 ei = kmem_cache_alloc(btrfs_inode_cachep, GFP_NOFS);
5268 if (!ei) 5236 if (!ei)
5269 return NULL; 5237 return NULL;
5238
5239 ei->root = NULL;
5240 ei->space_info = NULL;
5241 ei->generation = 0;
5242 ei->sequence = 0;
5270 ei->last_trans = 0; 5243 ei->last_trans = 0;
5271 ei->last_sub_trans = 0; 5244 ei->last_sub_trans = 0;
5272 ei->logged_trans = 0; 5245 ei->logged_trans = 0;
5246 ei->delalloc_bytes = 0;
5247 ei->reserved_bytes = 0;
5248 ei->disk_i_size = 0;
5249 ei->flags = 0;
5250 ei->index_cnt = (u64)-1;
5251 ei->last_unlink_trans = 0;
5252
5253 spin_lock_init(&ei->accounting_lock);
5273 ei->outstanding_extents = 0; 5254 ei->outstanding_extents = 0;
5274 ei->reserved_extents = 0; 5255 ei->reserved_extents = 0;
5275 ei->root = NULL; 5256
5276 spin_lock_init(&ei->accounting_lock); 5257 ei->ordered_data_close = 0;
5258 ei->dummy_inode = 0;
5259 ei->force_compress = 0;
5260
5261 inode = &ei->vfs_inode;
5262 extent_map_tree_init(&ei->extent_tree, GFP_NOFS);
5263 extent_io_tree_init(&ei->io_tree, &inode->i_data, GFP_NOFS);
5264 extent_io_tree_init(&ei->io_failure_tree, &inode->i_data, GFP_NOFS);
5265 mutex_init(&ei->log_mutex);
5277 btrfs_ordered_inode_tree_init(&ei->ordered_tree); 5266 btrfs_ordered_inode_tree_init(&ei->ordered_tree);
5278 INIT_LIST_HEAD(&ei->i_orphan); 5267 INIT_LIST_HEAD(&ei->i_orphan);
5268 INIT_LIST_HEAD(&ei->delalloc_inodes);
5279 INIT_LIST_HEAD(&ei->ordered_operations); 5269 INIT_LIST_HEAD(&ei->ordered_operations);
5280 return &ei->vfs_inode; 5270 RB_CLEAR_NODE(&ei->rb_node);
5271
5272 return inode;
5281} 5273}
5282 5274
5283void btrfs_destroy_inode(struct inode *inode) 5275void btrfs_destroy_inode(struct inode *inode)