From owner-freebsd-current Sat Jul 7 4:10:57 2001 Delivered-To: freebsd-current@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 977B237B405 for ; Sat, 7 Jul 2001 04:10:48 -0700 (PDT) (envelope-from ben@FreeBSD.org) Received: from strontium.shef.vinosystems.com ([192.168.91.36] ident=root) by scientia.demon.co.uk with esmtp (Exim 3.30 #1) id 15Ipz4-000PkU-00; Sat, 07 Jul 2001 12:10:46 +0100 Received: (from ben@localhost) by strontium.shef.vinosystems.com (8.11.4/8.11.4) id f67BAkk48348; Sat, 7 Jul 2001 12:10:46 +0100 (BST) (envelope-from ben@FreeBSD.org) X-Authentication-Warning: strontium.shef.vinosystems.com: ben set sender to ben@FreeBSD.org using -f Date: Sat, 7 Jul 2001 12:10:45 +0100 From: Ben Smithurst To: Dag-Erling Smorgrav Cc: freebsd-current@FreeBSD.ORG Subject: Re: diskcheckd goes nuts on /dev/cd0 Message-ID: <20010707121045.A289@strontium.shef.vinosystems.com> References: <200107040700.f64705m08269@troutmask.apl.washington.edu> <20010704153625.A97328@strontium.shef.vinosystems.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Dag-Erling Smorgrav wrote: > Ben Smithurst 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 To: Poul-Henning Kamp Cc: Stefan Esser , Dag-Erling Smorgrav Subject: Re: diskcheckd: 2 suggestions Message-ID: <20010623202627.C73817@scientia.demon.co.uk> References: <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