From 647a667e10c86534710b14968dd1a9fae6fb3e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 27 Apr 2022 13:01:42 +0200 Subject: [PATCH] rbd: reduce number of stats in likely path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- PVE/Storage/RBDPlugin.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm index 3293565..17bca60 100644 --- a/PVE/Storage/RBDPlugin.pm +++ b/PVE/Storage/RBDPlugin.pm @@ -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; }