From: Dave Chinner <david@fromorbit.com>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/5] ext4: Implement project ID support for ext4 filesystem
Date: Fri, 22 Jun 2012 13:07:53 +1000 [thread overview]
Message-ID: <20120622030753.GU19223@dastard> (raw)
In-Reply-To: <1340269733-25922-4-git-send-email-dmonakhov@openvz.org>
On Thu, Jun 21, 2012 at 01:08:51PM +0400, Dmitry Monakhov wrote:
> * Abstract
> A subtree of a directory tree T is a tree consisting of a directory
> (the subtree root) in T and all of its descendants in T.
>
> *NOTE*: User is allowed to break pure subtree hierarchy via manual
> id manipulation.
>
> Project subtrees assumptions:
> (1) Each inode has an id. This id is persistently stored inside
> inode (xattr, usually inside ibody)
> (2) Project id is inherent from parent directory
You are mashing two different concepts into one, and naming it in a
manner guaranteed to create confusion with all the people already
using project quotas on XFS. You're implementing subtree quotas, not
project quotas.
> This feature is similar to project-id in XFS. One may assign
> some id to a subtree. Each entry from the subtree may be
> accounted in directory project quota. Will appear in later
> patches.
As implied above, project quotas ID in XFS are not subtree quotas.
They are used to implement project quotas, not subtree quotas.
subtree quotas are a userspace management construction using a
subset of project quota infrastructure. i.e. the inheritance of
project IDs in XFS and the restriction of operations to within
subtrees is not a function of project quotas - it's a separately
managed feature that was added to support the functioanlity needed
for subtree quotas.
ISTR raising this objection last time you posted this patch set -
either you implement project quotas as they exist in XFS and handle
subtree quotas as a constrainted set of project quota functionality
or you need to drop all references to "project quotas" and call this
something like sub-tree quotas that uses subtree IDs.
> * Disk layout
> Project id is stored on disk inside xattr usually inside ibody.
> Xattr is used only as a data storage, It has not user visible xattr
> interface.
If you've got enough xattrs on the inode, then it will end up out of
line and performance is going to suck - every time you write to a
cold file you now need two IOs - one to read the extent list, and
one to read the xattrs to get the project ID....
> * User interface
> Project id is accessible via generic xattr interface "system.project_id"
Which means it is an incompatible with XFS. What purpose does this
serve except to confuse people? Why not a generic set/get project ID
quotactl/ioctl? That's much easier for applications to use compared
to xattrs, and far easier to support different implementations
across filesystems. The way the project ID is stored in ext4 should
not define the API.
Indeed, an ioctl/quotactl style interface matches the existing quota
interface, so it's much more natural to use a similar API to one
already used for quota manipulation...
> * Notes
> ext4_setattr interface to prjid: Semantically prjid must being changed
> similar to uid/gid, but project_id is stored inside xattr so on-disk
> structures updates is not that trivial, so I've move prjid change
> logic to separate function.
I suspect that there are corner cases you haven't thought about
yet. What happens when you hard link a file into two separate
subtrees? how do you account for that? What happens when you remove
the hard link from the subtree the inode is accounted to? What
happens when a rename occurs, moving a file from one subtree to
another?
.....
> +static int
> +ext4_xattr_prj_set(struct dentry *dentry, const char *name,
> + const void *value, size_t size, int flags, int type)
> +{
> + unsigned int new_prjid;
> + if (strcmp(name, "") != 0)
> + return -EINVAL;
> + new_prjid = simple_strtoul(value, (char **)&value, 0);
> + return ext4_prj_change(dentry->d_inode, new_prjid);
Because you are using strings rather than integers for the ID, you
need to do a lot better verification here - what will happen when
someone tries to set an ID of "frobnozzle"? Using integers via
ioctls for the user API make this problem....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2012-06-22 3:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 9:08 [PATCH 0/5] RFC: introduce extended inode owner identifier v9 Dmitry Monakhov
2012-06-21 9:08 ` [PATCH 1/5] Add additional owner identifier Dmitry Monakhov
2012-06-22 0:03 ` Jan Kara
2012-07-03 18:42 ` Dmitry Monakhov
2012-06-21 9:08 ` [PATCH 2/5] Implement project id support for generic quota Dmitry Monakhov
2012-06-22 0:01 ` Jan Kara
2012-06-21 9:08 ` [PATCH 3/5] ext4: Implement project ID support for ext4 filesystem Dmitry Monakhov
2012-06-21 23:51 ` Jan Kara
2012-07-03 18:46 ` Dmitry Monakhov
2012-06-22 3:07 ` Dave Chinner [this message]
2012-06-28 10:16 ` Jan Kara
2012-07-03 19:11 ` Dmitry Monakhov
2012-06-21 9:08 ` [PATCH 4/5] ext4: add project quota support Dmitry Monakhov
2012-06-21 23:56 ` Jan Kara
2012-06-21 9:08 ` [PATCH 5/5] XFS: prjquota and grpqouta now may coexist Dmitry Monakhov
2012-06-22 2:36 ` Dave Chinner
2012-07-03 19:14 ` Dmitry Monakhov
-- strict thread matches above, loose matches on Subject: below --
2010-03-18 14:02 [PATCH 0/5] RFC: introduce extended inode owner identifier v6 Dmitry Monakhov
2010-03-18 14:02 ` [PATCH 1/5] vfs: Add additional owner identifier Dmitry Monakhov
2010-03-18 14:02 ` [PATCH 2/5] quota: Implement project id support for generic quota Dmitry Monakhov
2010-03-18 14:02 ` [PATCH 3/5] ext4: Implement project ID support for ext4 filesystem Dmitry Monakhov
2010-03-18 21:25 ` Andreas Dilger
2010-03-19 8:16 ` Dmitry Monakhov
2010-03-04 18:34 [PATCH 0/5] RFC: introduce extended inode owner identifier v5 Dmitry Monakhov
2010-03-04 18:34 ` [PATCH 1/5] vfs: Add additional owner identifier Dmitry Monakhov
2010-03-04 18:34 ` [PATCH 2/5] quota: Implement project id support for generic quota Dmitry Monakhov
2010-03-04 18:34 ` [PATCH 3/5] ext4: Implement project ID support for ext4 filesystem Dmitry Monakhov
2010-03-11 12:06 ` Christoph Hellwig
2010-03-11 13:30 ` Dmitry Monakhov
2010-03-11 19:54 ` Andreas Dilger
2010-03-11 22:01 ` tytso
2010-03-12 9:32 ` Dmitry Monakhov
2010-03-12 20:07 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120622030753.GU19223@dastard \
--to=david@fromorbit.com \
--cc=dmonakhov@openvz.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).