Skip to contentSkip to conversation

Btrfs: don't bother autodefragging if our root is going away

PATCH New Josef Bacik 1 participant 1 message Jul 26, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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,

---
 fs/btrfs/file.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
fs/btrfs/file.c +5 -0
index 94413af..36ddd20 100644
@@ -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;
Signature · 1 line
1.7.7.6