Subject: Re: Supporting sector size != DEV_BSIZE
To: Konrad Schroder <perseant@hhhh.org>
From: Trevin Beattie <trevin@xmission.com>
List: tech-kern
Date: 06/25/2002 18:44:01
At 05:00 PM 6/25/2002 -0700, Konrad Schroder 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,
>
>I still disagree with this.  It currently is true that "db" means
>DEV_BSIZE means sector size; the fact that you're going to differentiate
>DEV_BSIZE from sectors doesn't mean that "db" needs to mean one or the
>other.

Then what, pray tell, would it mean?  It can't be both at the same time!

>
>If we get to choose what it means, I'd like it to mean DEV_BSIZE;  both
>because of the similarity in the name, and because I imagine that most
>calls to fsbtodb() are setting up to call bread()/VOP_BWRITE (I'm fairly
>certain this is true for LFS, though I haven't counted the lines).  If I

Calls, yes.  But don't forget that fs->fs_fsbtodb is also stored on disk,
and that value is in terms of disk blocks (sectors).  And since the
original fsbtodb() macro relies on fs->fs_fsbtodb, then it too is really
written in terms of disk blocks.  The code just happened to depend on
having the disk block size and DEV_BSIZE be the same.

>am right about this, your patches would be significantly smaller in
>addition to avoiding what seem to me to be gratuitous changes.  (Are we
>ever going to try to sell this change to, say, FreeBSD?  Are we ever going
>to want to buy back changes from FreeBSD?  We've done it before.)

I'm not sure about this.  When I modified the ffs code, I changed the
fsbtodb macro to use DEV_BSIZE because nearly all instances of the macro
required those units.  But the lfs code seemed to be just the opposite;
using fsbtodb where DEV_BSIZE was required and something else when sectors
are needed would have resulted in at least as many changes as the other way
around.  I found it easier in lfs' case to let fsbtodb convert to disk blocks.

>
>Could you generate a version of this patch that uses macros (the names are
>not that important yet, since the process of converting the names to the
>yet-to-be-determined right names is mechanical)?  I'd prefer to say, "oh
>yes, convert blocks to sectors" when I'm trying to audit, instead of
>"`fs->lfs_bshift - fs->lfs_fsbshift' means converting between what and
>what again?"

The expression converts b's to (or from) fsb's, of course! ;-)
I'd say that it means the same as a macro called btofsb, but I think that
may already be in use for something else. :(
I'll get to in RSN. :)

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