]> git.hungrycats.org Git - linux/commitdiff
Revert "Btrfs: fix race between caching kthread and returning inode to inode cache"
authorZygo Blaxell <zblaxell@serenity.furryterror.org>
Mon, 27 Jul 2015 17:18:53 +0000 (13:18 -0400)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Mon, 27 Jul 2015 17:18:53 +0000 (13:18 -0400)
This reverts commit e10900ff35b02404bbb4163980204cb4816c0777.

fs/btrfs/inode-map.c

index d4a582ac3f730f82299e997d0866e3caecacac7b..218df701e6071c83807b89979517f035d6e2a155 100644 (file)
@@ -246,7 +246,6 @@ void btrfs_unpin_free_ino(struct btrfs_root *root)
 {
        struct btrfs_free_space_ctl *ctl = root->free_ino_ctl;
        struct rb_root *rbroot = &root->free_ino_pinned->free_space_offset;
-       spinlock_t *rbroot_lock = &root->free_ino_pinned->tree_lock;
        struct btrfs_free_space *info;
        struct rb_node *n;
        u64 count;
@@ -255,29 +254,23 @@ void btrfs_unpin_free_ino(struct btrfs_root *root)
                return;
 
        while (1) {
-               bool add_to_ctl = true;
-
-               spin_lock(rbroot_lock);
                n = rb_first(rbroot);
-               if (!n) {
-                       spin_unlock(rbroot_lock);
+               if (!n)
                        break;
-               }
 
                info = rb_entry(n, struct btrfs_free_space, offset_index);
                BUG_ON(info->bitmap); /* Logic error */
 
                if (info->offset > root->ino_cache_progress)
-                       add_to_ctl = false;
+                       goto free;
                else if (info->offset + info->bytes > root->ino_cache_progress)
                        count = root->ino_cache_progress - info->offset + 1;
                else
                        count = info->bytes;
 
+               __btrfs_add_free_space(ctl, info->offset, count);
+free:
                rb_erase(&info->offset_index, rbroot);
-               spin_unlock(rbroot_lock);
-               if (add_to_ctl)
-                       __btrfs_add_free_space(ctl, info->offset, count);
                kmem_cache_free(btrfs_free_space_cachep, info);
        }
 }