On Mon, Jun 06, 2016 at 11:02:09 +0200, Ján Tomko wrote: > Filter out some subsystems we are not interested in. > --- > After the netdev cleanups, this speeds up the driver initialization from 18 ms to 13 ms, > which is percentually a lot, but neligible in absolute times. > > This patch uses a negative filter because I could not find an exhaustive list of possible subsystems. > A positive filter could be applied to udev_monitor as well. > > src/node_device/node_device_udev.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c > index b46fec6..2e86230 100644 > --- a/src/node_device/node_device_udev.c > +++ b/src/node_device/node_device_udev.c > @@ -1167,13 +1167,34 @@ static int udevProcessDeviceListEntry(struct udev *udev, > } > > I think this deserves a comment explaining the reason and what to add here. > +const char *subsystem_blacklist[] = { > + "acpi", "tty", "vc", "i2c", > +}; > + > +static int udevEnumerateAddMatches(struct udev_enumerate *udev_enumerate) > +{ > + size_t i; > + > + for (i = 0; i < ARRAY_CARDINALITY(subsystem_blacklist); i++) { > + const char *s = subsystem_blacklist[i]; > + if (udev_enumerate_add_nomatch_subsystem(udev_enumerate, s) < 0) { > + virReportSystemError(errno, "%s", _("failed to add susbsystem filter")); > + return -1; Should this be fatal? On the other hand other stuff will probably fail too. > + } > + } > + return 0; > +} > + > + > static int udevEnumerateDevices(struct udev *udev) > { > struct udev_enumerate *udev_enumerate = NULL; > struct udev_list_entry *list_entry = NULL; > - int ret = 0; > + int ret = -1; > > udev_enumerate = udev_enumerate_new(udev); > + if (udevEnumerateAddMatches(udev_enumerate) < 0) > + goto cleanup; > > ret = udev_enumerate_scan_devices(udev_enumerate); > if (ret != 0) { ACK with the comment added. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list