Commit 23fa76b0 authored by Stefan Behrens's avatar Stefan Behrens Committed by Chris Mason
Browse files

Btrf: cleanup: don't check for root_refs == 0 twice



btrfs_read_fs_root_no_name() already checks if btrfs_root_refs()
is zero and returns ENOENT in this case. There is no need to do
it again in three more places.

Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 48475471
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -310,11 +310,6 @@ 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;
+0 −3
Original line number Diff line number Diff line
@@ -2354,9 +2354,6 @@ again:
			if (IS_ERR(root))
				continue;

			if (btrfs_root_refs(&root->root_item) == 0)
				continue;

			trans = btrfs_join_transaction(root);
			BUG_ON(IS_ERR(trans));

+0 −5
Original line number Diff line number Diff line
@@ -3217,11 +3217,6 @@ static int copy_nocow_pages_for_inode(u64 inum, u64 offset, u64 root, void *ctx)
		return PTR_ERR(local_root);
	}

	if (btrfs_root_refs(&local_root->root_item) == 0) {
		srcu_read_unlock(&fs_info->subvol_srcu, srcu_index);
		return -ENOENT;
	}

	key.type = BTRFS_INODE_ITEM_KEY;
	key.objectid = inum;
	key.offset = 0;