kernel - rate-limit the '%s: FAILURE - oversized DMA transfer' console msg
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 9 Dec 2013 22:50:47 +0000 (14:50 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 9 Dec 2013 22:51:23 +0000 (14:51 -0800)
* Rate-limit an ATA console message which can wind up being printed a lot
  under certain circumstances.

sys/dev/disk/nata/ata-dma.c

index 796eec1..1e1fe65 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/endian.h>
 #include <sys/malloc.h>
 #include <sys/nata.h>
+#include <sys/resourcevar.h>
 
 #include <machine/bus_dma.h>
 
@@ -219,6 +220,7 @@ ata_dmaload(device_t dev, caddr_t data, int32_t count, int dir,
 {
     struct ata_channel *ch = device_get_softc(dev);
     struct ata_dmasetprd_args cba;
+    static struct krate krate_nata_ovdma = { .freq = 1 };
     int error;
 
     if (ch->dma->flags & ATA_DMA_LOADED) {
@@ -236,8 +238,10 @@ ata_dmaload(device_t dev, caddr_t data, int32_t count, int dir,
        return EIO;
     }
     if (count > ch->dma->max_iosize) {
-       device_printf(dev, "FAILURE - oversized DMA transfer attempt %d > %d\n",
-                     count, ch->dma->max_iosize);
+       krateprintf(&krate_nata_ovdma,
+                   "%s: FAILURE - oversized DMA transfer "
+                   "attempt %d > %d\n",
+                   device_get_nameunit(dev), count, ch->dma->max_iosize);
        return EIO;
     }