From owner-cvs-all@FreeBSD.ORG Mon Jul 19 05:43:46 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C9F7F16A4CE; Mon, 19 Jul 2004 05:43:46 +0000 (GMT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5366243D53; Mon, 19 Jul 2004 05:43:46 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.11/8.12.11) with ESMTP id i6J5hak6037066; Sun, 18 Jul 2004 22:43:40 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200407190543.i6J5hak6037066@gw.catspoiler.org> Date: Sun, 18 Jul 2004 22:43:36 -0700 (PDT) From: Don Lewis To: alfred@FreeBSD.org In-Reply-To: <20040715054939.GN95729@elvis.mu.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_shutdown.c vfs_subr.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2004 05:43:47 -0000 On 14 Jul, Alfred Perlstein wrote: > * Don Lewis [040714 22:46] wrote: >> I'd prefer skipping the the final sync() in boot() if there are no dirty >> buffers, with a message something like "skipping final sync because no >> dirty buffers remain". > > Diffs welcome! Note: I revived the printf("\n") mostly so that the SHOW_BUSYBUFS output would be formatted correctly. Index: sys/kern/kern_shutdown.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_shutdown.c,v retrieving revision 1.157 diff -u -r1.157 kern_shutdown.c --- sys/kern/kern_shutdown.c 15 Jul 2004 08:01:00 -0000 1.157 +++ sys/kern/kern_shutdown.c 19 Jul 2004 05:18:15 -0000 @@ -245,7 +245,6 @@ static void boot(int howto) { - static int first_buf_printf = 1; /* collect extra flags that shutdown_nice might have set */ howto |= shutdown_howto; @@ -272,7 +271,18 @@ int subiter; #endif + for (nbusy = 0, bp = &buf[nbuf]; --bp >= buf; ) + if (((bp->b_flags & B_INVAL) == 0 && + BUF_REFCNT(bp) > 0) || + ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) + nbusy++; + if (nbusy == 0) { + printf("Skipping final sync, no buffers remaining.\n"); + goto unmountall; + } + waittime = 0; + printf("Syncing disks, buffers remaining... "); sync(&thread0, NULL); @@ -295,10 +305,6 @@ } if (nbusy == 0) break; - if (first_buf_printf) { - printf("syncing disks, buffers remaining... "); - first_buf_printf = 0; - } printf("%d ", nbusy); if (nbusy < pbusy) iter = 0; @@ -328,7 +334,7 @@ PICKUP_GIANT(); #endif } - + printf("\n"); /* * Count only busy local buffers to prevent forcing * a fsck if we're just a client of a wedged NFS server @@ -357,13 +363,14 @@ * Failed to sync all blocks. Indicate this and don't * unmount filesystems (thus forcing an fsck on reboot). */ - printf("giving up on %d buffers\n", nbusy); + printf("Giving up on %d buffers.\n", nbusy); DELAY(5000000); /* 5 seconds */ } else { - printf("done\n"); + printf("Final sync complete.\n"); /* * Unmount filesystems */ +unmountall: if (panicstr == 0) vfs_unmountall(); }