Author: glebius
Date: Wed Jan 16 20:20:38 2019
New Revision: 343101
URL: https://svnweb.freebsd.org/changeset/base/343101

Log:
  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

Modified:
  head/sys/kern/subr_param.c
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c  Wed Jan 16 20:14:16 2019        (r343100)
+++ head/sys/kern/subr_param.c  Wed Jan 16 20:20:38 2019        (r343101)
@@ -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,

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Wed Jan 16 20:14:16 2019        (r343100)
+++ head/sys/kern/vfs_bio.c     Wed Jan 16 20:20:38 2019        (r343101)
@@ -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
         */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to