Using hard links when storing messages

Markus Nilsson markus at markusoft.se
Fri Mar 18 09:55:34 GMT 2011


Hi, 

I'm using the store-/path/_TOUSER_/ feature in Non Spam Actions to store a copy of the mail for each recipient. However this is a waste of space, and I thought it would be better to use hardlinks when multiple copies are used. I have made a small patch that tries to make a hardlink if the mail has already been stored, but creates a new copy if it fails:

The diff is against PFDiskStore.pm:


104a105,106
>   $this->{AlreadyStored} = 0;
> 
626a629,635
>     if($this->{AlreadyStored} == 1)
>     {
>       if(link($this->{AlreadyStoredPath}, $targetdir . '/' . $targetfile))
>       {
>         return $targetdir . '/' . $targetfile;
>       }
>     }
631a641,642
>     $this->{AlreadyStored} = 1;
>     $this->{AlreadyStoredPath} = $targetdir . '/' . $targetfile;


Is this something that would be useful for others?

BR/
Markus

 
 
--
This message has been scanned for viruses and dangerous content by CronLab
(www.cronlab.com), and is believed to be clean.



More information about the MailScanner mailing list