diskinfo: get rid of topo calls if there are no -c or -P options
There's a commit from Tintri by DDN in OmniOS which avoids calls into topo when those data are not required.
This speeds it up a little and makes the command work in the absence of topo when
run without options.
Server with 18 disks:
$ time diskinfo TYPE DISK VID PID SIZE RMV SSD SCSI c0t5000CCA04D086780d0 HGST HUSMR1625ASS 232.89 GiB no yes .... real 0m3.952s user 0m0.205s sys 0m0.436s $ time ./diskinfo.new TYPE DISK VID PID SIZE RMV SSD SCSI c0t5000CCA04D086780d0 HGST HUSMR1625ASS 232.89 GiB no yes ... real 0m0.107s user 0m0.016s sys 0m0.032s
Updated by Andy Fiddaman 4 days ago
I tested this on a number of servers, comparing the output of a plain
diskinfo before and after this change, and then with the
-P parameters. Output was unchanged in all cases. With no parameters, the new version was consistently faster.
Updated by Electric Monk 3 days ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit 2b766db42fbe7dc313c8d6de18e15f3aa15a35bb Author: Alexander Eremin <firstname.lastname@example.org> Date: 2022-09-24T08:56:25.000Z 15004 diskinfo: get rid of topo calls if there are no -c or -P options Reviewed by: Marco van Wieringen <email@example.com> Reviewed by: Toomas Soome <firstname.lastname@example.org> Approved by: Gordon Ross <email@example.com>