Date: Fri, 13 Feb 2015 18:12:31 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r278687 - stable/10/sys/dev/mmc Message-ID: <201502131812.t1DICVjX010494@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Fri Feb 13 18:12:30 2015 New Revision: 278687 URL: https://svnweb.freebsd.org/changeset/base/278687 Log: MFC r277026: Rate-limit error logging to 5 lines per second. Modified: stable/10/sys/dev/mmc/mmcsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mmc/mmcsd.c ============================================================================== --- stable/10/sys/dev/mmc/mmcsd.c Fri Feb 13 18:10:06 2015 (r278686) +++ stable/10/sys/dev/mmc/mmcsd.c Fri Feb 13 18:12:30 2015 (r278687) @@ -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 } 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502131812.t1DICVjX010494>