diff options
author | bde <bde@FreeBSD.org> | 1997-11-23 11:30:42 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-11-23 11:30:42 +0000 |
commit | 97507ffc6d0af098dbac093291472a6b8b96cb79 (patch) | |
tree | 26f82dfc6fb7cc2c759e64083c438bb0c62bffcb | |
parent | 6c224bdd6e4fe8f6e79f250fa8e78e3f70ec5ed5 (diff) | |
download | FreeBSD-src-97507ffc6d0af098dbac093291472a6b8b96cb79.zip FreeBSD-src-97507ffc6d0af098dbac093291472a6b8b96cb79.tar.gz |
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
-rw-r--r-- | sys/scsi/sd.c | 15 |
1 files changed, 7 insertions, 8 deletions
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 */ |