]> git.proxmox.com Git - qemu-server.git/commit - PVE/QemuServer/PCI.pm
pci reservation: rework helpers style and readability wise
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Oct 2021 16:08:22 +0000 (18:08 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Oct 2021 17:58:16 +0000 (19:58 +0200)
commita01593676cf8e5da206008f1e104ab9dec231750
tree0cd1971c6b4615caabbb3bcdb94e6e87cdc116a3
parentbda0ebff2d50512b38e9d9c8a2bb4dd4ef691db8
pci reservation: rework helpers style and readability wise

both style and readability are naturally subjective to a certain
degree...

Also, this patch mixes a bit much into one thing, but splitting that
up would mean lots of work I just wanted to avoid, sorry about that.

Among other things:

- avoid a level of indentation in the reserve loop
- rename pciids to reservation_list where it was a better fit
- make reserve set either pid or time to avoid suggesting that we
  save both
- rename parameters to requested/dropped IDs for easier understanding
  what's going on in the code
- avoid old_pid/pid, use running_pid and reserver_pid instead to
  clarify what they actually mean
- drop useless returns to avoid suggesting the return value has any
  use and save some lnes
- use a hash slice to delete all dropped IDs at once, shorter and
  faster
- use 5 second timeout for reservation, this does nothing intensive
  nor does it wait for anything, so the critical section should be
  really short, 5s is really long enough for a wait..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer/PCI.pm