On 17 Feb 2005 at 11:27, Ken Gillett wrote:

> Initially the storage requirements are 2:1, so simply dividing the
> name by 3 would (I think) work, i.e. if the name is exactly divisible
> by 3 or not could determine in which location to place it. But if I
> need to change that to e.g. 3:2 it's not so simple and the ratio needs
> to be flexible so that it can be easily set and/or changed for
> different setups.

Ken,

I think that the mod function would work, and would allow you to 
easily change the ratio in the future.

In the present, you would use mod 3, and the answer would determine 
where to put the files, with 0 and 1 going onto one hard drive and 2 
going onto the other. So, for filename 10, the remainder is 1, and it 
would go onto the first harddrive. Filename 11 (remainder 2) would go 
onto the second. Filename 12 (remainder 0) would go onto the first, 
etc.

When you need to change the ratio, you simply change the details. In 
your example (ratio 3:2), you would use mod 5, and send remainders 0, 
1 & 2 onto the one hard drive, and remainders 3 & 4 onto the other.

HTH

Doug

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to