Subject: MAXBSIZE Was Re: bread() returns EINVAL during vfs mount
To: Bill Studenmund <wrstuden@netbsd.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 08/27/2005 17:56:44
--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Aug 22, 2005 at 02:49:19PM -0700, Bill Studenmund wrote:
> On Sat, Aug 20, 2005 at 09:47:18PM -0500, Yevgeny Binder wrote:
> > I've tried to follow the ffs code closely while developing hfs+  
> > support, so it stumped me when I found that bread() invariably  
> > returns EINVAL in my VFS mount routine. I have a valid pointer to the  
> > volume's device node, devvp, obtained using the same ffs code:
> > 
> >     NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
> >     if ((error = namei(ndp)) != 0)
> >         return error;
> >     devvp = ndp->ni_vp;
> > 
> > ndp comes from the mount arguments, and args.fspec is presently set  
> > to "/dev/cd0a". I open this node and flush it:

HFS+ on CD? i found one recently but thought it was such an oddity. 
Aparently not :) I found the disc to be formatted with HFS+ and UDF and 
found the UDF part to be corrupt.

> >     error = bread(devvp, 16, 1536, cred, &bp);
>
> The problem is that pread() permits i/o access that is not permitted with 
> the buffer cache system. So it covers over issues that bread() won't.
> 
> The problem is that you have to read full blocks. On a CD, that means 2k. 
> 1536 is not an integer number of blocks, thus an EINVAL error.

not nessisarily 2k! though mostly used when writing CD's in streaming and 
packet mode. I dont know about HFS+ but the UDF filingsystem supports every 
multiple of 512 bytes as sector size though allways the same as the device 
has, and yes 7680 bytes/sector is valid as is 1536 :-S

I wonder how i can implement sector sizes bigger than MAXBSIZE (normally 
around 4k AFAIK) with normal bread and bwrite calls though.

> I think the problem is that you have drawn inspiration from file systems 
> that never face this issue. If someone ever built an ffs file system on a 
> CD, it would use 2k blocks, so all i/o would be 2k by nature and this 
> issue would never come up. :-|

hmm i tried FFS on a CD-MRW only to be shot in the back by the CD disklabel 
code that allways and only thinks iso9660 is the only valid thing on disc.

Reinoud


--vkogqOf2sHV7VnPd
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQxCNNIKcNwBDyKpoAQJD2AgAssyOKodTF+4r5FNTZHSr4s3LNZUfcFP6
6HWOw2Cm1TJfimVAXNgMzTxWOZ+t4HubV9UpMqNCcrK3nG7D7629eBmDzD2td9GL
8rv3cyc1A/3bQkpq0Vy1aYOp/yL91B2EP3n1AXyK6Oe1dJlu86DiIeSumtcmFEJd
ve2zdrRq4CDSkxiKlz9/6herWs6LVXjEot5RQIOpd5fT5ekOiHPBKRKig3f8hLoj
m65yC+snMavqJGAFcCZ4x9jJhDu/Ed24QSDK45dWJlZ98ysrOEaOAeHsM7qPX+c9
5HLeTwBMFbz7+V7y0Vq/Z7jdeeIiTujhNkSHd2Qdij3rYiQ6kjOwAg==
=Z+EK
-----END PGP SIGNATURE-----

--vkogqOf2sHV7VnPd--