Subject: Re: Supporting sector size != DEV_BSIZE
To: None <tech-kern@netbsd.org>
From: Trevin Beattie <trevin@xmission.com>
List: tech-kern
Date: 06/28/2002 18:10:22
At 04:24 PM 6/25/2002 -0700, Bill Studenmund wrote:
>On Tue, 25 Jun 2002, Trevin Beattie wrote:
>>
>> Right now I'm of the opinion that the existing conversion macros and unit
>> affixes should keep their historical meaning.  Specifically, 'db' means
>> "disk blocks" a.k.a. physical sectors.  (I think that's what it used to be,
>> a long time ago, isn't it?)  A new set of macros should be created that
>> convert to/from DEV_BSIZE units, adding a new affix to the list of block
>> types.
>>
>> I have the following suggestions for identifying a DEV_BSIZE unit:
>> 	* kb		(kernel block)
>> 	* DB		(DEV_BSIZE; differentiated from disk block by case)
>> 	* iob		(I/O block)
>>
>> Each possible code has its cons: "kb" could be confused with "kilobyte"
>> (which is a different number); "DB" is spelled the same as "db" (any
>> case-insensitive compiler tools?); "iob" is longer and not specific enough.
>>  Any better suggestion, or vote for one of the above options, is welcome.
>
>I agree, 'kb' is too close to kilobyte. :-) I could live with DB. Or, how
>about 'bb' for bufcache block?

You may have noticed that I already used 'kb' in my msdosfs patch (PR
#17398). :)  Whoever is going to handle merging it into the source tree
will need to be alerted if we want to change that.

As for UFS, I have at the moment settled on using DB, since the chances of
confusing DB with db are about the same as confusing device blocks with
disk blocks.  I've started converting / adding appropriate macros to the
ffs code.

Then I noticed that a few places need to convert bytes to disk blocks, so
in keeping with the naming convention I wanted to make macros for
byte->block conversion named btodb() and dbtob().  HOWEVER, these names are
already defined in <machine>/param.h in terms of DEV_BSIZE, and they don't
use file system data at all!  Since these macros are used in a hundred
files in the source tree, including about twenty source files in user
programs, I thought I'd better ask before proceeding further: should I
change the existing macros, and all uses of them, to match the convention
we're using for the rest of the macros, or should I make up a new name for
byte <-> disk block conversion?

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