Subject: Re: sector size != DEV_BSIZE -- revised patches
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 06/09/2002 21:48:31
On Sat, Jun 08, 2002 at 07:29:07PM -0700, Trevin Beattie wrote:
> After taking everybody's suggestions into account, I've made some more
> changes to the ffs.  In particular, I've retracted my previous changes to
> newfs/mkfs, so that certain fields remain in terms of physical sector size
> and *not* DEV_BSIZE.  And I've carefully checked the ffs driver to make
> sure it only used physical parameters where appropriate, and using the
> correct fields in the super block to convert those to byte offsets.
> 
> With the patches, I have managed to create a new file system on a virtual
> disk using 2048 bytes per sector, mount it, and write some files.  Then,
> just for fun, I tried reconfiguring the virtual disk for 512 bytes per
> sector and mounted it again.  It still worked!  I wasn't sure whether it
> would, because the disk label still reads 2048 B/s.
> 
> Note that some of the patches are mostly additions to or changes in
> comments, which I put in to clarify (for me) what the code was / should be
> doing.  Feel free to accept or ignore those changes.
> 
> Still haven't tried this out on a real MO disk yet.
> 
> The significant code changes are:
> 
> In arch/i386/i386/disksubr.c, fixed partition boundary checking
> 
> In ufs/ffs/ffs_vfsops.c, make sure super-block is read from the correct
> (byte) offset
> 
> ** In ufs/ffs/fs.h, changed the macros fsbtodb() and dbtofsb() to convert
> to/from DEV_BSHIFT units instead of sectors.  This change needs more
> careful examination, because I have no idea whether any external programs
> use them.  Also, I have only audited their use in the ffs file system; I
> have not checked lfs, ext2fs, mfs, or whatever other file systems may use
> them.
> 
> In sbin/newfs/mkfs.c, use NSPF() instead of fsbtodb()
> 
> In sbin/newfs/newfs.c, read the file system size in bytes instead of
> sectors until after the options have been parsed and the sector size is known.
>  
> -	/* alays new format */
> +	/* alay's new format */

Wouldn't 'always' be a better word here :-)

	David

-- 
David Laight: david@l8s.co.uk