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:
@ -63,7 +63,7 @@ my sub get_rbd_dev_path {
|
|||||||
my $pve_path = "/dev/rbd-pve/${cluster_id}/${rbd_path}";
|
my $pve_path = "/dev/rbd-pve/${cluster_id}/${rbd_path}";
|
||||||
my $path = "/dev/rbd/${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;
|
return $pve_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user