linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] quota: add project quota support
@ 2014-09-24 14:04 Li Xi
  2014-09-24 14:04 ` [PATCH 1/4] Adds general codes to enforces project quota limits Li Xi
                   ` (3 more replies)
  0 siblings, 4 replies; 40+ messages in thread
From: Li Xi @ 2014-09-24 14:04 UTC (permalink / raw)
  To: linux-fsdevel, linux-ext4, linux-api, tytso, adilger, jack, viro,
	hch, dmonakhov

The following patches propose an implementation of project quota
support for ext4. A project is an aggregate of unrelated inodes
which might scatter in different directories. Inodes belongs to a
project possesses a same identification i.e. 'project ID', just
like every inode has its user/group identification. The following
patches adds project quota as supplement to the former uer/group
quota types.

The semantics of ext4 project quota is consistent with XFS. Each
directory can have EXT4_INODE_PROJINHERIT flag set. When the
EXT4_INODE_PROJINHERIT flag of a parent directory is not set, a
newly created inode under that directory will have a default project
ID (i.e. 0). And its EXT4_INODE_PROJINHERIT flag is not set either.
When this flag is set on a directory, following rules will be kept:

1) The newly created inode under that directory will inherit both
the EXT4_INODE_PROJINHERIT flag and the project ID from its parent
directory.

2) Hard-linking a inode with different project ID into that directory
will fail with errno EXDEV.

3) Renaming a inode with different project ID into that directory
will fail with errno EXDEV. However, 'mv' command will detect this
failure and copy the renamed inode to a new inode in the directory.
Thus, this new inode will inherit both the project ID and
EXT4_INODE_PROJINHERIT flag.

4) If the project quota of that ID is being enforced, statfs() on
that directory will take the quotas as another upper limits along
with the capacity of the file system, i.e. the total block/inode
number will be the minimum of the quota limits and file system
capacity.

Changelog:
* v4 <- v3:
 - Do not check project feature when set/get project ID;
 - Use EXT4_MAXQUOTAS instead of MAXQUOTAS in ext4 patches;
 - Remove unnecessary change of fs/quota/dquot.c;
 - Remove CONFIG_QUOTA_PROJECT.
* v3 <- v2:
 - Add EXT4_INODE_PROJINHERIT semantics.
* v2 <- v1:
 - Add ioctl interface for setting/getting project;
 - Add EXT4_FEATURE_RO_COMPAT_PROJECT;
 - Add get_projid() method in struct dquot_operations;
 - Add error check of ext4_inode_projid_set/get().

v3: http://www.spinics.net/lists/linux-ext4/msg45184.html
v2: http://www.spinics.net/lists/linux-ext4/msg44695.html
v1: http://article.gmane.org/gmane.comp.file-systems.ext4/45153

Any comments or feedbacks are appreciated.

Regards,
                                         - Li Xi

Li Xi (4):
  Adds general codes to enforces project quota limits
  Adds project ID support for ext4
  Adds project quota support for ext4
  Adds ioctl interface support for ext4 project

 Documentation/filesystems/ext4.txt |    4 +
 fs/ext4/ext4.h                     |   31 +++++++--
 fs/ext4/ialloc.c                   |    6 ++
 fs/ext4/inode.c                    |   29 ++++++++-
 fs/ext4/ioctl.c                    |   85 ++++++++++++++++++++++++
 fs/ext4/namei.c                    |   10 +++
 fs/ext4/super.c                    |  124 ++++++++++++++++++++++++++++++++---
 fs/quota/dquot.c                   |   16 ++++-
 fs/quota/quota.c                   |    5 +-
 fs/quota/quotaio_v2.h              |    6 +-
 include/linux/quota.h              |    2 +
 include/uapi/linux/quota.h         |    6 +-
 12 files changed, 299 insertions(+), 25 deletions(-)


^ permalink raw reply	[flat|nested] 40+ messages in thread
* Re: [PATCH 0/4] quota: add project quota support
@ 2014-08-01 15:48 Li Xi
  2014-08-01 20:17 ` Jan Kara
  0 siblings, 1 reply; 40+ messages in thread
From: Li Xi @ 2014-08-01 15:48 UTC (permalink / raw)
  To: Jan Kara; +Cc: Ext4 Developers List

2014-08-01 23:28 GMT+08:00 Li Xi <pkuelelixi@gmail.com>:
> 2014-08-01 20:40 GMT+08:00 Jan Kara <jack@suse.cz>:
>>
>> 1) It should have been also posted to linux-fsdevel@vger.kernel.org, Al Viro
>> <viro@ZenIV.linux.org.uk>, Christoph Hellwig <hch@infradead.org> because
>> you are changing core VFS inode and infrastructure as well. For quota
>> changes you should have also CCed me as a quota maintainer.
> Sure. Thanks for reminding me. I will add these addresses next time.
>>
>> 2) I'm not convinced we actually want project ID in the core inode - so far
>> only XFS has this. For everyone else it's just extra bloat so we could just
>> put it in ext4_inode_info. Granted we'd need to somewhat change quota
>> interface so that it sees all the ids (uid, gid, projid) but they are
>> really needed in two places - dquot_initalize() and dquot_transfer() and
>> creating variants of these functions that just take an array of ids and use
>> them in ext4 is simple enough.
> OK, agreed.
After searching dquot_initalize() and dquot_transfer(), I found changing these
two functions envolves too many file systems. Is there any good reason not to
add kprojid_t field in inode structure?
>>
>> 3) I see no way how to get / set project ID from userspace. Did I miss
>> something?
> Yeah, you are right. I didn't push the interface patch. We implemeted
> two kinds of interfaces. One is based on extended attribute interfaces which
> simulate project ID as an extended attribute of the inode. The other implemented
> a new ioctl command for ext4. Personally, I think ioctl is better. What is your
> opinion?
>>
>> 4) The ext4 change is changing on-disk format. You definitely need a
>> feature flag for that so that kernels that don't understand project quotas
>> don't corrupt the filesystem. Also you need a support for this in
>> e2fsprogs.
> Sure. I will add feature flag for project quota of ext4. And there are
> quite some
> related tools need updates, including e2fsprogs and quota-tools. We will push
> those patches as soon as they are ready.
>>
>> 5) You make the feature configurable both in quota code and ext4. I don't
>> think the footprint of the feature warrants that.
> Sure. Good point.
>
> Thank you for the advices, I will refresh the patches and send the mails to all
> of the related addresses soon.
>
> Regards,
> Li Xi

^ permalink raw reply	[flat|nested] 40+ messages in thread
* [PATCH 0/4] quota: add project quota support
@ 2014-08-01  1:05 Li Xi
  2014-08-01  1:06 ` Li Xi
  2014-08-01 12:40 ` Jan Kara
  0 siblings, 2 replies; 40+ messages in thread
From: Li Xi @ 2014-08-01  1:05 UTC (permalink / raw)
  To: Ext4 Developers List

The following patches propose an implementation of project support
for ext4. A project is an aggregate of unrelated inodes which might
scatter in different directories. Inodes belongs to a project
possesses a same identification i.e. 'project ID', just like every
inode has its user/group indentification. The following patches adds
project quota as supplement to the former uer/group quota types.
This project ID of an inode is iherited from its parent direcotry
and saved as an internal field of ext4 inode.

This is not the first existed attepmtion to add project quta support
for ext4. Patches of subtree quota support which was posted by Dmity
Monakhov in 2012 (http://lwn.net/Articles/506064/) implemented the
similar feature in a different way. Rather than saving the project
(or subtree) ID as an internal inode field, those patches manages
the ID as extented attributes.

We rebased both patch sets onto the same kernel version and run
benchmakrs respectively to comparing the peformance difference.
It is worth noting that patches from Lai Siyao and Niu Yawei
(quota: remove dqptr_sem,
http://article.gmane.org/gmane.comp.file-systems.ext4/44341/)
improve the performance of quota enforcement significantly, which
can be seen clearly from following results.

It is obvious that extended attribute implementation has performance
impact when creating files. That is why we choose to push the patches
which use internal inode field to save project ID.

Kernel: 3.16.0-rc5
Server: Dell R620 (2 x E5-2667@3.3GHz, 256GB memory)
Storage: 10 x 15K SAS disks(RAID10)
Test tool: mdtest-1.9.3. Mdtest created 800K files in total. Each
thread created files in unique directory.

File Creation:
                     1thr     2thr     4thr     8thr    16thr
- vanilla
quota disabled      66094   105781   178968   186647   172536
quotaon(ug)         60337    99582   157396   171463   162872

- vanilla + remove-dqptr_sem patches
quota disabled      65955   112082   185550   181511   171988
quotaon(ug)         62391   101905   171013   190570   168914

- prjquota(xattr)
quota disabled      61396    97580   147852   146423   164895
quotaon(ug)         57009    93435   140589   135748   153196
quotaon(ugP)        57500    89419   133604   125291   105127

- prjquota(xattr) + remove-dqptr_sem patches
quota disabled      64053   100078   147608   139403   163960
quotaon(ug)         60754   104726   149231   139053   165990
quotaon(ugP)        59238    93606   148921   138434   163931

- prjquota(internal) + remove-dqptr_sem patches
quota disabled      65826   111828   181486   189227   171241
quotaon(ug)         65418   107745   173584   180562   173752
quotaon(ugP)        64669   103890   169176   186426   172192


File Removal:
                     1thr     2thr     4thr     8thr    16thr
- vanilla
quota disabled     118059   169825   234661   291812   345656
quotaon(ug)        106675   135834   153532   100437    87489

- vanilla + remove-dqptr_sem patches
quota disabled     120374   168437   236818   291754   331141
quotaon(ug)        110709   161954   238333   293700   329015

- prjquota(xattr)
quota disabled     116680   161662   229190   295642   332959
quotaon(ug)        104783   134359   154950   100516    87923
quotaon(ugP)       100240   125978   108653    68286    58991

- prjquota(xattr) + remove-dqptr_sem patches
quota disabled     116281   168938   233733   286663   344002
quotaon(ug)        109775   164995   236001   299389   340683
quotaon(ugP)       113935   162979   236112   300033   356117

- prjquota(internal) + remove-dqptr_sem patches
quota disabled     119537   171565   247418   291068   350138
quotaon(ug)        121756   159580   240778   298012   342437
quotaon(ugP)       118954   168022   241206   289055   334008

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2014-09-30 20:07 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 14:04 [PATCH 0/4] quota: add project quota support Li Xi
2014-09-24 14:04 ` [PATCH 1/4] Adds general codes to enforces project quota limits Li Xi
2014-09-24 16:08   ` Jan Kara
     [not found]   ` <1411567470-31799-2-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:14     ` Christoph Hellwig
     [not found]       ` <20140924161417.GA1978-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:10         ` Jan Kara
     [not found]           ` <20140924171020.GF27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-24 17:13             ` Christoph Hellwig
     [not found]               ` <20140924171306.GA23874-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2014-09-24 17:37                 ` Jan Kara
2014-09-30 20:07     ` Jan Kara
2014-09-24 14:04 ` [PATCH 2/4] Adds project ID support for ext4 Li Xi
2014-09-24 17:11   ` Jan Kara
2014-09-25  1:09     ` Li Xi
2014-09-24 14:04 ` [PATCH 3/4] Adds project quota " Li Xi
     [not found]   ` <1411567470-31799-4-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 17:31     ` Jan Kara
     [not found]       ` <20140924173123.GH27000-+0h/O2h83AeN3ZZ/Hiejyg@public.gmane.org>
2014-09-25  1:28         ` Li Xi
     [not found]           ` <CAPTn0cB8X3DYprX-oKCu8aV5OLLfJJ2rh9YvMY7re69gi1s-LA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-25 11:55             ` Jan Kara
2014-09-24 14:04 ` [PATCH 4/4] Adds ioctl interface support for ext4 project Li Xi
2014-09-24 16:25   ` Jan Kara
2014-09-24 16:26     ` Christoph Hellwig
2014-09-24 17:01       ` Jan Kara
2014-09-25  7:59         ` Dave Chinner
2014-09-25 11:34           ` lixi
     [not found]             ` <C31A739F-4502-4B40-9AE3-F2FE49291657-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-26  0:10               ` Dave Chinner
2014-09-26  2:45                 ` Li Xi
2014-09-25 13:41           ` Theodore Ts'o
     [not found]             ` <20140925134136.GE4592-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2014-09-25 22:22               ` Dave Chinner
2014-09-25 13:52           ` Jan Kara
2014-09-25 22:42             ` Dave Chinner
2014-09-26 12:01               ` Theodore Ts'o
2014-09-29 15:55               ` Jan Kara
2014-09-25  7:26     ` Dave Chinner
     [not found]   ` <1411567470-31799-5-git-send-email-lixi-LfVdkaOWEx8@public.gmane.org>
2014-09-24 16:43     ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2014-08-01 15:48 [PATCH 0/4] quota: add project quota support Li Xi
2014-08-01 20:17 ` Jan Kara
2014-08-02  1:35   ` Li Xi
2014-08-04 14:08     ` Jan Kara
2014-08-04 14:44       ` Li Xi
2014-08-01  1:05 Li Xi
2014-08-01  1:06 ` Li Xi
2014-08-01 12:40 ` Jan Kara
2014-08-01 15:28   ` Li Xi

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).