Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jan 2010 18:18:48 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Jaakko Heinonen <jh@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans <brde@optusnet.com.au>
Subject:   Re: svn commit: r201773 - head/sys/fs/tmpfs
Message-ID:  <20100110181132.D1354@besplex.bde.org>
In-Reply-To: <20100108214821.GA985@a91-153-117-195.elisa-laajakaista.fi>
References:  <201001080757.o087vhrr009799@svn.freebsd.org> <20100109051536.R57595@delplex.bde.org> <20100108214821.GA985@a91-153-117-195.elisa-laajakaista.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 8 Jan 2010, Jaakko Heinonen wrote:

> Does following patch look reasonable?
>
> - Fix style bugs introduced in r201773.
> - Change the type of nodes_max to u_int and use "%u" format string to
>  convert its value.

> Index: sys/fs/tmpfs/tmpfs_vfsops.c
> ===================================================================
> --- sys/fs/tmpfs/tmpfs_vfsops.c	(revision 201818)
> +++ sys/fs/tmpfs/tmpfs_vfsops.c	(working copy)
> @@ -239,7 +239,7 @@ tmpfs_mount(struct mount *mp)
> 	 * allowed to use, based on the maximum size the user passed in
> 	 * the mount structure.  A value of zero is treated as if the
> 	 * maximum available space was requested. */
> -	if (size_max < PAGE_SIZE || size_max > (SIZE_MAX - PAGE_SIZE))
> +	if (size_max < PAGE_SIZE || size_max > SIZE_MAX - PAGE_SIZE)
> 		pages = SIZE_MAX;

I think you should change this to use howmany() (or set size_max and
join the else clause) too.

> 	else
> 		pages = howmany(size_max, PAGE_SIZE);

OK.  Gleb Kurtsou reported a more interesting problem related to large
values of `pages' being too large.  I'll let you look at this...  IIRC
he made the byte limit UINT_MAX.  Perhaps it should be a small fraction
of the address space (UINT_MAX is still larger than physically possible
for 32-bit systems).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100110181132.D1354>