diff options
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r-- | fs/nfsd/nfssvc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 19443056ec30..0603baad5426 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -198,9 +198,26 @@ int nfsd_create_serv(void) | |||
198 | unlock_kernel(); | 198 | unlock_kernel(); |
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | if (nfsd_max_blksize == 0) { | ||
202 | /* choose a suitable default */ | ||
203 | struct sysinfo i; | ||
204 | si_meminfo(&i); | ||
205 | /* Aim for 1/4096 of memory per thread | ||
206 | * This gives 1MB on 4Gig machines | ||
207 | * But only uses 32K on 128M machines. | ||
208 | * Bottom out at 8K on 32M and smaller. | ||
209 | * Of course, this is only a default. | ||
210 | */ | ||
211 | nfsd_max_blksize = NFSSVC_MAXBLKSIZE; | ||
212 | i.totalram >>= 12; | ||
213 | while (nfsd_max_blksize > i.totalram && | ||
214 | nfsd_max_blksize >= 8*1024*2) | ||
215 | nfsd_max_blksize /= 2; | ||
216 | } | ||
201 | 217 | ||
202 | atomic_set(&nfsd_busy, 0); | 218 | atomic_set(&nfsd_busy, 0); |
203 | nfsd_serv = svc_create_pooled(&nfsd_program, NFSD_BUFSIZE, | 219 | nfsd_serv = svc_create_pooled(&nfsd_program, |
220 | NFSD_BUFSIZE - NFSSVC_MAXBLKSIZE + nfsd_max_blksize, | ||
204 | nfsd_last_thread, | 221 | nfsd_last_thread, |
205 | nfsd, SIG_NOCLEAN, THIS_MODULE); | 222 | nfsd, SIG_NOCLEAN, THIS_MODULE); |
206 | if (nfsd_serv == NULL) | 223 | if (nfsd_serv == NULL) |