From 77f7b5a60ee42eb99151780ad4a4796a9d02b80a Mon Sep 17 00:00:00 2001 From: tegge Date: Wed, 22 Oct 2003 18:57:59 +0000 Subject: [PATCH] Initialize bp->b_offset to the physical offset in partition so GEOM knows where to read from disk. --- sys/ufs/ffs/ffs_rawread.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/ufs/ffs/ffs_rawread.c b/sys/ufs/ffs/ffs_rawread.c index 66449a73b06e..b6fc927383f6 100644 --- a/sys/ufs/ffs/ffs_rawread.c +++ b/sys/ufs/ffs/ffs_rawread.c @@ -214,9 +214,8 @@ ffs_rawread_readahead(struct vnode *vp, bp->b_iodone = ffs_rawreadwakeup; bp->b_data = udata; bp->b_saveaddr = sa; - bp->b_offset = offset; - blockno = bp->b_offset / bsize; - blockoff = (bp->b_offset % bsize) / DEV_BSIZE; + blockno = offset / bsize; + blockoff = (offset % bsize) / DEV_BSIZE; if ((daddr_t) blockno != blockno) { return EINVAL; /* blockno overflow */ } @@ -226,8 +225,7 @@ ffs_rawread_readahead(struct vnode *vp, error = ufs_bmaparray(vp, bp->b_lblkno, &blkno, NULL, &bforwards, NULL); if (error != 0) return error; - bp->b_blkno = blkno; - if (bp->b_blkno == -1) { + if (blkno == -1) { /* Fill holes with NULs to preserve semantics */ @@ -248,11 +246,12 @@ ffs_rawread_readahead(struct vnode *vp, bp->b_flags |= B_DONE; return 0; } + bp->b_blkno = blkno + blockoff; + bp->b_offset = bp->b_iooffset = (blkno + blockoff) * DEV_BSIZE; if (bp->b_bcount + blockoff * DEV_BSIZE > bsize * (1 + bforwards)) bp->b_bcount = bsize * (1 + bforwards) - blockoff * DEV_BSIZE; bp->b_bufsize = bp->b_bcount; - bp->b_blkno += blockoff; bp->b_dev = dp->v_rdev; if (vmapbuf(bp) < 0)