Re: [NFS] [PATCH 009 of 11] knfsd: Allow max size of NFSd payload to be configured.

J. Bruce Fields
2006-09-25T21:25:07Z

On Thu, Aug 24, 2006 at 04:37:16PM +1000, NeilBrown wrote:
> diff .prev/fs/nfsd/nfssvc.c ./fs/nfsd/nfssvc.c
> --- .prev/fs/nfsd/nfssvc.c 2006-08-24 16:26:10.000000000 +1000
> +++ ./fs/nfsd/nfssvc.c 2006-08-24 16:26:10.000000000 +1000
> @@ -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 >>= 12;
> + while (nfsd_max_blksize > i.totalram &&
> + nfsd_max_blksize >= 8*1024*2)
> + nfsd_max_blksize /= 2;
> + }

It looks to me like totalram is actually measured in pages. So in
practice this gives almost everyone 8k here. So that 12 should be
something like 12 - PAGE_CACHE_SHIFT?

--b.