]> git.proxmox.com Git - pve-storage.git/commitdiff
rbd: reduce number of stats in likely path
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 27 Apr 2022 11:01:42 +0000 (13:01 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 27 Apr 2022 11:01:42 +0000 (13:01 +0200)
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>
PVE/Storage/RBDPlugin.pm

index 329356557c1a271543301e6648cc41fdf49ae3db..17bca60f3a28ccc1687d6f21eddb603576787579 100644 (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;
 }