diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-07-20 19:57:05 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2003-07-20 19:57:05 +0000 |
commit | cbe77f58e958ec919aaeb0ca03c5ec5ca29c6e0d (patch) | |
tree | c24ca1e88cb28649cba7f1fd9e7943ae43e91baf /sys/dev/ata/wd.c | |
parent | 5b07ddb2000d2e9c17d4a218dd0fa22034a5df8b (diff) |
Use LBA48 only when accessing blocks after 137Gb limit or using sectors
count more than 255 to reduce registers writting overhead. Gives me
about 5% perfomance increase in a dumb synthetic test.
Some input and ok from costa@ a long time ago.
Diffstat (limited to 'sys/dev/ata/wd.c')
-rw-r--r-- | sys/dev/ata/wd.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 374580d65ce..ea4ab4b1123 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.31 2003/06/25 20:52:57 tedu Exp $ */ +/* $OpenBSD: wd.c,v 1.32 2003/07/20 19:57:04 grange Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -564,6 +564,8 @@ __wdstart(wd, bp) struct buf *bp; { daddr_t p_offset; + daddr_t nblks; + if (WDPART(bp->b_dev) != RAW_PART) p_offset = wd->sc_dk.dk_label->d_partitions[WDPART(bp->b_dev)].p_offset; @@ -582,7 +584,10 @@ __wdstart(wd, bp) wd->sc_wdc_bio.flags = ATA_SINGLE; else wd->sc_wdc_bio.flags = 0; - if (wd->sc_flags & WDF_LBA48) + nblks = bp->b_bcount / wd->sc_dk.dk_label->d_secsize; + if ((wd->sc_flags & WDF_LBA48) && + /* use LBA48 only if really need */ + ((wd->sc_wdc_bio.blkno + nblks - 1 > 0xfffffff) || (nblks > 0xff))) wd->sc_wdc_bio.flags |= ATA_LBA48; if (wd->sc_flags & WDF_LBA) wd->sc_wdc_bio.flags |= ATA_LBA; |