From 97507ffc6d0af098dbac093291472a6b8b96cb79 Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 23 Nov 1997 11:30:42 +0000 Subject: Fixed the sector size frobbing in sd_strategy() at least not to break for the usual sector size. dscheck() adjusts b_bcount to handle EOF, so we must scale it and not preserve it. i/o beyond the end of partitions has been broken since rev.1.96. Not fixed in: od driver --- sys/scsi/sd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'sys/scsi') diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index bdeb5cc..6252275 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -15,7 +15,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.112 1997/10/12 08:54:47 joerg Exp $ + * $Id: sd.c,v 1.113 1997/11/07 08:53:32 phk Exp $ */ #include "opt_bounce.h" @@ -457,22 +457,21 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link) { int status; int sec_blk_ratio = secsize/DEV_BSIZE; - /* save original block number and size */ int b_blkno = bp->b_blkno; - int b_bcount = bp->b_bcount; - /* replace with scaled values */ + /* Replace blkno and count with scaled values. */ bp->b_blkno /= sec_blk_ratio; bp->b_bcount /= sec_blk_ratio; /* enforce limits and map to physical block number */ status = dscheck(bp, sd->dk_slices); - /* prevent bad side effects in block system */ + /* + * Restore blkno and unscale the values set by dscheck(), + * except for b_pblkno. + */ bp->b_blkno = b_blkno; - bp->b_bcount = b_bcount; - - /* scale resid */ + bp->b_bcount *= sec_blk_ratio; bp->b_resid *= sec_blk_ratio; /* see if the mapping failed */ -- cgit v1.1