Deleted Added
full compact
kern_shutdown.c (144929) kern_shutdown.c (149875)
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 144929 2005-04-12 05:45:58Z jeff $");
38__FBSDID("$FreeBSD: head/sys/kern/kern_shutdown.c 149875 2005-09-08 06:30:05Z truckman $");
39
40#include "opt_kdb.h"
41#include "opt_mac.h"
42#include "opt_panic.h"
43#include "opt_show_busybufs.h"
44#include "opt_sched.h"
45
46#include <sys/param.h>

--- 184 unchanged lines hidden (view full) ---

231 }
232
233 savectx(&dumppcb);
234 dumptid = curthread->td_tid;
235 dumping++;
236 dumpsys(&dumper);
237}
238
39
40#include "opt_kdb.h"
41#include "opt_mac.h"
42#include "opt_panic.h"
43#include "opt_show_busybufs.h"
44#include "opt_sched.h"
45
46#include <sys/param.h>

--- 184 unchanged lines hidden (view full) ---

231 }
232
233 savectx(&dumppcb);
234 dumptid = curthread->td_tid;
235 dumping++;
236 dumpsys(&dumper);
237}
238
239static int
240isbufbusy(struct buf *bp)
241{
242 if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 &&
243 BUF_REFCNT(bp) > 0) ||
244 ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI))
245 return (1);
246 return (0);
247}
248
239/*
240 * Shutdown the system cleanly to prepare for reboot, halt, or power off.
241 */
242static void
243boot(int howto)
244{
245 static int first_buf_printf = 1;
246

--- 36 unchanged lines hidden (view full) ---

283
284 /*
285 * With soft updates, some buffers that are
286 * written will be remarked as dirty until other
287 * buffers are written.
288 */
289 for (iter = pbusy = 0; iter < 20; iter++) {
290 nbusy = 0;
249/*
250 * Shutdown the system cleanly to prepare for reboot, halt, or power off.
251 */
252static void
253boot(int howto)
254{
255 static int first_buf_printf = 1;
256

--- 36 unchanged lines hidden (view full) ---

293
294 /*
295 * With soft updates, some buffers that are
296 * written will be remarked as dirty until other
297 * buffers are written.
298 */
299 for (iter = pbusy = 0; iter < 20; iter++) {
300 nbusy = 0;
291 for (bp = &buf[nbuf]; --bp >= buf; ) {
292 if ((bp->b_flags & B_INVAL) == 0 &&
293 BUF_REFCNT(bp) > 0) {
301 for (bp = &buf[nbuf]; --bp >= buf; )
302 if (isbufbusy(bp))
294 nbusy++;
303 nbusy++;
295 } else if ((bp->b_flags & (B_DELWRI | B_INVAL))
296 == B_DELWRI) {
297 /* bawrite(bp);*/
298 nbusy++;
299 }
300 }
301 if (nbusy == 0) {
302 if (first_buf_printf)
303 printf("All buffers synced.");
304 break;
305 }
306 if (first_buf_printf) {
307 printf("Syncing disks, buffers remaining... ");
308 first_buf_printf = 0;

--- 29 unchanged lines hidden (view full) ---

338 }
339 printf("\n");
340 /*
341 * Count only busy local buffers to prevent forcing
342 * a fsck if we're just a client of a wedged NFS server
343 */
344 nbusy = 0;
345 for (bp = &buf[nbuf]; --bp >= buf; ) {
304 if (nbusy == 0) {
305 if (first_buf_printf)
306 printf("All buffers synced.");
307 break;
308 }
309 if (first_buf_printf) {
310 printf("Syncing disks, buffers remaining... ");
311 first_buf_printf = 0;

--- 29 unchanged lines hidden (view full) ---

341 }
342 printf("\n");
343 /*
344 * Count only busy local buffers to prevent forcing
345 * a fsck if we're just a client of a wedged NFS server
346 */
347 nbusy = 0;
348 for (bp = &buf[nbuf]; --bp >= buf; ) {
346 if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) ||
347 ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) {
349 if (isbufbusy(bp)) {
348#if 0
349/* XXX: This is bogus. We should probably have a BO_REMOTE flag instead */
350 if (bp->b_dev == NULL) {
351 TAILQ_REMOVE(&mountlist,
352 bp->b_vp->v_mount, mnt_list);
353 continue;
354 }
355#endif

--- 276 unchanged lines hidden ---
350#if 0
351/* XXX: This is bogus. We should probably have a BO_REMOTE flag instead */
352 if (bp->b_dev == NULL) {
353 TAILQ_REMOVE(&mountlist,
354 bp->b_vp->v_mount, mnt_list);
355 continue;
356 }
357#endif

--- 276 unchanged lines hidden ---