diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-09-27 12:12:17 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-09-27 12:12:17 +0000 |
commit | 74ef2b3126be8f10b5aa263838dda9d22a357ab0 (patch) | |
tree | 2e50be6b5bd9188671c544b017e9334dbfcdae5a | |
parent | 80dfa590def1fad41b553042d10bea9828355f8b (diff) |
Try harder to ensure wddump() doesn't decrement the count
of sectors to write by one value and increment the address
the next i/o will start at by a different amount.
-rw-r--r-- | sys/dev/ata/wd.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 8a9fc58a8bb..b98e21a49c0 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.111 2013/09/15 13:44:53 krw Exp $ */ +/* $OpenBSD: wd.c,v 1.112 2013/09/27 12:12:16 krw Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -920,6 +920,7 @@ wddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size) struct disklabel *lp; /* disk's disklabel */ int unit, part; int nblks; /* total number of sectors left to write */ + int nwrt; /* sectors to write with current i/o. */ int err; char errbuf[256]; @@ -961,14 +962,14 @@ wddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size) } while (nblks > 0) { + nwrt = min(nblks, wddumpmulti); wd->sc_wdc_bio.blkno = blkno; wd->sc_wdc_bio.flags = ATA_POLL; if (wd->sc_flags & WDF_LBA48) wd->sc_wdc_bio.flags |= ATA_LBA48; if (wd->sc_flags & WDF_LBA) wd->sc_wdc_bio.flags |= ATA_LBA; - wd->sc_wdc_bio.bcount = - min(nblks, wddumpmulti) * lp->d_secsize; + wd->sc_wdc_bio.bcount = nwrt * lp->d_secsize; wd->sc_wdc_bio.databuf = va; wd->sc_wdc_bio.wd = wd; #ifndef WD_DUMP_NOT_TRUSTED @@ -1020,9 +1021,9 @@ wddump(dev_t dev, daddr_t blkno, caddr_t va, size_t size) #endif /* update block count */ - nblks -= min(nblks, wddumpmulti); - blkno += min(nblks, wddumpmulti); - va += min(nblks, wddumpmulti) * lp->d_secsize; + nblks -= nwrt; + blkno += nwrt; + va += nwrt * lp->d_secsize; } wddoingadump = 0; |