[PATCHES]vfs: separate fs stats from quota in vfs modules
jra at samba.org
Mon Jan 11 22:10:55 UTC 2016
On Mon, Jan 11, 2016 at 06:13:54AM +0200, Uri Simchoni wrote:
> The attached patch set is a code refactoring whose aim is to make
> vfs modules leaner and easier to customize in the area of
> determining free disk space. Review appreciated.
> When calculating disk size and free space (in get_dfree_info()), one
> has to take both file system metrics and disk quotas into account
> (that's the Windows behavior - show the smaller of the free space
> and remaining quota). The current implementation tucks all of this
> into a disk_free_fn VFS method, which is also supposed to handle the
> obscure "max disk size" parameter and varying block sizes.
> This patch leverages the VFS get_quota_fn interface (with a change)
> to obtain quota, gets all the generic processing out of the default
> vfs implementation into the SMB layer, and (in principle) leaves
> disk_free_fn with the task of querying file system stats. An
> implementation may still implement everything in disk_free_fn, it
> just has to return an error from the quota function (this is the
> status for gpfs after the patch because I didn't want to mess with
> it too much without testing capability).
> In addition to achieving what I believe is a cleaner design, my
> motivation for doing this is to customize the quota part a bit using
> a VFS module, to account for a CTERA linux kernel patch that
> implements default quotas, without having to re-implement the whole
> thing, and also to add an smb.conf parameter that would calculate
> quota based on directory owner if owner is inherited (file created
> in a certain folder by user Y would have user X as their owner, so
> the correct disk-free stats must take user X quota into account).
> The latter change is, I believe, of general applicability and will
> be posted later.
> The general patch-set structure:
> Patches 1-9 - add tests for disk-free and quotas, using a new mock
> vfs module called vfs_fake_dfq. Some of those patches could probably
> be squashed - the vfs_fake_dfq is built across 3 patches and the
> tests are added with respective 3 patches. I think it should be
> easier to review this way but I can squash them.
Still reviewing this but I just wanted to say how nice
it is to see the patch structured this way with the
mock VFS module providing the framework for a test environment.
I've learned a lot reading this code - thanks !
More information about the samba-technical