Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_bio.c
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
#include <vm/vm_kern.h> | #include <vm/vm_kern.h> | ||||
#include <vm/vm_object.h> | #include <vm/vm_object.h> | ||||
#include <vm/vm_page.h> | #include <vm/vm_page.h> | ||||
#include <vm/vm_pageout.h> | #include <vm/vm_pageout.h> | ||||
#include <vm/vm_pager.h> | #include <vm/vm_pager.h> | ||||
#include <vm/vm_extern.h> | #include <vm/vm_extern.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/swap_pager.h> | #include <vm/swap_pager.h> | ||||
#include "opt_swap.h" | |||||
static MALLOC_DEFINE(M_BIOBUF, "biobuf", "BIO buffer"); | static MALLOC_DEFINE(M_BIOBUF, "biobuf", "BIO buffer"); | ||||
struct bio_ops bioops; /* I/O operation notification */ | struct bio_ops bioops; /* I/O operation notification */ | ||||
struct buf_ops buf_ops_bio = { | struct buf_ops buf_ops_bio = { | ||||
.bop_name = "buf_ops_bio", | .bop_name = "buf_ops_bio", | ||||
.bop_write = bufwrite, | .bop_write = bufwrite, | ||||
▲ Show 20 Lines • Show All 914 Lines • ▼ Show 20 Lines | if (bd_speedupreq == 0 || bd_request == 0) | ||||
needwake = 1; | needwake = 1; | ||||
bd_speedupreq = 1; | bd_speedupreq = 1; | ||||
bd_request = 1; | bd_request = 1; | ||||
if (needwake) | if (needwake) | ||||
wakeup(&bd_request); | wakeup(&bd_request); | ||||
mtx_unlock(&bdlock); | mtx_unlock(&bdlock); | ||||
} | } | ||||
#ifndef NSWBUF_MIN | |||||
#define NSWBUF_MIN 16 | |||||
#endif | |||||
#ifdef __i386__ | #ifdef __i386__ | ||||
#define TRANSIENT_DENOM 5 | #define TRANSIENT_DENOM 5 | ||||
#else | #else | ||||
#define TRANSIENT_DENOM 10 | #define TRANSIENT_DENOM 10 | ||||
#endif | #endif | ||||
/* | /* | ||||
* Calculating buffer cache scaling values and reserve space for buffer | * Calculating buffer cache scaling values and reserve space for buffer | ||||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | if (bio_transient_maxcnt == 0 && unmapped_buf_allowed) { | ||||
*/ | */ | ||||
if (bio_transient_maxcnt > 1024) | if (bio_transient_maxcnt > 1024) | ||||
bio_transient_maxcnt = 1024; | bio_transient_maxcnt = 1024; | ||||
if (tuned_nbuf) | if (tuned_nbuf) | ||||
nbuf = buf_sz / BKVASIZE; | nbuf = buf_sz / BKVASIZE; | ||||
} | } | ||||
/* | /* | ||||
* swbufs are used as temporary holders for I/O, such as paging I/O. | |||||
* We have no less then 16 and no more then 256. | |||||
*/ | |||||
nswbuf = min(nbuf / 4, 256); | |||||
TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); | |||||
if (nswbuf < NSWBUF_MIN) | |||||
nswbuf = NSWBUF_MIN; | |||||
/* | |||||
* Reserve space for the buffer cache buffers | * Reserve space for the buffer cache buffers | ||||
*/ | */ | ||||
swbuf = (void *)v; | |||||
v = (caddr_t)(swbuf + nswbuf); | |||||
buf = (void *)v; | buf = (void *)v; | ||||
v = (caddr_t)(buf + nbuf); | v = (caddr_t)(buf + nbuf); | ||||
return(v); | return(v); | ||||
} | } | ||||
/* Initialize the buffer subsystem. Called before use of any buffers. */ | /* Initialize the buffer subsystem. Called before use of any buffers. */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 4,357 Lines • Show Last 20 Lines |