Merge branch 'ino-alloc' of git://repo.or.cz/linux-btrfs-devel into inode_numbers
authorChris Mason <chris.mason@oracle.com>
Sat, 21 May 2011 13:27:38 +0000 (09:27 -0400)
committerChris Mason <chris.mason@oracle.com>
Sat, 21 May 2011 13:27:38 +0000 (09:27 -0400)
Conflicts:
fs/btrfs/free-space-cache.c

Signed-off-by: Chris Mason <chris.mason@oracle.com>
1  2 
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/export.c
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/relocation.c
fs/btrfs/tree-log.c
fs/btrfs/xattr.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 63731a1fb0a1f9004e892a31e121ae977a9eff3a,7d8b6b6434034354965b3b5cc725e200dbd3ed5f..25a13ab750f80b8e0807248f7cfb585e0947ab39
        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;
  
                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;
index 7cd8ab0ef04d5b3e95ccd572f96ca858457e8c18,b78d3ab789ca2fc174b6cea6e8be6ad8ee6ab6a0..01438e9ba2e2c64a8de31dcd9c38403f89546a9e
@@@ -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;
Simple merge
Simple merge
index f997ec0c1ba4b8efb6b46f88160de43cda3da4f2,4323dc68d6cd00f15a0455aacf3555c9c7642516..177d943755f42f6e74ccddb5030a78624ea46cd3
@@@ -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);
Simple merge