Date: Sat, 7 Jul 2001 12:10:45 +0100 From: Ben Smithurst <ben@FreeBSD.org> To: Dag-Erling Smorgrav <des@ofug.org> Cc: freebsd-current@FreeBSD.ORG Subject: Re: diskcheckd goes nuts on /dev/cd0 Message-ID: <20010707121045.A289@strontium.shef.vinosystems.com> In-Reply-To: <xzpzoahron7.fsf@flood.ping.uio.no> References: <200107040700.f64705m08269@troutmask.apl.washington.edu> <20010704153625.A97328@strontium.shef.vinosystems.com> <xzpzoahron7.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
--cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Dag-Erling Smorgrav wrote: > Ben Smithurst <ben@FreeBSD.ORG> writes: >> I was gonna commit a fix for this, but after reporting the problem DES >> never tested the patch I supplied. :-( > > I never got a patch. Oh. Well I'll leave you to figure out why the attached mail, which I sent two weeks ago, didn't get to you then. 2001-06-23 20:26:28 15Dt36-000Kos-00 <= ben@scientia.demon.co.uk H=strontium.shef.vinosystems.com [192.168.91.36] U=root P=esmtp S=4879 id=20010623202627.C73817@scientia.demon.co.uk for des@ofug.org se@FreeBSD.org phk@critter.freebsd.dk 2001-06-23 20:26:35 15Dt36-000Kos-00 => des@ofug.org R=lookuphost T=remote_smtp H=flood.ping.uio.no [129.240.78.31] C="250 VAA79059 Message accepted for delivery" -- Ben Smithurst / ben@FreeBSD.org --cWoXeonUoKmBZSoM Content-Type: message/rfc822 Content-Disposition: inline Date: Sat, 23 Jun 2001 20:26:28 +0100 From: Ben Smithurst <ben@smithurst.org> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: Stefan Esser <se@FreeBSD.org>, Dag-Erling Smorgrav <des@ofug.org> Subject: Re: diskcheckd: 2 suggestions Message-ID: <20010623202627.C73817@scientia.demon.co.uk> References: <xzpk827yluu.fsf@flood.ping.uio.no> <7470.993066613@critter> <20010616115327.A2005@StefanEsser.FreeBSD.org> <86060.992685787@critter> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <86060.992685787@critter> --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline ok, I think I agree with phk that excluding drives should be done in the config file somehow, something like !md !acd !cd ... hack hack hack ... Could you test the attached patch? It allows lines like the above in diskcheckd.conf. Seems to work but ref5 is the only current machine I have access to which is a bit of a pain for testing things. Stefan wrote... >> 2) The defaults make diskcheckd read 4KB per transaction from my >> system disk. I think I'd rather have it reading 64KB/t at a >> rate of 1 per 16 seconds. (Perhaps 32KB is a better size, in >> order to not flush the drives cache, once per second ...) >> >> Reading 16, 32 or 64KB at a time should (except for cache effects) >> cause minimally higher load per transaction than 4KB, and the >> reduced transaction rate should drastically reduce the impact >> on the system. This shouldn't be too hard to implement, I'll see what I can do. -- Ben Smithurst / ben@smithurst.org --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="diskcheckd-exclude.diff" Index: diskcheckd.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/diskcheckd/diskcheckd.c,v retrieving revision 1.1 diff -u -r1.1 diskcheckd.c --- diskcheckd.c 2001/06/03 20:02:03 1.1 +++ diskcheckd.c 2001/06/23 19:18:37 @@ -62,7 +62,7 @@ volatile sig_atomic_t got_sighup = 0, got_sigterm = 0; -char **getdisknames(void); +char **getdisknames(char **, int); off_t dseek(struct disk *, off_t, int); struct disk *readconf(const char *); void getdisksize(struct disk *); @@ -464,6 +464,8 @@ double dval; long lval; int linenum; + char **skip; + int numskip; if ((fp = fopen(conf_file, "r")) == NULL) { syslog(LOG_NOTICE, "open %s failure: %m", conf_file); @@ -482,6 +484,37 @@ line++; if (*line == '#' || *line == '\n' || *line == '\0') continue; + + /* First, if the line starts with '!', this is a disk name + * to ignore. For example, '!md' will skip all '/dev/md*' + * devices. + */ + if (*line == '!') { + line++; + while (isspace(*line)) + line++; + field = strsep(&line, " \t\n"); + if (field == NULL || *field == '\0') { + syslog(LOG_NOTICE, "%s:%d: missing disk name", + conf_file, linenum); + continue; + } + + numskip++; + if ((skip = reallocf(skip, + numskip * sizeof (*skip))) == NULL) { + syslog(LOG_NOTICE, "reallocf failure: %m"); + exit(EXIT_FAILURE); + } + + if ((skip[numskip-1] = strdup(field)) == NULL) { + syslog(LOG_NOTICE, "strdup failure: %m"); + exit(EXIT_FAILURE); + } + + continue; + } + fields = flags = 0; while ((field = strsep(&line, " \t\n")) != NULL) { if (*field == '\0') @@ -602,7 +635,7 @@ onumdisks = numdisks; for (dp = disks; dp < disks + onumdisks; dp++) { if (strcmp(dp->device, "*") == 0) { - for (np = np0 = getdisknames(); *np != NULL; np++) { + for (np = np0 = getdisknames(skip, numskip); *np != NULL; np++) { odisks = disks; if ((disks = reallocf(disks, (numdisks + 1) * sizeof (*disks))) == NULL) { @@ -746,10 +779,11 @@ * is returned. */ char ** -getdisknames(void) { +getdisknames(char **skip, int numskip) { char *string, *field; size_t size, numdisks; char **disks; + int i; if (sysctlbyname("kern.disks", NULL, &size, NULL, 0) != 0 && errno != ENOMEM) { @@ -768,6 +802,13 @@ disks = NULL; numdisks = 0; while ((field = strsep(&string, " ")) != NULL) { + /* check for disks we ignore */ + for (i = 0; i < numskip; i++) + if (strncmp(field, skip[i], strlen(skip[i])) == 0) + break; + if (i < numskip) + continue; + if ((disks = reallocf(disks, (numdisks + 1) * sizeof (*disks))) == NULL) { syslog(LOG_NOTICE, "reallocf failure: %m"); --Q68bSM7Ycu6FN28Q-- --cWoXeonUoKmBZSoM-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010707121045.A289>