summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
authorJosef Bacik2013-07-26 15:13:15 +0200
committerChris Mason2013-09-01 14:04:25 +0200
commit2112ac800d43e795323bc18558e43fd3641da4ed (patch)
tree83d07e75f6734847e9bec73d26135dd66707f37a /fs/btrfs/file.c
parentBtrfs: cleanup reloc roots properly on error (diff)
downloadkernel-qcow2-linux-2112ac800d43e795323bc18558e43fd3641da4ed.tar.gz
kernel-qcow2-linux-2112ac800d43e795323bc18558e43fd3641da4ed.tar.xz
kernel-qcow2-linux-2112ac800d43e795323bc18558e43fd3641da4ed.zip
Btrfs: don't bother autodefragging if our root is going away
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>
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 8e686a427ce2..8cc941e5b3e1 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -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;