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:
Gleb Smirnoff 2019-01-16 20:20:38 +00:00
parent 46b0292a82
commit d1bb5d7d50
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343101
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
* are used as temporary holders for I/O, such as paging I/O.
*/
nswbuf = min(nbuf / 4, 256);
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,

View File

@ -1124,6 +1124,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
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
*/