Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Apr 2000 14:50:02 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, "Justin T. Gibbs" <gibbs@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_mib.c vfs_bio.c src/sys/sys buf.h 
Message-ID:  <200004032150.OAA02130@mass.cdrom.com>
In-Reply-To: Your message of "Tue, 04 Apr 2000 07:10:47 %2B1000." <Pine.BSF.4.21.0004040649300.1047-100000@alphplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > Let me see if I read you right:
> > 	a 64bit byte offset in bio->bio_offset
> > 	no bio->bio_*blkno fields
> > 	we retain buf->b_blkno
> > 
> > is that it ?
> 
> Not quite.  Something obviously has to set the disk-level block number
> (currently bio_pblkno).  It should be set from a valid block number or
> offset (bio_blkno or bio_offset).  There needs to be a validity bit or
> out-of bounds values to indicate invalid fields (I prefer the bit).
> Callers prefer bio_blkno if it is convenient and works (i.e., in most
> cases, until 1TB disks become common).
> 
> bio_offset could be overlayed with bio_blkno to save space (this requires
> a validity bit).  The validity bit essentially gives a block size.
> It is set when the block size is 1 and the full 64 bits of the offset
> are valid, and clear when the block size is DEV_BSIZE and only 32 bits
> of the offset are valid.

I don't much like this.

The device exports its block size in bytes; currently we make a lot of 
assumptions about this being DEV_BSIZE, but this is an error in other 
code that shouldn't be perpetuated.


The device operates in units of its current block size.  Code layered
above the device driver knows this size.  It is never valid (AFACT) to
make an I/O request that is not a multiple of the current block size or on
a block boundary. Thus it would make sense to mandate that the I/O size/
offset that is passed to the device should only ever be expressed in units
of the device's current block size.

Previous discussions about the use of byte-sized lengths and offsets in 
other parts of the system have been primarily to get around the abuse of 
DEV_BSIZE as an implied multiplier and all the associated drawbacks; I 
don't think that they ever countenanced passing these values down to the 
driver itself.

-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  msmith@freebsd.org
\\ and he'll hate you for a lifetime.             \\  msmith@cdrom.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004032150.OAA02130>