[pve-devel] [PATCH storage 02/14] Diskmanage: replace closure with direct hash access

Fabian Ebner f.ebner at proxmox.com
Tue Jan 26 12:45:18 CET 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/Diskmanage.pm | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 116a99a..f28e007 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -480,11 +480,6 @@ sub get_disks {
 	$mounted->{abs_path($mount->[0])} = $mount->[1];
     };
 
-    my $dev_is_mounted = sub {
-	my ($dev) = @_;
-	return $mounted->{$dev};
-    };
-
     my $parttype_map = get_parttype_info();
 
     my $journalhash = get_ceph_journals($parttype_map);
@@ -567,7 +562,7 @@ sub get_disks {
 
 	$used = 'LVM' if $lvmhash->{$devpath};
 
-	$used = 'mounted' if &$dev_is_mounted($devpath);
+	$used = 'mounted' if $mounted->{$devpath};
 
 	$used = 'ZFS' if $zfshash->{$devpath};
 
@@ -621,7 +616,7 @@ sub get_disks {
 
 	    $found_partitions = 1;
 
-	    if (my $mp = &$dev_is_mounted("$partpath/$part")) {
+	    if (my $mp = $mounted->{"$partpath/$part"}) {
 		$found_mountpoints = 1;
 		if ($mp =~ m|^/var/lib/ceph/osd/ceph-(\d+)$|) {
 		    $osdid = $1;
-- 
2.20.1






More information about the pve-devel mailing list