9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] i/o error reading large sata disk
Date: Sat,  5 Apr 2008 23:58:23 -0400	[thread overview]
Message-ID: <ee54f08125cd185f588cbaaa2c09804d@quanstro.net> (raw)
In-Reply-To: <140e7ec30804051950i4efa218fw80de2db93e1cf99b@mail.gmail.com>

> term% cat /dev/sdE0/ctl
> inquiry ST3300831AS
> config 0C5A capabilities 2F00 dma 00550020 dmactl 00000000 rwm 16
> rwmctl 0 lba48always off
> geometry 586072368 512 16383 16 63
> part data 0 586072368
> part plan9 63 293025600
> part plan9.1 293041665 586067265
> term% dd -if /dev/sdE0/plan9 -of /dev/sdE0/plan9.1 -bs 8192 -iseek 16777211
> read: i/o error

i think i see the problem.  we're off by one bit.

in your case, i calculate h = 0xf.  but since the head shares bits
with the device, there just isn't enough room for a head > 7.  i think you
can fix this problem by

(a) setting lba48always on
	; echo llba48always on>/dev/sd??/ctl
if this doesn't work, then i'm wrong.

(b) (the proper fix). apply this change to sdata

/n/sources/plan9//sys/src/9/pc/sdata.c:1344,1350 - sdata.c:1344,1350
  };

  static int
- atageniostart(Drive* drive, vlong lba)
+ atageniostart(Drive* drive, uvlong lba)
  {
  	Ctlr *ctlr;
  	uchar cmd;
/n/sources/plan9//sys/src/9/pc/sdata.c:1351,1357 - sdata.c:1351,1357
  	int as, c, cmdport, ctlport, h, len, s, use48;

  	use48 = 0;
- 	if((drive->flags&Lba48always) || (lba>>28) || drive->count > 256){
+ 	if((drive->flags&Lba48always) || (lba>>27) || drive->count > 256){
  		if(!(drive->flags & Lba48))
  			return -1;
  		use48 = 1;
/n/sources/plan9//sys/src/9/pc/sdata.c:1359,1365 - sdata.c:1359,1365
  	}
  	else if(drive->dev & Lba){
  		c = (lba>>8) & 0xFFFF;
- 		h = (lba>>24) & 0x0F;
+ 		h = (lba>>24) & 7;	/* tautology */
  		s = lba & 0xFF;
  	}

there's also a problem with disk > 2GB.  but that's not your problem.

- erik



  reply	other threads:[~2008-04-06  3:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-06  2:50 sqweek
2008-04-06  3:58 ` erik quanstrom [this message]
2008-04-06 16:19   ` sqweek
     [not found]     ` <b0541197023336a814de597a7abcaa66@quanstro.net>
2008-04-14  4:51       ` sqweek
2008-04-22 13:56   ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee54f08125cd185f588cbaaa2c09804d@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).