svn commit: r186243 - in head/sys/boot: i386/gptzfsboot i386/zfsboot zfs

Doug Rabson dfr at FreeBSD.org
Wed Dec 17 18:12:02 UTC 2008


Author: dfr
Date: Wed Dec 17 18:12:01 2008
New Revision: 186243
URL: http://svn.freebsd.org/changeset/base/186243

Log:
  Use full 64bit arithmetic when converting file offsets to block numbers - fixes
  booting on filesystems with inode numbers with values above 4194304.
  
  Submitted by:	ps

Modified:
  head/sys/boot/i386/gptzfsboot/Makefile
  head/sys/boot/i386/zfsboot/Makefile
  head/sys/boot/zfs/zfsimpl.c

Modified: head/sys/boot/i386/gptzfsboot/Makefile
==============================================================================
--- head/sys/boot/i386/gptzfsboot/Makefile	Wed Dec 17 18:05:30 2008	(r186242)
+++ head/sys/boot/i386/gptzfsboot/Makefile	Wed Dec 17 18:12:01 2008	(r186243)
@@ -60,7 +60,7 @@ gptzfsboot.bin: gptzfsboot.out
 	objcopy -S -O binary gptzfsboot.out ${.TARGET}
 
 gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o
-	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
+	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
 
 zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c
 

Modified: head/sys/boot/i386/zfsboot/Makefile
==============================================================================
--- head/sys/boot/i386/zfsboot/Makefile	Wed Dec 17 18:05:30 2008	(r186242)
+++ head/sys/boot/i386/zfsboot/Makefile	Wed Dec 17 18:12:01 2008	(r186243)
@@ -80,7 +80,7 @@ zfsboot.bin: zfsboot.out
 	objcopy -S -O binary zfsboot.out ${.TARGET}
 
 zfsboot.out: ${BTXCRT} zfsboot.o sio.o
-	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC}
+	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
 
 zfsboot.o: zfsboot.s
 

Modified: head/sys/boot/zfs/zfsimpl.c
==============================================================================
--- head/sys/boot/zfs/zfsimpl.c	Wed Dec 17 18:05:30 2008	(r186242)
+++ head/sys/boot/zfs/zfsimpl.c	Wed Dec 17 18:12:01 2008	(r186243)
@@ -873,17 +873,12 @@ dnode_read(spa_t *spa, const dnode_phys_
 	int i, rc;
 
 	/*
-	 * We truncate the offset to 32bits, mainly so that I don't
-	 * have to find a copy of __divdi3 to put into the bootstrap.
-	 * I don't think the bootstrap needs to access anything bigger
-	 * than 2G anyway. Note that block addresses are still 64bit
-	 * so it doesn't affect the possible size of the media.
-	 * We still use 64bit block numbers so that the bitshifts
-	 * work correctly. Note: bsize may not be a power of two here.
+	 * Note: bsize may not be a power of two here so we need to do an
+	 * actual divide rather than a bitshift.
 	 */
 	while (buflen > 0) {
-		uint64_t bn = ((int) offset) / bsize;
-		int boff = ((int) offset) % bsize;
+		uint64_t bn = offset / bsize;
+		int boff = offset % bsize;
 		int ibn;
 		const blkptr_t *indbp;
 		blkptr_t bp;


More information about the svn-src-all mailing list