diff options
author | Doug Rabson <dfr@FreeBSD.org> | 2008-12-17 18:12:01 +0000 |
---|---|---|
committer | Doug Rabson <dfr@FreeBSD.org> | 2008-12-17 18:12:01 +0000 |
commit | 7b3569ff05f4f71164523d543f607ca59612361d (patch) | |
tree | 325a98bccb4e2bf666bc5f802e64fa6255b143c0 /sys/boot | |
parent | 65d1e6158714182e93738ef2fd93a3ef3c2e049c (diff) | |
download | src-7b3569ff05f4f71164523d543f607ca59612361d.tar.gz src-7b3569ff05f4f71164523d543f607ca59612361d.zip |
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
Notes
Notes:
svn path=/head/; revision=186243
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/i386/gptzfsboot/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/i386/zfsboot/Makefile | 2 | ||||
-rw-r--r-- | sys/boot/zfs/zfsimpl.c | 13 |
3 files changed, 6 insertions, 11 deletions
diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile index 930061ff25a6..467d3123aec0 100644 --- a/sys/boot/i386/gptzfsboot/Makefile +++ b/sys/boot/i386/gptzfsboot/Makefile @@ -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 diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile index 41f1672c82ef..1653534a3257 100644 --- a/sys/boot/i386/zfsboot/Makefile +++ b/sys/boot/i386/zfsboot/Makefile @@ -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 diff --git a/sys/boot/zfs/zfsimpl.c b/sys/boot/zfs/zfsimpl.c index a6dc99eea03e..e6695cfaf796 100644 --- a/sys/boot/zfs/zfsimpl.c +++ b/sys/boot/zfs/zfsimpl.c @@ -873,17 +873,12 @@ dnode_read(spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_ 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; |