diff options
author | NeilBrown <neilb@suse.de> | 2006-10-04 05:15:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-04 10:55:16 -0400 |
commit | 596bbe53eb3abfe7326b2f5e8afd614265c319c8 (patch) | |
tree | 31e1f008f8acb46d1a3a937538446a1447ed9c8f /fs/nfsd/nfssvc.c | |
parent | 7adae489fe794e3e203ff168595f635d0b845e59 (diff) |
[PATCH] knfsd: Allow max size of NFSd payload to be configured
The max possible is the maximum RPC payload. The default depends on amount of
total memory.
The value can be set within reason as long as no nfsd threads are currently
running. The value can also be ready, allowing the default to be determined
after nfsd has started.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
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) |