Fix mistake in r343030: move nswbuf calculation back to

kern_vfs_bio_buffer_alloc(), because in init_param2() nbuf
isn't really initialized yet.

Pointed out by:	bde
This commit is contained in:
glebius 2019-01-16 20:20:38 +00:00
parent 39991209c1
commit 35140f62be
2 changed files with 6 additions and 3 deletions

View File

@ -291,10 +291,7 @@ init_param2(long physpages)
* Physical buffers are pre-allocated buffers (struct buf) that * Physical buffers are pre-allocated buffers (struct buf) that
* are used as temporary holders for I/O, such as paging I/O. * are used as temporary holders for I/O, such as paging I/O.
*/ */
nswbuf = min(nbuf / 4, 256);
TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf); TUNABLE_INT_FETCH("kern.nswbuf", &nswbuf);
if (nswbuf < NSWBUF_MIN)
nswbuf = NSWBUF_MIN;
/* /*
* The default for maxpipekva is min(1/64 of the kernel address space, * The default for maxpipekva is min(1/64 of the kernel address space,

View File

@ -1124,6 +1124,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
nbuf = buf_sz / BKVASIZE; nbuf = buf_sz / BKVASIZE;
} }
if (nswbuf == 0) {
nswbuf = min(nbuf / 4, 256);
if (nswbuf < NSWBUF_MIN)
nswbuf = NSWBUF_MIN;
}
/* /*
* Reserve space for the buffer cache buffers * Reserve space for the buffer cache buffers
*/ */