diff options
author | bde <bde@FreeBSD.org> | 1998-07-29 11:15:54 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-07-29 11:15:54 +0000 |
commit | 57a5f9023d7ba6eb9c0fe02789312a0d6ae4e363 (patch) | |
tree | 4afbc549527fb0b6e26795be8cee174ce0d65c5a /sys/scsi/od.c | |
parent | 4a3c46b3596a248587fc4fd2fdfe53f2443eded9 (diff) | |
download | FreeBSD-src-57a5f9023d7ba6eb9c0fe02789312a0d6ae4e363.zip FreeBSD-src-57a5f9023d7ba6eb9c0fe02789312a0d6ae4e363.tar.gz |
Centralized and optimized handling of large sectors. Centralized
checking of transfer sizes and alignments.
Old version tested with 2K-sectors on od disks by: Shunsuke Akiyama
<akiyama@kme.mei.co.jp>.
Diffstat (limited to 'sys/scsi/od.c')
-rw-r--r-- | sys/scsi/od.c | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/sys/scsi/od.c b/sys/scsi/od.c index 1dc817e..4769406 100644 --- a/sys/scsi/od.c +++ b/sys/scsi/od.c @@ -28,7 +28,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Id: od.c,v 1.42 1998/07/13 09:53:11 bde Exp $ + * $Id: od.c,v 1.43 1998/07/28 18:59:49 bde Exp $ */ /* @@ -456,7 +456,6 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link) u_int32_t opri; struct scsi_data *od; u_int32_t unit; - int secsize; odstrats++; unit = ODUNIT((bp->b_dev)); @@ -471,62 +470,10 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link) } /* - * Odd number of bytes or negative offset - */ - if (bp->b_blkno < 0 ) { - bp->b_error = EINVAL; - printf("od_strategy: Negative block number: 0x%x\n", bp->b_blkno); - goto bad; - } - - - secsize = od->params.secsiz; - - /* make sure the blkno is scalable */ - if( (bp->b_blkno % (secsize/DEV_BSIZE)) != 0 ) { - bp->b_error = EINVAL; - printf("od_strategy: Block number is not multiple of sector size (2): 0x%x\n", bp->b_blkno); - goto bad; - } - - /* make sure that the transfer size is a multiple of the sector size */ - if( (bp->b_bcount % secsize) != 0 ) { - bp->b_error = EINVAL; - printf( - "od_strategy: Invalid b_bcount %ld at block number: 0x%lx\n", - bp->b_bcount, (long)bp->b_blkno); - goto bad; - } - - /* * Do bounds checking, adjust transfer, and set b_pblkno. */ - { - 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 */ - bp->b_blkno /= sec_blk_ratio; - bp->b_bcount /= sec_blk_ratio; - - /* have dscheck enforce limits and map to physical block number */ - status = dscheck(bp, od->dk_slices); - - /* restore original values to prevent bad side effects in block system */ - bp->b_blkno = b_blkno; - bp->b_bcount = b_bcount; - /* scale resid */ - bp->b_resid *= sec_blk_ratio; - - /* see if the mapping failed */ - if (status <= 0) - { + if (dscheck(bp, od->dk_slices) <= 0) goto done; /* XXX check b_resid */ - } - } opri = SPLOD(); |