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

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

 



On Thu, Feb 27, 2020 at 12:57:31PM +0000, Vladimir Koushnir wrote:
> Ibstat dumps the current status only.
> It has nothing to do with hotplug.

Of course, print has nothing to do with hotplug, but we are talking
about general function to sort linked list of already existing devices.
The idea to sort such list in insertion means that every hotplug event
will reshuffle the list.

Thanks

>
> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma-owner@xxxxxxxxxxxxxxx> On Behalf Of Leon Romanovsky
> Sent: Thursday, February 27, 2020 2:50 PM
> To: Haim Boozaglo <haimbo@xxxxxxxxxxxx>
> Cc: Jason Gunthorpe <jgg@xxxxxxxx>; linux-rdma@xxxxxxxxxxxxxxx
> Subject: Re: "ibstat -l" displays CA device list in an unsorted order
>
> On Thu, Feb 27, 2020 at 09:48:45AM +0200, Haim Boozaglo wrote:
> >
> >
> > On 2/26/2020 7:09 PM, Jason Gunthorpe wrote:
> > > On Wed, Feb 26, 2020 at 03:57:49PM +0200, Leon Romanovsky wrote:
> > > > 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.
> > >
> > > This is why I suggest a function to sort the linked list that tools
> > > needing sorted order can call. Then it doesn't matter how we got the
> > > list
> > >
> > > Jason
> > >
> >
> > I can just sort the list at the time of insertion of each node.
>
> Will you "resort" your list in the hotplug event?
>
> Thanks
>
> >
> > Haim.



[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