Re: [PATCHv2] pci: properly handle out-of-order SRIOV virtual functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 8, 2013 at 10:20 AM, Ján Tomko <jtomko@xxxxxxxxxx> wrote:
> On 11/08/2013 08:47 AM, Niilona wrote:
>> @@ -2412,15 +2420,16 @@ virPCIGetVirtualFunctions(const char *sy
>>          return ret;
>>      }
>>
>> -    while ((entry = readdir(dir))) {
>> -        if (STRPREFIX(entry->d_name, "virtfn")) {
>> +    entry_count = scandir(sysfs_path, &namelist, virtfn_select, alphasort);
>
> alphasort will make sure that the order is always wrong if there are more than
> 10 functions.
>
> Hopefully we can use versionsort thanks to gnulib.
>
>> +
>> +    while ( current_entry < entry_count ) {
>>              virPCIDeviceAddress *config_addr = NULL;
>>
>> -            if (virBuildPath(&device_link, sysfs_path, entry->d_name) == -1) {
>> +            if (virBuildPath(&device_link, sysfs_path, namelist[
>> current_entry ]->d_name ) == -1) {
>>                  virReportOOMError();
>>                  goto error;
>>              }
>> -
>> +            current_entry ++;
>>              VIR_DEBUG("Number of virtual functions: %d",
>>                        *num_virtual_functions);
>>
>
>

true that alphasort breaks advantage, what's obtained using scandir().
versionsort is a good point.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]