From: Chris Mason Date: Sat, 21 May 2011 13:27:38 +0000 (-0400) Subject: Merge branch 'ino-alloc' of git://repo.or.cz/linux-btrfs-devel into inode_numbers X-Git-Tag: v3.0-rc2~5^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0965537308ac3b267ea16e731bd73870a51c53b8;p=platform%2Fkernel%2Flinux-3.10.git Merge branch 'ino-alloc' of git://repo.or.cz/linux-btrfs-devel into inode_numbers Conflicts: fs/btrfs/free-space-cache.c Signed-off-by: Chris Mason --- 0965537308ac3b267ea16e731bd73870a51c53b8 diff --cc fs/btrfs/free-space-cache.c index 63731a1,7d8b6b6..25a13ab --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@@ -1744,10 -1804,29 +1804,34 @@@ out return 0; } - void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group) -void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) ++void __btrfs_remove_free_space_cache_locked(struct btrfs_free_space_ctl *ctl) { struct btrfs_free_space *info; struct rb_node *node; + - spin_lock(&ctl->tree_lock); + while ((node = rb_last(&ctl->free_space_offset)) != NULL) { + info = rb_entry(node, struct btrfs_free_space, offset_index); + unlink_free_space(ctl, info); + kfree(info->bitmap); + kmem_cache_free(btrfs_free_space_cachep, info); + if (need_resched()) { + spin_unlock(&ctl->tree_lock); + cond_resched(); + spin_lock(&ctl->tree_lock); + } + } ++} ++ ++void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) ++{ ++ spin_lock(&ctl->tree_lock); ++ __btrfs_remove_free_space_cache_locked(ctl); + spin_unlock(&ctl->tree_lock); + } + + void btrfs_remove_free_space_cache(struct btrfs_block_group_cache *block_group) + { + struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; struct btrfs_free_cluster *cluster; struct list_head *head; @@@ -1760,29 -1839,14 +1844,14 @@@ WARN_ON(cluster->block_group != block_group); __btrfs_return_cluster_to_free_space(block_group, cluster); if (need_resched()) { - spin_unlock(&block_group->tree_lock); + spin_unlock(&ctl->tree_lock); cond_resched(); - spin_lock(&block_group->tree_lock); + spin_lock(&ctl->tree_lock); } } ++ __btrfs_remove_free_space_cache_locked(ctl); + spin_unlock(&ctl->tree_lock); - while ((node = rb_last(&block_group->free_space_offset)) != NULL) { - info = rb_entry(node, struct btrfs_free_space, offset_index); - if (!info->bitmap) { - unlink_free_space(block_group, info); - kmem_cache_free(btrfs_free_space_cachep, info); - } else { - free_bitmap(block_group, info); - } - - if (need_resched()) { - spin_unlock(&block_group->tree_lock); - cond_resched(); - spin_lock(&block_group->tree_lock); - } - } - - spin_unlock(&block_group->tree_lock); - __btrfs_remove_free_space_cache(ctl); } u64 btrfs_find_space_for_alloc(struct btrfs_block_group_cache *block_group, @@@ -2303,11 -2373,11 +2378,11 @@@ int btrfs_trim_block_group(struct btrfs } else { start = entry->offset; bytes = min(entry->bytes, end - start); - unlink_free_space(block_group, entry); + unlink_free_space(ctl, entry); - kfree(entry); + kmem_cache_free(btrfs_free_space_cachep, entry); } - spin_unlock(&block_group->tree_lock); + spin_unlock(&ctl->tree_lock); if (bytes >= minlen) { int update_ret; diff --cc fs/btrfs/inode.c index 7cd8ab0,b78d3ab..01438e9b --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@@ -4729,15 -4753,18 +4755,19 @@@ static int btrfs_mknod(struct inode *di btrfs_set_trans_block_group(trans, dir); + err = btrfs_find_free_ino(root, &objectid); + if (err) + goto out_unlock; + inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, - dentry->d_name.len, dir->i_ino, objectid, + dentry->d_name.len, btrfs_ino(dir), objectid, BTRFS_I(dir)->block_group, mode, &index); - err = PTR_ERR(inode); - if (IS_ERR(inode)) + if (IS_ERR(inode)) { + err = PTR_ERR(inode); goto out_unlock; + } - err = btrfs_init_inode_security(trans, inode, dir); + err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); if (err) { drop_inode = 1; goto out_unlock; @@@ -4791,15 -4815,18 +4818,19 @@@ static int btrfs_create(struct inode *d btrfs_set_trans_block_group(trans, dir); + err = btrfs_find_free_ino(root, &objectid); + if (err) + goto out_unlock; + inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, - dentry->d_name.len, dir->i_ino, objectid, + dentry->d_name.len, btrfs_ino(dir), objectid, BTRFS_I(dir)->block_group, mode, &index); - err = PTR_ERR(inode); - if (IS_ERR(inode)) + if (IS_ERR(inode)) { + err = PTR_ERR(inode); goto out_unlock; + } - err = btrfs_init_inode_security(trans, inode, dir); + err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); if (err) { drop_inode = 1; goto out_unlock; @@@ -7274,16 -7299,19 +7302,20 @@@ static int btrfs_symlink(struct inode * btrfs_set_trans_block_group(trans, dir); + err = btrfs_find_free_ino(root, &objectid); + if (err) + goto out_unlock; + inode = btrfs_new_inode(trans, root, dir, dentry->d_name.name, - dentry->d_name.len, dir->i_ino, objectid, + dentry->d_name.len, btrfs_ino(dir), objectid, BTRFS_I(dir)->block_group, S_IFLNK|S_IRWXUGO, &index); - err = PTR_ERR(inode); - if (IS_ERR(inode)) + if (IS_ERR(inode)) { + err = PTR_ERR(inode); goto out_unlock; + } - err = btrfs_init_inode_security(trans, inode, dir); + err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); if (err) { drop_inode = 1; goto out_unlock; diff --cc fs/btrfs/tree-log.c index f997ec0,4323dc6..177d943 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@@ -2209,12 -2211,10 +2211,12 @@@ int btrfs_del_dir_entries_in_log(struc log = root->log_root; path = btrfs_alloc_path(); - if (!path) - return -ENOMEM; + if (!path) { + err = -ENOMEM; + goto out_unlock; + } - di = btrfs_lookup_dir_item(trans, log, path, dir->i_ino, + di = btrfs_lookup_dir_item(trans, log, path, dir_ino, name, name_len, -1); if (IS_ERR(di)) { err = PTR_ERR(di);