Date: Sun, 18 Jul 2004 22:43:36 -0700 (PDT) From: Don Lewis <truckman@FreeBSD.org> To: alfred@FreeBSD.org Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_shutdown.c vfs_subr.c Message-ID: <200407190543.i6J5hak6037066@gw.catspoiler.org> In-Reply-To: <20040715054939.GN95729@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 14 Jul, Alfred Perlstein wrote: > * Don Lewis <truckman@FreeBSD.org> [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(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407190543.i6J5hak6037066>