On 2/27/2020 8:33 AM, Jason Gunthorpe wrote:
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.
I'd rather not have to pay the sorting penalty for all users, it seems
only a few command line tools need the sort
Should we really go out on limb here and assume it's just a few CLI
tools? What about all the sysadmin type scripts out there? We aren't
having a good track record not breaking user space lately.
Is the sorting penalty really going to be that bad? It's not like we
will have a large number of devices that sorting should really be an
issue I wouldn't think.
-Denny