Re: [PATCH 05/13] overlayfs: add statfs support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 15, 2012 at 05:48:12PM +0200, Miklos Szeredi wrote:
> From: Andy Whitcroft <apw@xxxxxxxxxxxxx>
> 
> Add support for statfs to the overlayfs filesystem.  As the upper layer
> is the target of all write operations assume that the space in that
> filesystem is the space in the overlayfs.  There will be some inaccuracy as
> overwriting a file will copy it up and consume space we were not expecting,
> but it is better than nothing.
> 
> Use the upper layer dentry and mount from the overlayfs root inode,
> passing the statfs call to that filesystem.
[...] 
> +/**
> + * ovl_statfs
> + * @sb: The overlayfs super block
> + * @buf: The struct kstatfs to fill in with stats
> + *
> + * Get the filesystem statistics.  As writes always target the upper layer
> + * filesystem pass the statfs to the same filesystem.
> + */
> +static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
> +{
> +	struct dentry *root_dentry = dentry->d_sb->s_root;
> +	struct path path;
> +	ovl_path_upper(root_dentry, &path);
> +
> +	if (!path.dentry->d_sb->s_op->statfs)
> +		return -ENOSYS;
> +	return path.dentry->d_sb->s_op->statfs(path.dentry, buf);
> +}
[...]

In case f_namelen differs between the upper and lower filesystems, you
need to return the greater of the two.

Should f_type be overridden to indicate overlayfs?  I'm not sure what
userland is likely to do with f_type.  (For presentation to the user,
it should get the mount type name with getmntent() or libmount.  And
that will just work.)

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux