Re: "ibstat -l" displays CA device list in an unsorted order

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

 



On Wed, Feb 26, 2020 at 09:43:10AM -0400, Jason Gunthorpe wrote:
> On Tue, Feb 25, 2020 at 10:25:49AM +0200, Haim Boozaglo wrote:
> >
> >
> > On 2/24/2020 9:41 PM, Jason Gunthorpe wrote:
> > > On Mon, Feb 24, 2020 at 08:06:56PM +0200, Haim Boozaglo wrote:
> > > > Hi all,
> > > >
> > > > When running "ibstat" or "ibstat -l", the output of CA device list
> > > > is displayed in an unsorted order.
> > > >
> > > > Before pull request #561, ibstat displayed the CA device list sorted in
> > > > alphabetical order.
> > > >
> > > > The problem is that users expect to have the output sorted in alphabetical
> > > > order and now they get it not as expected (in an unsorted order).
> > >
> > > Really? Why? That doesn't look like it should happen, the list is
> > > constructed out of readdir() which should be sorted?
> > >
> > > Do you know where this comes from?
> > >
> > > Jason
> > >
> >
> > readdir() gives us struct by struct and doesn't keep on alphabetical order.
> > Before pull request #561 ibstat have used this API of libibumad:
> > int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max)
> >
> > This API used this function:
> > n = scandir(SYS_INFINIBAND, &namelist, NULL, alphasort);
> >
> > scandir() can return a sorted CA device list in alphabetical order.
>
> Oh what a weird unintended side effect.
>
> Resolving it would require adding a sorting pass on a linked
> list.. Will you try?

Please be aware that once ibstat will be converted to netlink, the order
will change again.

Thanks

>
> Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux