]> err.no Git - linux-2.6/blobdiff - fs/nfsd/nfssvc.c
Merge branch 'audit.b32' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit...
[linux-2.6] / fs / nfsd / nfssvc.c
index 19443056ec301a94df4db864d617fac80a0f0fa5..6fa6340a5fb892e217e180218d3199bc4e4b3e55 100644 (file)
@@ -198,9 +198,26 @@ int nfsd_create_serv(void)
                unlock_kernel();
                return 0;
        }
+       if (nfsd_max_blksize == 0) {
+               /* choose a suitable default */
+               struct sysinfo i;
+               si_meminfo(&i);
+               /* Aim for 1/4096 of memory per thread
+                * This gives 1MB on 4Gig machines
+                * But only uses 32K on 128M machines.
+                * Bottom out at 8K on 32M and smaller.
+                * Of course, this is only a default.
+                */
+               nfsd_max_blksize = NFSSVC_MAXBLKSIZE;
+               i.totalram <<= PAGE_SHIFT - 12;
+               while (nfsd_max_blksize > i.totalram &&
+                      nfsd_max_blksize >= 8*1024*2)
+                       nfsd_max_blksize /= 2;
+       }
 
        atomic_set(&nfsd_busy, 0);
-       nfsd_serv = svc_create_pooled(&nfsd_program, NFSD_BUFSIZE,
+       nfsd_serv = svc_create_pooled(&nfsd_program,
+                                     NFSD_BUFSIZE - NFSSVC_MAXBLKSIZE + nfsd_max_blksize,
                                      nfsd_last_thread,
                                      nfsd, SIG_NOCLEAN, THIS_MODULE);
        if (nfsd_serv == NULL)