]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Btrfs: don't bother autodefragging if our root is going away
authorJosef Bacik <jbacik@fusionio.com>
Fri, 26 Jul 2013 13:13:15 +0000 (09:13 -0400)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:04:25 +0000 (08:04 -0400)
We can end up with inodes on the auto defrag list that exist on roots that are
going to be deleted.  This is extra work we don't need to do, so just bail if
our root has 0 root refs.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/file.c

index 8e686a427ce2e8e5e824419321f1f8f2dfe19acb..8cc941e5b3e152a7a9439385219a113698662876 100644 (file)
@@ -310,6 +310,11 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
                goto cleanup;
        }
 
+       if (btrfs_root_refs(&inode_root->root_item) == 0) {
+               ret = -ENOENT;
+               goto cleanup;
+       }
+
        key.objectid = defrag->ino;
        btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
        key.offset = 0;