Attatched is a updated version of the patch with a few ideas from the list
aswell as cam/scsi/scsi_da.c modified aswell. Thanks for all the comments.
--- cam/scsi/scsi_da.c Mon Jan 17 06:27:37 2000
+++ cam/scsi/scsi_da.c.new Tue Mar 27 16:34:57 2001
@@ -580,7 +580,7 @@
long blkcnt;
vm_offset_t addr;
struct ccb_scsiio csio;
- int error;
+ int error, left, state, total, percent;
/* toss any characters present prior to dump */
while (cncheckc() != -1)
@@ -604,6 +604,11 @@
addr = 0; /* starting address */
blkcnt = howmany(PAGE_SIZE, secsize);
+ state = left = 0;
+ total = (num * softc->params.secsize) / (1024 * 1024);
+
+ printf("Dump in progress, percentage complete: ");
+
while (num > 0) {
if (is_physical_memory(addr)) {
@@ -647,9 +652,14 @@
if (wdog_tickler)
(*wdog_tickler)();
#endif /* HW_WDOG */
- /* Count in MB of data left to write */
- printf("%d ", (num * softc->params.secsize)
- / (1024 * 1024));
+ left++;
+ percent = left * 100 / total;
+
+ if (!(percent % 10) && (state - percent))
+ {
+ printf("%d ", percent);
+ state = percent;
+ }
}
/* update block count */
--- dev/ata/ata-disk.c Tue Mar 27 10:31:59 2001
+++ dev/ata/ata-disk.c.new Tue Mar 27 16:35:42 2001
@@ -259,7 +259,7 @@
struct ad_request request;
u_int count, blkno, secsize;
vm_offset_t addr = 0;
- int error;
+ int error, left, state, total, percent;
if ((error = disk_dumpcheck(dev, &count, &blkno, &secsize)))
return error;
@@ -271,8 +271,12 @@
adp->controller->mode[ATA_DEV(adp->unit)] = ATA_PIO;
ata_reinit(adp->controller);
+ state = left = 0;
+ total = (count * DEV_BSIZE) / (1024 * 1024);
+
+ printf("Dump in progress, percentage complete: ");
+
while (count > 0) {
- DELAY(1000);
if (is_physical_memory(addr))
pmap_enter(kernel_pmap, (vm_offset_t)CADDR1,
trunc_page(addr), VM_PROT_READ, TRUE);
@@ -300,9 +304,21 @@
if (wdog_tickler)
(*wdog_tickler)();
#endif
- printf("%ld ", (long)(count * DEV_BSIZE) / (1024 * 1024));
+ /*
+ * Rate limit printf's to replace old DELAY(1000)
+ * This is done so that old slow serial connections
+ * do not get hosed.
+ */
+
+ left++;
+ percent = left * 100 / total;
+
+ if (!(percent % 10) && (state - percent))
+ {
+ printf("%d ", percent);
+ state = percent;
+ }
}
-
blkno += howmany(PAGE_SIZE, secsize);
count -= howmany(PAGE_SIZE, secsize);
addr += PAGE_SIZE;