I ran across a bug in linux's handling of tmpfs mount options in an old kernel, but it seems to have been fixed. I then discovered however, that the semantics of the option no longer matched what was written in the mount(8) man page. Here's a patch to make them $<br>
<br>--- usr/share/man/man8/mount.8 2009-05-29 06:06:27.000000000 -0500<br>+++ usr/share/man/man8/mount.8 2009-07-28 15:45:07.000000000 -0500<br>@@ -1821,7 +1821,7 @@<br> .TP<br> .BI size= nbytes<br> Override default maximum size of the filesystem.<br>
-The size is given in bytes, and rounded down to entire pages.<br>+The size is given in bytes, and rounded up to entire pages.<br> The default is half of the memory. The size parameter also accepts a suffix %<br> to limit this tmpfs instance to that percentage of your physical RAM:<br>
the default, when neither size nor nr_blocks is specified, is size=50%<br><br>Specifically, the old code did this:<br> if (!strcmp(this_char,"size")) {<br> unsigned long long size;<br>
size = memparse(value,&rest);<br> if (*rest == '%') {<br> size <<= PAGE_SHIFT;<br> size *= totalram_pages;<br>
do_div(size, 100);<br> rest++;<br> }<br> if (*rest)<br> goto bad_val;<br> *blocks = size >> PAGE_CACHE_SHIFT;<br>
<br>Which of course truncates the value (aka rounding it down)<br><br>and the new code does this:<br> if (!strcmp(this_char,"size")) {<br> unsigned long long size;<br> size = memparse(value,&rest);<br>
if (*rest == '%') {<br> size <<= PAGE_SHIFT;<br> size *= totalram_pages;<br> do_div(size, 100);<br>
rest++;<br> }<br> if (*rest)<br> goto bad_val;<br> sbinfo->max_blocks =<br> DIV_ROUND_UP(size, PAGE_CACHE_SIZE)<br>
<br>In order to avoid problems when the user specifies a size < page size, with the side effect that now it rounds the value UP to the nearest page size.<br><br>Please CC me if you have any questions as I'm not subscribed to this list.<br>
<br>Please also CC anyone else who might need this (redhat, suse, etc... maintainer, for example)<br><br>Kevin Granade<br><br>