[blivet:master 1/2] Eliminate TmpFS.minSize()

Martin Kolman mkolman at redhat.com
Wed Nov 12 18:30:00 UTC 2014


On Wed, 2014-11-12 at 07:52 -0500, mulhern wrote:
> TmpFS inherits both _minSize and _minInstanceSize from FS, where they are
> both 0. TmpFS has no method to update _minInstanceSize, so _minInstanceSize
> will always remain 0. Therefore, it would make sense for minSize() method
> to just return the value of _minSize, indicating the the minimum size
> for this filesystem is based just on its type, not on any information about
> the particular instance. However, this is exactly what
> DeviceFormat.minSize() which TmpFS would inherit if it didn't override,
> does, so might as well just get rid of the overriding method, and let it
> inherit.
Yeah, that looks right - as long as we can make sure it is always a
number and not None or something else (which would make free() in FS
fail due to free = max(Size(0), self.currentSize - self.minSize) ),
this change should be fine.

> 
> This is a bit problematic, since 0 is used to mean unknown, but here means
> 0. It is possible that a method to obtain the minimum size of an existing
> TmpFS instance should be written, but in the meantime, this change
> makes the situation more obvious than it was previously.
Well, if you mean a minimum size for filesystem creation, then tmpfs is
a bit of special case as you can apparently create a zero-sized tmpf
instance:

$ mkdir test
$ sudo mount -t tmpfs -o size=0m tmpfs test 
$ cd test
$ df .
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs                  0     0         0
- /home/mkolman/data/mnt/test

This is probably a side effect to tmpfs living the in the kernel
page cache and having all its core metadata apparently outside
of the pool of pages used to store data - which is quite different
from normal filesystems that need to store its "housekeeping" metadata
in the same space as normal data. So the pool of data storage pages
could be empty, but the tmpfs instance is created just fine.

> 
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
>  blivet/formats/fs.py | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
> index 3fa6908..2199381 100644
> --- a/blivet/formats/fs.py
> +++ b/blivet/formats/fs.py
> @@ -1579,10 +1579,6 @@ class TmpFS(NoDevFS):
>          return self._size
>  
>      @property
> -    def minSize(self):
> -        return self._minInstanceSize
> -
> -    @property
>      def free(self):
>          if self._mountpoint:
>              # If self._mountpoint is defined, it means this tmpfs mount




More information about the anaconda-patches mailing list