Subject: Re: Supporting sector size != DEV_BSIZE on lfs
To: Konrad Schroder <perseant@hhhh.org>
From: Trevin Beattie <trevin@xmission.com>
List: tech-kern
Date: 06/20/2002 11:38:24
At 01:46 PM 6/19/2002 -0700, Konrad Schroder wrote:
>>   needed = fsb + btofsb(...) + fsbtodb(...);
>>   Whatever the units of fsb are (expected to be), btofsb given a number of
>> frags, and fsbtodb gives a number of sectors.
>>
>> Is the last item a bug?  Since the next statement compares 'needed' to
>
>Yes, I think it is a bug.  I'll look at it tonight, though I think that
>just putting the first btofsb inside the fsbtodb might take care of it.

I just came along this function again from a different path, and it looks
like my previous assessment of the terms may have been incorrect.
lfs_truncate() calls lfs_reserve() with units of fsb (which, as you said,
varies depending on the LFS version); this gets passed in turn to lfs_fits
through the fsb parameter.  If that is the correct unit, then the third
term in the sum must be incorrect, and the fix is to remove the fsbtodb()
conversion.

It would also mean that all of the functions lfs_reserve(), lfs_fits(), and
lfs_availwait(); and the struct dlfs members lfs_bfree, lfs_avail, and
lfs_ravail; are all in units of fsb instead of blocks or sectors.  Is that
correct?

-----------------------
Trevin Beattie          "Do not meddle in the affairs of wizards,
trevin@xmission.com     for you are crunchy and good with ketchup."
      {:->                                     --unknown