diff options
author | ian <ian@FreeBSD.org> | 2015-02-13 18:12:30 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-02-13 18:12:30 +0000 |
commit | 432a94e7fe2210a25e852f288f8dfd3c9bcb26b4 (patch) | |
tree | 524cfda031108a999f5c9a18db0331881c7bd590 /sys/dev/mmc/mmcsd.c | |
parent | 7a36a698cbc146943550848ba83f58e8a3b3ef31 (diff) | |
download | FreeBSD-src-432a94e7fe2210a25e852f288f8dfd3c9bcb26b4.zip FreeBSD-src-432a94e7fe2210a25e852f288f8dfd3c9bcb26b4.tar.gz |
MFC r277026: Rate-limit error logging to 5 lines per second.
Diffstat (limited to 'sys/dev/mmc/mmcsd.c')
-rw-r--r-- | sys/dev/mmc/mmcsd.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 5b2bc2c..72094ed 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/module.h> #include <sys/mutex.h> +#include <sys/time.h> #include <geom/geom_disk.h> #include <dev/mmc/mmcbrvar.h> @@ -86,6 +87,8 @@ struct mmcsd_softc { daddr_t eblock, eend; /* Range remaining after the last erase. */ int running; int suspend; + int log_count; + struct timeval log_time; }; static const char *errmsg[] = @@ -99,6 +102,8 @@ static const char *errmsg[] = "NO MEMORY" }; +#define LOG_PPS 5 /* Log no more than 5 errors per second. */ + /* bus entry points */ static int mmcsd_attach(device_t dev); static int mmcsd_detach(device_t dev); @@ -367,8 +372,10 @@ mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp) } MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - device_printf(dev, "Error indicated: %d %s\n", - req.cmd->error, mmcsd_errmsg(req.cmd->error)); + if (ppsratecheck(&sc->log_time, &sc->log_count, LOG_PPS)) { + device_printf(dev, "Error indicated: %d %s\n", + req.cmd->error, mmcsd_errmsg(req.cmd->error)); + } break; } block += numblocks; |