From owner-freebsd-fs@FreeBSD.ORG Thu Nov 19 17:02:39 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AEB91065695; Thu, 19 Nov 2009 17:02:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D94808FC29; Thu, 19 Nov 2009 17:02:38 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7709B46B2C; Thu, 19 Nov 2009 12:02:38 -0500 (EST) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id BA4928A020; Thu, 19 Nov 2009 12:02:37 -0500 (EST) From: John Baldwin To: freebsd-fs@freebsd.org Date: Thu, 19 Nov 2009 11:55:10 -0500 User-Agent: KMail/1.9.7 References: <1258647835.2303.105.camel@balrog.2hip.net> In-Reply-To: <1258647835.2303.105.camel@balrog.2hip.net> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_uhXBLdyw4w+BTUK" Message-Id: <200911191155.10490.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 19 Nov 2009 12:02:37 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-current@freebsd.org, Emil Smolenski , Robert Noland Subject: Re: Boot with ZFS on single disk: "ZFS: i/o error - all block copies unavailable" [was: Re: GPT boot with ZFS RAIDZ "ZFS: i/o error - all block copies unavailable"] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2009 17:02:39 -0000 --Boundary-00=_uhXBLdyw4w+BTUK Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 19 November 2009 11:23:55 am Robert Noland wrote: > On Thu, 2009-11-19 at 11:21 +0100, Emil Smolenski wrote: > > Matt Reimer wrote: > > > Robert's on to something. It looks like your LBAs are probably > > > overflowing 32 bits. This would affect all vdev regardless of type. > > > Try the attached patch. > > > > Robert Noland wrote: > > >> 220000de400 > > > This divided by 512 byte block size is 33 bits... At a glance, the patch > > > looks ok to me. I'll do a more thorough review of this tomorrow. > > > > Unfortunately it don't work. Error is the same as before: > > Ok, I was concerned about the assembly code... So, I've been chatting > with jhb@ this morning. Please try this patch that jhb@ came up with > instead of Matt's latest patch. Actually, I had missed updating one place, please use this instead. Also, I think that this will fix using > 2TB volumes even in the GPT case as zfsboot.c was always using 32-bit LBAs even for the GPT case. -- John Baldwin --Boundary-00=_uhXBLdyw4w+BTUK Content-Type: text/x-diff; charset="iso-8859-1"; name="zfsboot_64.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="zfsboot_64.patch" --- //depot/user/jhb/boot/sys/boot/i386/zfsboot/zfsboot.c +++ /home/jhb/work/p4/boot/sys/boot/i386/zfsboot/zfsboot.c @@ -138,8 +138,8 @@ unsigned unit; unsigned slice; unsigned part; - unsigned start; int init; + daddr_t start; }; static char cmd[512]; static char kname[1024]; @@ -163,7 +163,7 @@ static void printf(const char *,...); static void putchar(int); static uint32_t memsize(void); -static int drvread(struct dsk *, void *, unsigned, unsigned); +static int drvread(struct dsk *, void *, daddr_t, unsigned); static int keyhit(unsigned); static int xputc(int); static int xgetc(int); @@ -310,7 +310,8 @@ vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) { char *p; - unsigned int lba, nb; + daddr_t lba; + unsigned int nb; struct dsk *dsk = (struct dsk *) priv; if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1))) @@ -964,7 +965,7 @@ #endif static int -drvread(struct dsk *dsk, void *buf, unsigned lba, unsigned nblk) +drvread(struct dsk *dsk, void *buf, daddr_t lba, unsigned nblk) { #ifdef GPT static unsigned c = 0x2d5c7c2f; @@ -999,7 +1000,7 @@ v86.es = VTOPSEG(buf); v86.eax = lba; v86.ebx = VTOPOFF(buf); - v86.ecx = lba >> 16; + v86.ecx = lba >> 32; v86.edx = nblk << 8 | dsk->drive; v86int(); v86.ctl = V86_FLAGS; --- //depot/vendor/freebsd/src/sys/boot/i386/zfsboot/zfsldr.S 2008/11/17 20:55:47 +++ //depot/user/jhb/boot/sys/boot/i386/zfsboot/zfsldr.S 2009/11/19 16:53:18 @@ -83,7 +83,7 @@ * Trampoline used by boot2 to call read to read data from the disk via * the BIOS. Call with: * - * %cx:%ax - long - LBA to read in + * %ecx:%eax - long - LBA to read in * %es:(%bx) - caddr_t - buffer to read data into * %dl - byte - drive to read from * %dh - byte - num sectors to read @@ -94,10 +94,8 @@ /* * Setup an EDD disk packet and pass it to read */ -xread.1: # Starting - pushl $0x0 # absolute - push %cx # block - push %ax # number +xread.1: pushl %ecx # Starting absolute block + pushl %eax # block number push %es # Address of push %bx # transfer buffer xor %ax,%ax # Number of @@ -195,7 +193,7 @@ */ main.5: mov %dx,MEM_ARG # Save args movb $NSECT,%dh # Sector count - movw $1024,%ax # Offset to boot2 + movl $1024,%eax # Offset to boot2 callw nread.1 # Read disk main.6: mov $MEM_BUF,%si # BTX (before reloc) mov 0xa(%si),%bx # Get BTX length and set @@ -245,10 +243,11 @@ /* * Trampoline used to call read from within boot1. */ -nread: xor %ax,%ax # Sector offset in partition +nread: xor %eax,%eax # Sector offset in partition nread.1: mov $MEM_BUF,%bx # Transfer buffer - add 0x8(%si),%ax # Get - mov 0xa(%si),%cx # LBA + xor %ecx,%ecx # Get + addl 0x8(%si),%eax # LBA + adc $0,%ecx push %cs # Read from callw xread.1 # disk jnc return # If success, return --Boundary-00=_uhXBLdyw4w+BTUK--