* [PATCH 0/3] quota: RFC add extend quota types @ 2010-02-02 15:00 Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 1/3] quota: generalize quota transfer interface Dmitry Monakhov 0 siblings, 1 reply; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-02 15:00 UTC (permalink / raw) To: linux-fsdevel; +Cc: jack, Dmitry Monakhov Jens, and other people who are interesting in quota please take a look and comment the patch series. Currently only USER/GROUP quota are supported bu linux quota But sometimes it is reasonable to have other types of quota For example: 1) project_id in XFS 2) container_id in container(chroot) solutions. This patch series is aimed to extend quota interface to support different quota types. Last patch add the TREE quota type. This patch series does not contain fs-related part of tree-quota-type support, i've done this in order to not overweight the series. I'll add fs-related patches in the series on next round. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] quota: generalize quota transfer interface 2010-02-02 15:00 [PATCH 0/3] quota: RFC add extend quota types Dmitry Monakhov @ 2010-02-02 15:00 ` Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 2/3] quota: introduce get_id callback Dmitry Monakhov 2010-02-02 15:48 ` [PATCH 1/3] quota: generalize quota transfer interface Jan Kara 0 siblings, 2 replies; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-02 15:00 UTC (permalink / raw) To: linux-fsdevel; +Cc: jack, Dmitry Monakhov Current quota transfer interface support only uid/gid. This patch extend interface in order to support various quotas types The goal is accomplished without changes in most frequently used vfs_dq_transfer() func. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> --- fs/quota/dquot.c | 32 ++++++++++++++++++++------------ include/linux/quota.h | 2 +- include/linux/quotaops.h | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index f6eaf0d..3fdb668 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1638,15 +1638,13 @@ EXPORT_SYMBOL(dquot_free_inode); * This operation can block, but only after everything is updated * A transaction must be started when entering this function. */ -int dquot_transfer(struct inode *inode, struct iattr *iattr) +int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask) { qsize_t space, cur_space; qsize_t rsv_space = 0; struct dquot *transfer_from[MAXQUOTAS]; struct dquot *transfer_to[MAXQUOTAS]; int cnt, ret = QUOTA_OK; - int chuid = iattr->ia_valid & ATTR_UID && inode->i_uid != iattr->ia_uid, - chgid = iattr->ia_valid & ATTR_GID && inode->i_gid != iattr->ia_gid; char warntype_to[MAXQUOTAS]; char warntype_from_inodes[MAXQUOTAS], warntype_from_space[MAXQUOTAS]; @@ -1660,13 +1658,10 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr) transfer_to[cnt] = NULL; warntype_to[cnt] = QUOTA_NL_NOWARN; } - if (chuid) - transfer_to[USRQUOTA] = dqget(inode->i_sb, iattr->ia_uid, - USRQUOTA); - if (chgid) - transfer_to[GRPQUOTA] = dqget(inode->i_sb, iattr->ia_gid, - GRPQUOTA); - + for (cnt = 0; cnt < MAXQUOTAS; cnt++) { + if (mask & (1 << cnt)) + transfer_to[cnt] = dqget(inode->i_sb, chid[cnt], cnt); + } down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); if (IS_NOQUOTA(inode)) { /* File without quota accounting? */ up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); @@ -1742,12 +1737,25 @@ over_quota: } EXPORT_SYMBOL(dquot_transfer); -/* Wrapper for transferring ownership of an inode */ +/* Wrapper for transferring ownership of an inode for uid/gid only + * Called from FSXXX_setattr() + */ int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) { + qid_t chid[MAXQUOTAS]; + unsigned long mask = 0; + + if (iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) { + mask |= 1 << USRQUOTA; + chid[USRQUOTA] = iattr->ia_uid; + } + if (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) { + mask |= 1 << GRPQUOTA; + chid[GRPQUOTA] = iattr->ia_gid; + } if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) { vfs_dq_init(inode); - if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA) + if (inode->i_sb->dq_op->transfer(inode, chid, mask) == NO_QUOTA) return 1; } return 0; diff --git a/include/linux/quota.h b/include/linux/quota.h index 1f1a3a1..74738e9 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -301,7 +301,7 @@ struct dquot_operations { int (*alloc_inode) (const struct inode *, qsize_t); int (*free_space) (struct inode *, qsize_t); int (*free_inode) (const struct inode *, qsize_t); - int (*transfer) (struct inode *, struct iattr *); + int (*transfer) (struct inode *, qid_t *, unsigned long); int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index c0ee7c0..d459f7c 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -47,7 +47,7 @@ qsize_t dquot_get_reserved_space(struct inode *inode); int dquot_free_space(struct inode *inode, qsize_t number); int dquot_free_inode(const struct inode *inode, qsize_t number); -int dquot_transfer(struct inode *inode, struct iattr *iattr); +int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask); int dquot_commit(struct dquot *dquot); int dquot_acquire(struct dquot *dquot); int dquot_release(struct dquot *dquot); -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] quota: introduce get_id callback 2010-02-02 15:00 ` [PATCH 1/3] quota: generalize quota transfer interface Dmitry Monakhov @ 2010-02-02 15:00 ` Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 3/3] quota: add generic treeid quota support Dmitry Monakhov 2010-02-02 16:05 ` [PATCH 2/3] quota: introduce get_id callback Jan Kara 2010-02-02 15:48 ` [PATCH 1/3] quota: generalize quota transfer interface Jan Kara 1 sibling, 2 replies; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-02 15:00 UTC (permalink / raw) To: linux-fsdevel; +Cc: jack, Dmitry Monakhov During some quota oparations we have to determine quota_id for given inode according to quota_type. But only USRQUOTA/GRPQUOTA id are intermediately accessible from generic vfs-inode. This patch introduce new per_sb quota operation for this purpose. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> --- fs/ext3/super.c | 1 + fs/ext4/super.c | 1 + fs/ocfs2/quota_global.c | 1 + fs/quota/dquot.c | 26 ++++++++++++++++++-------- fs/reiserfs/super.c | 1 + include/linux/quota.h | 1 + include/linux/quotaops.h | 1 + 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 241c520..82bf9c8 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -757,6 +757,7 @@ static const struct dquot_operations ext3_quota_operations = { .free_space = dquot_free_space, .free_inode = dquot_free_inode, .transfer = dquot_transfer, + .get_id = dquot_get_id, .write_dquot = ext3_write_dquot, .acquire_dquot = ext3_acquire_dquot, .release_dquot = ext3_release_dquot, diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e2435ac..ae417a2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1025,6 +1025,7 @@ static const struct dquot_operations ext4_quota_operations = { .free_space = dquot_free_space, .free_inode = dquot_free_inode, .transfer = dquot_transfer, + .get_id = dquot_get_id, .write_dquot = ext4_write_dquot, .acquire_dquot = ext4_acquire_dquot, .release_dquot = ext4_release_dquot, diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index b437dc0..1ede78f 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -858,6 +858,7 @@ const struct dquot_operations ocfs2_quota_operations = { .free_space = dquot_free_space, .free_inode = dquot_free_inode, .transfer = dquot_transfer, + .get_id = dquot_get_id, .write_dquot = ocfs2_write_dquot, .acquire_dquot = ocfs2_acquire_dquot, .release_dquot = ocfs2_release_dquot, diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 3fdb668..36569c9 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1246,6 +1246,20 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space) return QUOTA_NL_BHARDBELOW; return QUOTA_NL_NOWARN; } + +qid_t dquot_get_id(struct inode *inode, int type) +{ + switch (type) { + case USRQUOTA: + return inode->i_uid; + case GRPQUOTA: + return inode->i_gid; + default: + BUG(); + } +} +EXPORT_SYMBOL(dquot_get_id); + /* * Initialize quota pointers in inode * We do things in a bit complicated way but by that we avoid calling @@ -1267,14 +1281,9 @@ int dquot_initialize(struct inode *inode, int type) for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (type != -1 && cnt != type) continue; - switch (cnt) { - case USRQUOTA: - id = inode->i_uid; - break; - case GRPQUOTA: - id = inode->i_gid; - break; - } + if (!sb_has_quota_active(sb, cnt)) + continue; + id = inode->i_sb->dq_op->get_id(inode, cnt); got[cnt] = dqget(sb, id, cnt); } @@ -1788,6 +1797,7 @@ const struct dquot_operations dquot_operations = { .free_space = dquot_free_space, .free_inode = dquot_free_inode, .transfer = dquot_transfer, + .get_id = dquot_get_id, .write_dquot = dquot_commit, .acquire_dquot = dquot_acquire, .release_dquot = dquot_release, diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index b4a7dd0..897f2bc 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -623,6 +623,7 @@ static const struct dquot_operations reiserfs_quota_operations = { .free_space = dquot_free_space, .free_inode = dquot_free_inode, .transfer = dquot_transfer, + .get_id = dquot_get_id, .write_dquot = reiserfs_write_dquot, .acquire_dquot = reiserfs_acquire_dquot, .release_dquot = reiserfs_release_dquot, diff --git a/include/linux/quota.h b/include/linux/quota.h index 74738e9..7f06086 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -303,6 +303,7 @@ struct dquot_operations { int (*free_inode) (const struct inode *, qsize_t); int (*transfer) (struct inode *, qid_t *, unsigned long); int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ + qid_t (*get_id)(struct inode *, int); /* Quota id for given type */ struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */ diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index d459f7c..e679fbe 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -26,6 +26,7 @@ static inline void writeout_quota_sb(struct super_block *sb, int type) sb->s_qcop->quota_sync(sb, type); } +qid_t dquot_get_id(struct inode *inode, int type); int dquot_initialize(struct inode *inode, int type); int dquot_drop(struct inode *inode); struct dquot *dqget(struct super_block *sb, unsigned int id, int type); -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] quota: add generic treeid quota support 2010-02-02 15:00 ` [PATCH 2/3] quota: introduce get_id callback Dmitry Monakhov @ 2010-02-02 15:00 ` Dmitry Monakhov 2010-02-02 16:10 ` Jan Kara 2010-02-02 16:05 ` [PATCH 2/3] quota: introduce get_id callback Jan Kara 1 sibling, 1 reply; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-02 15:00 UTC (permalink / raw) To: linux-fsdevel; +Cc: jack, Dmitry Monakhov Just introduce new and update macros. It will be used later. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> --- fs/quota/dquot.c | 5 +++++ fs/quota/quotaio_v2.h | 4 +++- include/linux/quota.h | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 36569c9..9fbf301 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1045,6 +1045,11 @@ static int need_print_warning(struct dquot *dquot) return current_fsuid() == dquot->dq_id; case GRPQUOTA: return in_group_p(dquot->dq_id); + case TRQUOTA: + /* XXX: Currently there is no way to understand + which tree this task belonges to, So print + a warn message unconditionally. -dmon */ + return 1; } return 0; } diff --git a/fs/quota/quotaio_v2.h b/fs/quota/quotaio_v2.h index f1966b4..ca6f1ff 100644 --- a/fs/quota/quotaio_v2.h +++ b/fs/quota/quotaio_v2.h @@ -13,12 +13,14 @@ */ #define V2_INITQMAGICS {\ 0xd9c01f11, /* USRQUOTA */\ - 0xd9c01927 /* GRPQUOTA */\ + 0xd9c01927, /* GRPQUOTA */\ + 0xd9c03f14 /* TRQUOTA */\ } #define V2_INITQVERSIONS {\ 1, /* USRQUOTA */\ 1 /* GRPQUOTA */\ + 1 /* TRPQUOTA */\ } /* First generic header */ diff --git a/include/linux/quota.h b/include/linux/quota.h index 7f06086..dc6d84e 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -36,11 +36,12 @@ #include <linux/errno.h> #include <linux/types.h> -#define __DQUOT_VERSION__ "dquot_6.5.2" +#define __DQUOT_VERSION__ "dquot_7.0.0" -#define MAXQUOTAS 2 +#define MAXQUOTAS 3 #define USRQUOTA 0 /* element used for user quotas */ #define GRPQUOTA 1 /* element used for group quotas */ +#define TRQUOTA 2 /* element used for directory tree quotas */ /* * Definitions for the default names of the quotas files. @@ -48,6 +49,7 @@ #define INITQFNAMES { \ "user", /* USRQUOTA */ \ "group", /* GRPQUOTA */ \ + "tree", /* TRQUOTA */ \ "undefined", \ }; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] quota: add generic treeid quota support 2010-02-02 15:00 ` [PATCH 3/3] quota: add generic treeid quota support Dmitry Monakhov @ 2010-02-02 16:10 ` Jan Kara 0 siblings, 0 replies; 10+ messages in thread From: Jan Kara @ 2010-02-02 16:10 UTC (permalink / raw) To: Dmitry Monakhov; +Cc: linux-fsdevel, jack On Tue 02-02-10 18:00:25, Dmitry Monakhov wrote: > Just introduce new and update macros. > It will be used later. ... > #define V2_INITQVERSIONS {\ > 1, /* USRQUOTA */\ > 1 /* GRPQUOTA */\ > + 1 /* TRPQUOTA */\ > } This won't compile... > /* First generic header */ > diff --git a/include/linux/quota.h b/include/linux/quota.h > index 7f06086..dc6d84e 100644 > --- a/include/linux/quota.h > +++ b/include/linux/quota.h > @@ -36,11 +36,12 @@ > #include <linux/errno.h> > #include <linux/types.h> > > -#define __DQUOT_VERSION__ "dquot_6.5.2" > +#define __DQUOT_VERSION__ "dquot_7.0.0" ;-) Hmm, not that this version would matter but 6.6.0 would look more logical to me. But I'll leave that up to you. Otherwise I'm fine with the patch. Honza -- Jan Kara <jack@suse.cz> SUSE Labs, CR ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] quota: introduce get_id callback 2010-02-02 15:00 ` [PATCH 2/3] quota: introduce get_id callback Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 3/3] quota: add generic treeid quota support Dmitry Monakhov @ 2010-02-02 16:05 ` Jan Kara 2010-02-03 5:38 ` Dmitry Monakhov 1 sibling, 1 reply; 10+ messages in thread From: Jan Kara @ 2010-02-02 16:05 UTC (permalink / raw) To: Dmitry Monakhov; +Cc: linux-fsdevel, jack On Tue 02-02-10 18:00:24, Dmitry Monakhov wrote: > During some quota oparations we have to determine quota_id for given inode > according to quota_type. But only USRQUOTA/GRPQUOTA id are intermediately > accessible from generic vfs-inode. This patch introduce new per_sb quota > operation for this purpose. Hmm, but you do not intend to ever change what is returned for USRQUOTA and GRPQUOTA, do you? So we could just have something like static qid_t generic_get_id(struct inode *inode, int qtype) { switch (qtype) { case USRQUOTA: return inode->i_uid; case GRPQUOTA: return inode->i_gid; default: return inode->i_sb->dq_op->get_id(inode, qtype); } } It's not as elegant as your solution but doing an indirect call to read a value directly accessible (which will be a common case) just seems lame... Honza -- Jan Kara <jack@suse.cz> SUSE Labs, CR ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] quota: introduce get_id callback 2010-02-02 16:05 ` [PATCH 2/3] quota: introduce get_id callback Jan Kara @ 2010-02-03 5:38 ` Dmitry Monakhov 2010-02-03 10:47 ` Jan Kara 0 siblings, 1 reply; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-03 5:38 UTC (permalink / raw) To: Jan Kara; +Cc: linux-fsdevel Jan Kara <jack@suse.cz> writes: > On Tue 02-02-10 18:00:24, Dmitry Monakhov wrote: >> During some quota oparations we have to determine quota_id for given inode >> according to quota_type. But only USRQUOTA/GRPQUOTA id are intermediately >> accessible from generic vfs-inode. This patch introduce new per_sb quota >> operation for this purpose. > Hmm, but you do not intend to ever change what is returned for USRQUOTA > and GRPQUOTA, do you? So we could just have something like Hmm... In fact i've considered this option. For example: In case of containers(trees), each container administrator want user/group quota to work inside it's container. I've considered following approach: 1) enlarge qid_t to u64 2) encode quota_uid and group_uid like follows: quid = treeid << 32 + uid qgid = treeid << 32 + gid 3) Introduce new 64-bit quota format file to support wide qid_t. Currently i dont know better way to support user/group quota inside tree. It does not affect old fs-internal code, just replace all hard-coded (int => u64) in fs/quota-XXX. Old 32-bit quota users not affected because qid_t will be shrink ed on quota-save for old(most of) users. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] quota: introduce get_id callback 2010-02-03 5:38 ` Dmitry Monakhov @ 2010-02-03 10:47 ` Jan Kara 2010-02-03 19:54 ` Dmitry Monakhov 0 siblings, 1 reply; 10+ messages in thread From: Jan Kara @ 2010-02-03 10:47 UTC (permalink / raw) To: Dmitry Monakhov; +Cc: Jan Kara, linux-fsdevel On Wed 03-02-10 08:38:15, Dmitry Monakhov wrote: > Jan Kara <jack@suse.cz> writes: > > > On Tue 02-02-10 18:00:24, Dmitry Monakhov wrote: > >> During some quota oparations we have to determine quota_id for given inode > >> according to quota_type. But only USRQUOTA/GRPQUOTA id are intermediately > >> accessible from generic vfs-inode. This patch introduce new per_sb quota > >> operation for this purpose. > > Hmm, but you do not intend to ever change what is returned for USRQUOTA > > and GRPQUOTA, do you? So we could just have something like > Hmm... In fact i've considered this option. For example: > In case of containers(trees), each container administrator want > user/group quota to work inside it's container. I've considered > following approach: > 1) enlarge qid_t to u64 > 2) encode quota_uid and group_uid like follows: > quid = treeid << 32 + uid > qgid = treeid << 32 + gid > 3) Introduce new 64-bit quota format file to support wide qid_t. > > Currently i dont know better way to support user/group quota > inside tree. It does not affect old fs-internal code, just replace > all hard-coded (int => u64) in fs/quota-XXX. Old 32-bit quota users > not affected because qid_t will be shrink ed on quota-save for > old(most of) users. I see. But from what you write it seems to me that actually you'd like a separate filesystem for each container - you'll get a separate quota files for each container (so no need for id mapping) and a natural total limitation of how much the container can use (the filesystem size). Now I understand that having really a separate filesystem for each container is impractical when you want to change sizes of each container and also the overhead of separate filesystem might be too big. But I'd like to understand your needs... Because it might be feasible to introduce a support for lightweight "subfilesystems" of a filesystem if that would solve your case... Honza -- Jan Kara <jack@suse.cz> SUSE Labs, CR ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] quota: introduce get_id callback 2010-02-03 10:47 ` Jan Kara @ 2010-02-03 19:54 ` Dmitry Monakhov 0 siblings, 0 replies; 10+ messages in thread From: Dmitry Monakhov @ 2010-02-03 19:54 UTC (permalink / raw) To: Jan Kara; +Cc: linux-fsdevel On Wed, Feb 3, 2010 at 1:47 PM, Jan Kara <jack@suse.cz> wrote: > On Wed 03-02-10 08:38:15, Dmitry Monakhov wrote: >> Jan Kara <jack@suse.cz> writes: >> >> > On Tue 02-02-10 18:00:24, Dmitry Monakhov wrote: >> >> During some quota oparations we have to determine quota_id for given inode >> >> according to quota_type. But only USRQUOTA/GRPQUOTA id are intermediately >> >> accessible from generic vfs-inode. This patch introduce new per_sb quota >> >> operation for this purpose. >> > Hmm, but you do not intend to ever change what is returned for USRQUOTA >> > and GRPQUOTA, do you? So we could just have something like >> Hmm... In fact i've considered this option. For example: >> In case of containers(trees), each container administrator want >> user/group quota to work inside it's container. I've considered >> following approach: >> 1) enlarge qid_t to u64 >> 2) encode quota_uid and group_uid like follows: >> quid = treeid << 32 + uid >> qgid = treeid << 32 + gid >> 3) Introduce new 64-bit quota format file to support wide qid_t. >> >> Currently i dont know better way to support user/group quota >> inside tree. It does not affect old fs-internal code, just replace >> all hard-coded (int => u64) in fs/quota-XXX. Old 32-bit quota users >> not affected because qid_t will be shrink ed on quota-save for >> old(most of) users. > I see. But from what you write it seems to me that actually you'd like > a separate filesystem for each container - you'll get a separate quota > files for each container (so no need for id mapping) and a natural total > limitation of how much the container can use (the filesystem size). > Now I understand that having really a separate filesystem for each > container is impractical when you want to change sizes of each container > and also the overhead of separate filesystem might be too big. But I'd like > to understand your needs... Because it might be feasible to introduce > a support for lightweight "subfilesystems" of a filesystem if that would > solve your case... Sorry for a long response. Some weeks ago i've prepared a paper about quota-tree feature with patch-queue http://2ka.mipt.ru/~mov/quota.html Currently that patch-queue is mostly obsoleted and may be interested only in history reasons. *Container* Container is a set of resources. Each container isolated from another as much as possible. Container has its own root tree. Containers tree is exported inside CT by numerous possible ways (bind-mount, virtual-stack-fs, chroot) Container's root are independent tree(subtree of bare-metal host filesystem's tree) usually they organized like follows /ct_roots/CT_${ID}/TREE_CONTENT In terms of simplicity you may think of container as a secure CHROOT: Bare-metal host file hierarchy: find /ct-roots /ct-roots/ /ct-1/bin, etc, ..... /ct-2/bin, etc, .... /ct-400/bin,etc ..... enter to the container: chroot /ct-roots/ct-1 /bin/bash There are many reasons to keep this trees separate one from another(no hardlinks) - inode attr: If inode has links in A n B trees. And A-user call chown() for this inode, then B's owner will be surprised. The only way to overcome this is to virtualize inode atributes (for each tree) which is madness IMHO. - checkpoint/restore/online-backup: This is like suspend resume for VM, but in this case only container's process are stopped(freezed) for some time. After CT's process are stopped we may create backup CT's tree without freezing FS as a whole. The only way to implement journalled quota for containers is to implement it on native fs level. "Containers directory tree-id" assumptions: (1) Tree id is embedded inside inode ( inside xattr ) (2) Tree id is inherent from parent dir (3) Inode can not belongs to different directory trees In your terms: "subfilesystem" of a filesystem is: 1) is subtree 2) all content starting from subtree root includes in to this subtree 3) Thre is no intersection between two different subfilesystems About quota files: It is totally impractical to use separate quota files for each container because each container requires 2 quota files, Recent servers allow to run about 1000 of containers, so it is madness to has 2*1000 quota files , just think about orphan-list cleanup after unclean umount :). What's why i whant to encode tree_uid as (treeid << 32 + uid). This allow us to use just 3 quota files.(wide_user, wide_group, treeid) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] quota: generalize quota transfer interface 2010-02-02 15:00 ` [PATCH 1/3] quota: generalize quota transfer interface Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 2/3] quota: introduce get_id callback Dmitry Monakhov @ 2010-02-02 15:48 ` Jan Kara 1 sibling, 0 replies; 10+ messages in thread From: Jan Kara @ 2010-02-02 15:48 UTC (permalink / raw) To: Dmitry Monakhov; +Cc: linux-fsdevel, jack On Tue 02-02-10 18:00:23, Dmitry Monakhov wrote: > Current quota transfer interface support only uid/gid. > This patch extend interface in order to support various quotas types > The goal is accomplished without changes in most frequently used > vfs_dq_transfer() func. This patch is fine with me... Honza -- Jan Kara <jack@suse.cz> SUSE Labs, CR ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-02-03 19:54 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-02-02 15:00 [PATCH 0/3] quota: RFC add extend quota types Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 1/3] quota: generalize quota transfer interface Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 2/3] quota: introduce get_id callback Dmitry Monakhov 2010-02-02 15:00 ` [PATCH 3/3] quota: add generic treeid quota support Dmitry Monakhov 2010-02-02 16:10 ` Jan Kara 2010-02-02 16:05 ` [PATCH 2/3] quota: introduce get_id callback Jan Kara 2010-02-03 5:38 ` Dmitry Monakhov 2010-02-03 10:47 ` Jan Kara 2010-02-03 19:54 ` Dmitry Monakhov 2010-02-02 15:48 ` [PATCH 1/3] quota: generalize quota transfer interface Jan Kara
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).