kern_shutdown.c (131473) | kern_shutdown.c (131481) |
---|---|
1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1986, 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 21 unchanged lines hidden (view full) --- 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 131473 2004-07-02 19:09:50Z jhb $"); | 38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 131481 2004-07-02 20:21:44Z jhb $"); |
39 40#include "opt_ddb.h" 41#include "opt_ddb_trace.h" 42#include "opt_ddb_unattended.h" 43#include "opt_hw_wdog.h" 44#include "opt_mac.h" 45#include "opt_panic.h" 46#include "opt_show_busybufs.h" --- 217 unchanged lines hidden (view full) --- 264 EVENTHANDLER_INVOKE(shutdown_pre_sync, howto); 265 266 /* 267 * Now sync filesystems 268 */ 269 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { 270 register struct buf *bp; 271 int iter, nbusy, pbusy; | 39 40#include "opt_ddb.h" 41#include "opt_ddb_trace.h" 42#include "opt_ddb_unattended.h" 43#include "opt_hw_wdog.h" 44#include "opt_mac.h" 45#include "opt_panic.h" 46#include "opt_show_busybufs.h" --- 217 unchanged lines hidden (view full) --- 264 EVENTHANDLER_INVOKE(shutdown_pre_sync, howto); 265 266 /* 267 * Now sync filesystems 268 */ 269 if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { 270 register struct buf *bp; 271 int iter, nbusy, pbusy; |
272#ifndef PREEMPTION |
|
272 int subiter; | 273 int subiter; |
274#endif |
|
273 274 waittime = 0; 275 printf("\nsyncing disks, buffers remaining... "); 276 277 sync(&thread0, NULL); 278 279 /* 280 * With soft updates, some buffers that are --- 14 unchanged lines hidden (view full) --- 295 } 296 if (nbusy == 0) 297 break; 298 printf("%d ", nbusy); 299 if (nbusy < pbusy) 300 iter = 0; 301 pbusy = nbusy; 302 sync(&thread0, NULL); | 275 276 waittime = 0; 277 printf("\nsyncing disks, buffers remaining... "); 278 279 sync(&thread0, NULL); 280 281 /* 282 * With soft updates, some buffers that are --- 14 unchanged lines hidden (view full) --- 297 } 298 if (nbusy == 0) 299 break; 300 printf("%d ", nbusy); 301 if (nbusy < pbusy) 302 iter = 0; 303 pbusy = nbusy; 304 sync(&thread0, NULL); |
303 if (curthread != NULL) { 304 DROP_GIANT(); 305 for (subiter = 0; subiter < 50 * iter; subiter++) { 306 mtx_lock_spin(&sched_lock); 307 /* 308 * Allow interrupt threads to run 309 */ 310 mi_switch(SW_VOL, NULL); 311 mtx_unlock_spin(&sched_lock); 312 DELAY(1000); 313 } 314 PICKUP_GIANT(); 315 } else | 305 306#ifdef PREEMPTION 307 /* 308 * Drop Giant and spin for a while to allow 309 * interrupt threads to run. 310 */ 311 DROP_GIANT(); |
316 DELAY(50000 * iter); | 312 DELAY(50000 * iter); |
313 PICKUP_GIANT(); 314#else 315 /* 316 * Drop Giant and context switch several times to 317 * allow interrupt threads to run. 318 */ 319 DROP_GIANT(); 320 for (subiter = 0; subiter < 50 * iter; subiter++) { 321 mtx_lock_spin(&sched_lock); 322 mi_switch(SW_VOL, NULL); 323 mtx_unlock_spin(&sched_lock); 324 DELAY(1000); 325 } 326 PICKUP_GIANT(); 327#endif |
|
317 } 318 printf("\n"); 319 /* 320 * Count only busy local buffers to prevent forcing 321 * a fsck if we're just a client of a wedged NFS server 322 */ 323 nbusy = 0; 324 for (bp = &buf[nbuf]; --bp >= buf; ) { --- 300 unchanged lines hidden --- | 328 } 329 printf("\n"); 330 /* 331 * Count only busy local buffers to prevent forcing 332 * a fsck if we're just a client of a wedged NFS server 333 */ 334 nbusy = 0; 335 for (bp = &buf[nbuf]; --bp >= buf; ) { --- 300 unchanged lines hidden --- |