5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-02-25 17:57:31 +03:00

rbd: reduce number of stats in likely path

the new udev rule is expected to be in place and active, switching the
checks around means 1 instead of 2 stat()s in this rather hot code path.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-04-27 13:01:42 +02:00
parent cfe46e2d4a
commit 647a667e10

View File

@ -63,7 +63,7 @@ my sub get_rbd_dev_path {
my $pve_path = "/dev/rbd-pve/${cluster_id}/${rbd_path}";
my $path = "/dev/rbd/${rbd_path}";
return $path if -e $path && !-e $pve_path; # mapped before rbd-pve udev rule existed
return $path if !-e $pve_path && -e $path; # mapped before rbd-pve udev rule existed
return $pve_path;
}