Deleted Added
full compact
vfs_bio.c (54911) vfs_bio.c (55539)
1/*
2 * Copyright (c) 1994,1997 John S. Dyson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Absolutely no warranty of function or purpose is made by the author
12 * John S. Dyson.
13 *
1/*
2 * Copyright (c) 1994,1997 John S. Dyson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Absolutely no warranty of function or purpose is made by the author
12 * John S. Dyson.
13 *
14 * $FreeBSD: head/sys/kern/vfs_bio.c 54911 1999-12-20 20:28:40Z dillon $
14 * $FreeBSD: head/sys/kern/vfs_bio.c 55539 2000-01-07 08:36:44Z luoqi $
15 */
16
17/*
18 * this file contains a new buffer I/O scheme implementing a coherent
19 * VM object and buffer cache scheme. Pains have been taken to make
20 * sure that the performance degradation associated with schemes such
21 * as this is not realized.
22 *
23 * Author: John S. Dyson
24 * Significant help during the development and debugging phases
25 * had been provided by David Greenman, also of the FreeBSD core team.
26 *
27 * see man buf(9) for more info.
28 */
29
30#include <sys/param.h>
31#include <sys/systm.h>
15 */
16
17/*
18 * this file contains a new buffer I/O scheme implementing a coherent
19 * VM object and buffer cache scheme. Pains have been taken to make
20 * sure that the performance degradation associated with schemes such
21 * as this is not realized.
22 *
23 * Author: John S. Dyson
24 * Significant help during the development and debugging phases
25 * had been provided by David Greenman, also of the FreeBSD core team.
26 *
27 * see man buf(9) for more info.
28 */
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/buf.h>
33#include <sys/conf.h>
34#include <sys/eventhandler.h>
35#include <sys/lock.h>
36#include <sys/malloc.h>
37#include <sys/mount.h>
32#include <sys/kernel.h>
38#include <sys/kernel.h>
33#include <sys/sysctl.h>
34#include <sys/proc.h>
35#include <sys/kthread.h>
39#include <sys/kthread.h>
36#include <sys/vnode.h>
40#include <sys/proc.h>
41#include <sys/reboot.h>
42#include <sys/resourcevar.h>
43#include <sys/sysctl.h>
37#include <sys/vmmeter.h>
44#include <sys/vmmeter.h>
38#include <sys/lock.h>
45#include <sys/vnode.h>
39#include <vm/vm.h>
40#include <vm/vm_param.h>
41#include <vm/vm_kern.h>
42#include <vm/vm_pageout.h>
43#include <vm/vm_page.h>
44#include <vm/vm_object.h>
45#include <vm/vm_extern.h>
46#include <vm/vm_map.h>
46#include <vm/vm.h>
47#include <vm/vm_param.h>
48#include <vm/vm_kern.h>
49#include <vm/vm_pageout.h>
50#include <vm/vm_page.h>
51#include <vm/vm_object.h>
52#include <vm/vm_extern.h>
53#include <vm/vm_map.h>
47#include <sys/buf.h>
48#include <sys/mount.h>
49#include <sys/malloc.h>
50#include <sys/resourcevar.h>
51#include <sys/conf.h>
52
53static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer");
54
55struct bio_ops bioops; /* I/O operation notification */
56
57struct buf *buf; /* buffer header pool */
58struct swqueue bswlist;
59

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

1661 &bufdaemonproc
1662};
1663SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp)
1664
1665static void
1666buf_daemon()
1667{
1668 int s;
54
55static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer");
56
57struct bio_ops bioops; /* I/O operation notification */
58
59struct buf *buf; /* buffer header pool */
60struct swqueue bswlist;
61

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

1663 &bufdaemonproc
1664};
1665SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp)
1666
1667static void
1668buf_daemon()
1669{
1670 int s;
1671
1669 /*
1672 /*
1673 * This process needs to be suspended prior to shutdown sync.
1674 */
1675 EVENTHANDLER_REGISTER(shutdown_pre_sync, shutdown_kproc, bufdaemonproc,
1676 SHUTDOWN_PRI_LAST);
1677
1678 /*
1670 * This process is allowed to take the buffer cache to the limit
1671 */
1672 curproc->p_flag |= P_BUFEXHAUST;
1673 s = splbio();
1674
1675 bd_interval = 5 * hz; /* dynamically adjusted */
1676 bd_flushto = hidirtybuffers; /* dynamically adjusted */
1677 bd_flushinc = 1;
1678
1679 * This process is allowed to take the buffer cache to the limit
1680 */
1681 curproc->p_flag |= P_BUFEXHAUST;
1682 s = splbio();
1683
1684 bd_interval = 5 * hz; /* dynamically adjusted */
1685 bd_flushto = hidirtybuffers; /* dynamically adjusted */
1686 bd_flushinc = 1;
1687
1679 while (TRUE) {
1688 for (;;) {
1689 kproc_suspend_loop(bufdaemonproc);
1690
1680 bd_request = 0;
1681
1682 /*
1683 * Do the flush. Limit the number of buffers we flush in one
1684 * go. The failure condition occurs when processes are writing
1685 * buffers faster then we can dispose of them. In this case
1686 * we may be flushing so often that the previous set of flushes
1687 * have not had time to complete, causing us to run out of

--- 1402 unchanged lines hidden ---
1691 bd_request = 0;
1692
1693 /*
1694 * Do the flush. Limit the number of buffers we flush in one
1695 * go. The failure condition occurs when processes are writing
1696 * buffers faster then we can dispose of them. In this case
1697 * we may be flushing so often that the previous set of flushes
1698 * have not had time to complete, causing us to run out of

--- 1402 unchanged lines hidden ---