Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2000 22:29:29 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        "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:  <Pine.BSF.4.21.0004042139060.2001-100000@alphplex.bde.org>
In-Reply-To: <23861.954797317@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 3 Apr 2000, Poul-Henning Kamp wrote:

> In message <Pine.BSF.4.21.0004040649300.1047-100000@alphplex.bde.org>, Bruce Ev
> ans writes:
> >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).

> Uhm Bruce, the code to implement this dual valid bit thingie will take
> up more space than we will ever save by doing it.
> 
> Lets keep it simple please.

You don't understand.  This _is_ simple and efficient.  See the first
40 lines of dscheck() which deal with translation from a logical blkno
to slice-relative physical blkno.  The duality bit handling adds only
about 28 lines to this:

	if (ssp->dss_secmult == 1) {				/* old */
		if (biop->bio_flags & BIO_BYTEOFFSET) {
			if (biop->bio_offset % (u_int64_t)DEV_BSIZE)
				goto bad_bio_offset;
			if (biop->bio_offset >= (u_int64_t)DEV_BSIZE << 31) 
				goto bad_bio_offset;
			secno = biop->b_offset >> DEV_BSHIFT;
		} else
			secno = blkno;				/* old */
		...						/* old */
	} else {						/* old */

and 2 more sets of 7 new lines for the other 2 special cases for
ssp->dss_secmult, and 7 new lines for error reporting.

The few callers that want a byte offset need 1 new line to set
BIO_BYTEOFFSET.  Currently, only physio() wants this.

> I will propose we stick to just one field in struct bio:  a 64bit
> byte offset, we may want to keep a blkno around in struct buf,
> but lets decide that separately.

This requires more widespread changes to convert block numbers to offsets
in all file systems, and normally gives 2 extra sets of conversions:
first to offsets in the file systems, then to sector numbers in dscheck().
With more work on the filesystems, some of the conversions can be
combined.  E.g., in ffs, fs->fsbtodb gives the shift count for converting
fs-blocks to "disk" blocks.  It needs to be replaced by (fs->fsbtodb + 9)
to convert directly from fs-blocks to byte offsets.

Bruce



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?Pine.BSF.4.21.0004042139060.2001-100000>