summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2004-08-15 19:17:23 +0000
committertruckman <truckman@FreeBSD.org>2004-08-15 19:17:23 +0000
commit5facb5bcc2c517d319f947330032b4a291455c85 (patch)
tree9a203fa59b6a41fabf1d3ecf872015fdffade56d
parent9e69bea9f10d447d337c54d6f5378346f998434f (diff)
downloadFreeBSD-src-5facb5bcc2c517d319f947330032b4a291455c85.zip
FreeBSD-src-5facb5bcc2c517d319f947330032b4a291455c85.tar.gz
Yet another tweak to the shutdown messages in boot():
Don't count busy buffers before the initial call to sync() and don't skip the initial sync() if no busy buffers were called. Always call sync() at least once if syncing is requested. This defers the "Syncing disks, buffers remaining..." message until after the initial sync() call and the first count of busy buffers. This backs out changes in kern_shutdown 1.162. Print a different message when there are no busy buffers after the initial sync(), which is now the expected situation. Print an additional message when syncing has completed successfully in the unusual situation where the work of syncing was done by boot(). Uppercase one message to make it consistent with all of the other kernel shutdown messages. Discussed with: bde (in a much earlier form, prior to 1.162) Reviewed by: njl (in an earlier form)
-rw-r--r--sys/kern/kern_shutdown.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 14dd225..62f3de3 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -255,6 +255,7 @@ doadump(void)
static void
boot(int howto)
{
+ static int first_buf_printf = 1;
/* collect extra flags that shutdown_nice might have set */
howto |= shutdown_howto;
@@ -281,18 +282,7 @@ boot(int howto)
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);
@@ -313,8 +303,15 @@ boot(int howto)
nbusy++;
}
}
- if (nbusy == 0)
+ if (nbusy == 0) {
+ if (first_buf_printf)
+ printf("No buffers busy after final sync");
break;
+ }
+ if (first_buf_printf) {
+ printf("Syncing disks, buffers remaining... ");
+ first_buf_printf = 0;
+ }
printf("%d ", nbusy);
if (nbusy < pbusy)
iter = 0;
@@ -345,7 +342,6 @@ boot(int howto)
#endif
}
printf("\n");
-
/*
* Count only busy local buffers to prevent forcing
* a fsck if we're just a client of a wedged NFS server
@@ -374,13 +370,14 @@ boot(int howto)
* 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 {
+ if (!first_buf_printf)
+ printf("Final sync complete\n");
/*
* Unmount filesystems
*/
-unmountall:
if (panicstr == 0)
vfs_unmountall();
}
OpenPOWER on IntegriCloud