Jan Danielsson | 31 May 2012 13:08
Picon

kern/46494 (cgd on 4K sector disk)

Hello,

   I tried reusing the secsize from getdisksize() in place of DEV_BSIZE.
After correcting for a resulting divide-by-zero, I get further, but only
by a fraction.

   The disk in question (model: WD7500AARX; "750GB") has a GPT with one
partition which spans as much as possible of the disk:

# gpt show sd0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2          4         Pri GPT table
          6  183143635      1  GPT part - NetBSD Cryptographic Disk
  183143641          4         Sec GPT table
  183143645          1         Sec GPT header

# dkctl sd0 listwedges
/dev/rsd0d: 1 wedge:
dk0: My Test, 183143635 blocks at 6, type: cgd

   cgd3 is configured on top of /dev/dk0.

   At this point I've been trying to take all kinds of random actions on
cgd3. For instance, creating a disklabel, creating a GPT, and using dd.

   What I can do now, with the attached patch (which I couldn't before),
is to create (as in 'write') a disklabel in cgd3.

(Continue reading)

Roland C. Dowdeswell | 31 May 2012 13:23
Favicon

Re: kern/46494 (cgd on 4K sector disk)

On Thu, May 31, 2012 at 01:08:44PM +0200, Jan Danielsson wrote:
>

>    If dd on the cgd device appears to be working fine, the drive is
> perfectly usable if I use it without a cgd device -- what should I be
> looking at?
> 
>    For completeness, "gpt create cgd3" returns:
> 
>    gpt: unable to open device 'rcgd3d': Invalid argument
> 
>    Pointers are welcome.

I've checked in a bit of code recently that should make the gpts
work on cgd.  Please upgrade to a quite recent kernel to get that
working.

> Index: cgdvar.h
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/cgdvar.h,v
> retrieving revision 1.14
> diff -u -r1.14 cgdvar.h
> --- cgdvar.h	12 Jan 2010 21:08:09 -0000	1.14
> +++ cgdvar.h	31 May 2012 09:27:36 -0000
>  <at>  <at>  -81,6 +81,7  <at>  <at> 
>  	struct cryptdata	 sc_cdata;	/* crypto data */
>  	struct cryptfuncs	*sc_cfuncs;	/* encryption functions */
>  	struct simplelock	 sc_slock;	/* our lock */
> +	unsigned		 sc_secsize;	/* sector size */
>  };
(Continue reading)

Jan Danielsson | 2 Jun 2012 18:28
Picon

Re: kern/46494 (cgd on 4K sector disk)

On 05/31/12 13:23, Roland C. Dowdeswell wrote:
> On Thu, May 31, 2012 at 01:08:44PM +0200, Jan Danielsson wrote:
>>    For completeness, "gpt create cgd3" returns:
>>
>>    gpt: unable to open device 'rcgd3d': Invalid argument
> 
> I've checked in a bit of code recently that should make the gpts
> work on cgd.  Please upgrade to a quite recent kernel to get that
> working.

   Thanks; switching to a -current kernel got GPT's working in the cgd
device. (What are the chances for a pull-up on this for netbsd-6?)

[---]
> We should use sector size from struct dk_softc, not duplicate it here.

   Done.

> There's a reference to DEV_BSIZE in dksubr.c that likely needs to be
> fixed as well.

   Done; but my change feels too simplistic. Is the case of
lp->d_secsize >= pdg->pdg_secsize handled somewhere, for instance?

   These changes still cause "newfs -S /dev/rdk1" to return:
   wtfs: write error for sector 183143623: Invalid argument

   Though I only updated kernel, not user land. Time to start at the
other end and see what newfs is doing.

(Continue reading)


Gmane