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)
This commit is contained in:
Nate Lawson 2004-08-10 01:32:05 +00:00
parent b25877a384
commit c8c216d558
2 changed files with 14 additions and 6 deletions

View File

@ -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();
}

View File

@ -1578,7 +1578,7 @@ sched_sync(void)
if (syncer_state != SYNCER_RUNNING &&
starttime != time_second) {
if (first_printf) {
printf("\nSyncer syncing, vnodes remaining...");
printf("\nSyncing disks, vnodes remaining...");
first_printf = 0;
}
printf("%d ", net_worklist_len);