From nobody Mon Feb 9 00:56:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605279551; cv=none; d=zohomail.com; s=zohoarc; b=DbB6o04UGC7JSjS8L8R+gtC9uEwTZWrgzuVAHX9hlPpyhQcDTwZZSjoeEdv+p6Mn5rPhOdz556y0FxVnklMpZu/jA7C8qZ29pYY+OskVbuZLNbTZ7ks1tFWi5CYyij+Trhl5OCleG/7KQx4vjdEN02YKHGOaYHWGznryvLG9URQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605279551; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MyS51jffNvBtBzT4M1IEd2l64eG1cBJSoI71jGy84vU=; b=SJkPHVO5J1lx+zkrw31Q9g8zZGpGRmolZ1IEonrAl7K91O83USk/x3BQ4habC6bhkqok26IIYlxR2CRutQcMpKL6uVoKUgWq4ltl0L80mB3GEMDi1yB0TZZAYWg9/+Yg7DCHS8Eg/0G5T9UU54CjM0aP0pRmEQIorsr1WI8jRLA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605279551025125.24258559456666; Fri, 13 Nov 2020 06:59:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-q2SmgVWiN4qxfU0tIyXzfg-1; Fri, 13 Nov 2020 09:59:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DEDA71018F7B; Fri, 13 Nov 2020 14:59:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F2D975134; Fri, 13 Nov 2020 14:59:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 23B3C181A06E; Fri, 13 Nov 2020 14:59:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ADEwqp6016723 for ; Fri, 13 Nov 2020 09:58:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF8A95B4B2; Fri, 13 Nov 2020 14:58:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0ACE5B4A4 for ; Fri, 13 Nov 2020 14:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605279549; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MyS51jffNvBtBzT4M1IEd2l64eG1cBJSoI71jGy84vU=; b=g4zkBLV5M+rIMckfP2aXR7GOOUvjIJO+ajHPt6CCNISyQL5IAgcA3ERaQw64QZSRRW32Bt 9xXqrQ8IhH+G8YdpvnUAIZ2kwUWtb56SpHssB6O8/uNG/VEiyypCvaNpabFc4h7eohWfpc DC0BlPmc9O/7NYCGgYO9uA1BsrrzjxQ= X-MC-Unique: q2SmgVWiN4qxfU0tIyXzfg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] qemuDomainDiskControllerIsBusy: Optimize checking for SCSI hostdevs Date: Fri, 13 Nov 2020 15:58:41 +0100 Message-Id: <541aadd4c76534e170d8ed9dbc36ebf16010966e.1605279469.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Iterate through hostdevs only when the controller type is VIR_DOMAIN_CONTROLLER_TYPE_SCSI. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 90ed59a0ee..124f60912f 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -5373,13 +5373,15 @@ qemuDomainDiskControllerIsBusy(virDomainObjPtr vm, return true; } - for (i =3D 0; i < vm->def->nhostdevs; i++) { - hostdev =3D vm->def->hostdevs[i]; - if (!virHostdevIsSCSIDevice(hostdev) || - detach->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) - continue; - if (hostdev->info->addr.drive.controller =3D=3D detach->idx) - return true; + if (detach->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + for (i =3D 0; i < vm->def->nhostdevs; i++) { + hostdev =3D vm->def->hostdevs[i]; + if (!virHostdevIsSCSIDevice(hostdev)) + continue; + + if (hostdev->info->addr.drive.controller =3D=3D detach->idx) + return true; + } } return false; --=20 2.28.0