summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-08-10 01:32:05 +0000
committernjl <njl@FreeBSD.org>2004-08-10 01:32:05 +0000
commit7e21ce666c82537fdaf6354b41e681ecfd85640c (patch)
tree4efd9d50d1f8e26705c3a156cafb1d73783ff2a3 /sys/kern/kern_shutdown.c
parent726a7fca00cb86d9a23466b7bc446be882f51b06 (diff)
downloadFreeBSD-src-7e21ce666c82537fdaf6354b41e681ecfd85640c.zip
FreeBSD-src-7e21ce666c82537fdaf6354b41e681ecfd85640c.tar.gz
Skip the syncing disks loop if there are no dirty buffers. Remove a
variable used to flag the initial printf. Submitted by: truckman (earlier version)
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r--sys/kern/kern_shutdown.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 323be18..14dd225 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -255,7 +255,6 @@ 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;
@@ -282,7 +281,18 @@ 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);
@@ -305,10 +315,6 @@ boot(int howto)
}
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;
@@ -338,6 +344,7 @@ boot(int howto)
PICKUP_GIANT();
#endif
}
+ printf("\n");
/*
* Count only busy local buffers to prevent forcing
@@ -373,6 +380,7 @@ boot(int howto)
/*
* Unmount filesystems
*/
+unmountall:
if (panicstr == 0)
vfs_unmountall();
}
OpenPOWER on IntegriCloud