[pve-devel] [PATCH storage 1/3] Make the target cache works per target and portal

Daniel Berteaud daniel at firewall-services.com
Thu Sep 26 15:32:53 CEST 2019


----- Le 26 Sep 19, à 15:26, Thomas Lamprecht t.lamprecht at proxmox.com a écrit :

> On 9/25/19 10:28 AM, Daniel Berteaud wrote:
>> When working with several ZFS over iSCSI / LIO storages, we might lookup
>> between them with less than 15 sec interval.
>> Previously, the cache of the previous storage was used, which was breaking
>> disk move for example
>> 
> 
> looks Ok from a quick glance, but I would like to avoid nested hash accesses,
> e.g.: $foo->{$bar->{baz}}
> 
> As the access to @{$SETTINGS->{$scfg->{portal}.$scfg->{target}} is quite
> frequent (five times) we could maybe factor it out in a private sub?
> 
> my $get_target_settings = sub {
>    my ($scfg) = @_;
> 
>    my $id = "$scfg->{portal}.$scfg->{target}";
>    return $SETTINGS->{$id};
> };
> 
> then we could do:
> 
> my $target = $get_target_settings->($scfg);
> for my $lun (@{$target->{luns}}) {
>   ...
> 
> or
> $target->{luns} = $new;
> 
> (as like this, $target is a reference the $SETTINGS hash also sees the changes)
> 
> What do you think?

Sure, would indeed be a bit more readable. Will send a V2

-- 
[ https://www.firewall-services.com/ ] 	
Daniel Berteaud 
FIREWALL-SERVICES SAS, La sécurité des réseaux 
Société de Services en Logiciels Libres 
Tél : +33.5 56 64 15 32 
Matrix: @dani:fws.fr 
[ https://www.firewall-services.com/ | https://www.firewall-services.com ]




More information about the pve-devel mailing list