diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/fs/dquot.c linux-2.6.17.11-vs2.1.1-rc30.1/fs/dquot.c --- linux-2.6.17.11-vs2.1.1-rc30/fs/dquot.c 2006-07-09 17:06:49 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/fs/dquot.c 2006-08-25 19:19:54 +0200 @@ -420,7 +420,7 @@ out_dqlock: * just deleted or pruned by prune_icache() (those are not attached to any * list). We have to wait for such users. */ -static void invalidate_dquots(struct dqhash *hash, int type) +void invalidate_dquots(struct dqhash *hash, int type) { struct dquot *dquot, *tmp; @@ -467,82 +467,6 @@ restart: spin_unlock(&dq_list_lock); } - -/* Dquota Hash Management Functions */ - -static LIST_HEAD(dqhash_list); - -struct dqhash *new_dqhash(struct super_block *sb, unsigned int id) -{ - struct dqhash *hash; - int err; - - err = -ENOMEM; - hash = kmalloc(sizeof(struct dqhash), GFP_USER); - if (!hash) - goto out; - - memset(hash, 0, sizeof(struct dqhash)); - hash->dqh_id = id; - atomic_set(&hash->dqh_count, 1); - - INIT_LIST_HEAD(&hash->dqh_list); - - mutex_init(&hash->dqh_dqopt.dqio_mutex); - mutex_init(&hash->dqh_dqopt.dqonoff_mutex); - init_rwsem(&hash->dqh_dqopt.dqptr_sem); - hash->dqh_qop = sb->s_qop; - hash->dqh_qcop = sb->s_qcop; - hash->dqh_sb = sb; - - lock_kernel(); - list_add(&hash->dqh_list, &dqhash_list); - unlock_kernel(); - vxdprintk(VXD_CBIT(misc, 0), - "new_dqhash: %p [#0x%08x]", hash, hash->dqh_id); - return hash; - - // kfree(hash); -out: - return ERR_PTR(err); -} - -void destroy_dqhash(struct dqhash *hash) -{ - int cnt; - - vxdprintk(VXD_CBIT(misc, 0), - "destroy_dqhash: %p [#0x%08x] c=%d", - hash, hash->dqh_id, atomic_read(&hash->dqh_count)); - lock_kernel(); - list_del_init(&hash->dqh_list); - unlock_kernel(); - for (cnt = 0; cnt < MAXQUOTAS; cnt++) /* should not be required anymore! */ - invalidate_dquots(hash, cnt); - kfree(hash); -} - - -struct dqhash *find_dqhash(unsigned int id) -{ - struct list_head *head; - struct dqhash *hash; - - lock_kernel(); - list_for_each(head, &dqhash_list) { - hash = list_entry(head, struct dqhash, dqh_list); - if (hash->dqh_id == id) - goto dqh_found; - } - unlock_kernel(); - return NULL; - -dqh_found: - unlock_kernel(); - return dqhget(hash); -} - - int vfs_quota_sync(struct dqhash *hash, int type) { struct list_head *dirty; diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/fs/inode.c linux-2.6.17.11-vs2.1.1-rc30.1/fs/inode.c --- linux-2.6.17.11-vs2.1.1-rc30/fs/inode.c 2006-07-09 17:06:49 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/fs/inode.c 2006-08-25 19:33:27 +0200 @@ -130,8 +130,10 @@ static struct inode *alloc_inode(struct inode->i_blocks = 0; inode->i_bytes = 0; inode->i_generation = 0; -#ifdef CONFIG_QUOTA +#ifdef CONFIG_QUOTACTL inode->i_dqh = dqhget(sb->s_dqh); +#endif +#ifdef CONFIG_QUOTA memset(&inode->i_dquot, 0, sizeof(inode->i_dquot)); #endif inode->i_pipe = NULL; diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/fs/quota.c linux-2.6.17.11-vs2.1.1-rc30.1/fs/quota.c --- linux-2.6.17.11-vs2.1.1-rc30/fs/quota.c 2006-07-09 17:06:50 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/fs/quota.c 2006-08-25 19:41:39 +0200 @@ -21,6 +21,84 @@ #include <linux/blkdev.h> #include <linux/vserver/debug.h> + +/* Dquota Hash Management Functions */ + +static LIST_HEAD(dqhash_list); + +struct dqhash *new_dqhash(struct super_block *sb, unsigned int id) +{ + struct dqhash *hash; + int err; + + err = -ENOMEM; + hash = kmalloc(sizeof(struct dqhash), GFP_USER); + if (!hash) + goto out; + + memset(hash, 0, sizeof(struct dqhash)); + hash->dqh_id = id; + atomic_set(&hash->dqh_count, 1); + + INIT_LIST_HEAD(&hash->dqh_list); + + mutex_init(&hash->dqh_dqopt.dqio_mutex); + mutex_init(&hash->dqh_dqopt.dqonoff_mutex); + init_rwsem(&hash->dqh_dqopt.dqptr_sem); + hash->dqh_qop = sb->s_qop; + hash->dqh_qcop = sb->s_qcop; + hash->dqh_sb = sb; + + lock_kernel(); + list_add(&hash->dqh_list, &dqhash_list); + unlock_kernel(); + vxdprintk(VXD_CBIT(misc, 0), + "new_dqhash: %p [#0x%08x]", hash, hash->dqh_id); + return hash; + + // kfree(hash); +out: + return ERR_PTR(err); +} + +void invalidate_dquots(struct dqhash *, int); + +void destroy_dqhash(struct dqhash *hash) +{ + vxdprintk(VXD_CBIT(misc, 0), + "destroy_dqhash: %p [#0x%08x] c=%d", + hash, hash->dqh_id, atomic_read(&hash->dqh_count)); + lock_kernel(); + list_del_init(&hash->dqh_list); + unlock_kernel(); +#ifdef CONFIG_QUOTA + for (int cnt = 0; cnt < MAXQUOTAS; cnt++) /* should not be required anymore! */ + invalidate_dquots(hash, cnt); +#endif + kfree(hash); +} + + +struct dqhash *find_dqhash(unsigned int id) +{ + struct list_head *head; + struct dqhash *hash; + + lock_kernel(); + list_for_each(head, &dqhash_list) { + hash = list_entry(head, struct dqhash, dqh_list); + if (hash->dqh_id == id) + goto dqh_found; + } + unlock_kernel(); + return NULL; + +dqh_found: + unlock_kernel(); + return dqhget(hash); +} + + /* Check validity of generic quotactl commands */ static int generic_quotactl_valid(struct dqhash *hash, int type, int cmd, qid_t id) { diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/fs/xfs/linux-2.6/xfs_super.c linux-2.6.17.11-vs2.1.1-rc30.1/fs/xfs/linux-2.6/xfs_super.c --- linux-2.6.17.11-vs2.1.1-rc30/fs/xfs/linux-2.6/xfs_super.c 2006-07-09 17:07:13 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/fs/xfs/linux-2.6/xfs_super.c 2006-08-25 19:44:21 +0200 @@ -859,7 +859,7 @@ xfs_fs_fill_super( sb->s_export_op = &xfs_export_operations; #endif sb->s_qcop = &xfs_quotactl_operations; -#ifdef CONFIG_QUOTA +#ifdef CONFIG_QUOTACTL sb->s_dqh->dqh_qcop = &xfs_quotactl_operations; #endif sb->s_op = &xfs_super_operations; diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/include/linux/fs.h linux-2.6.17.11-vs2.1.1-rc30.1/include/linux/fs.h --- linux-2.6.17.11-vs2.1.1-rc30/include/linux/fs.h 2006-07-09 17:07:13 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/include/linux/fs.h 2006-08-25 17:51:04 +0200 @@ -522,8 +522,10 @@ struct inode { struct file_lock *i_flock; struct address_space *i_mapping; struct address_space i_data; -#ifdef CONFIG_QUOTA +#ifdef CONFIG_QUOTACTL struct dqhash *i_dqh; +#endif +#ifdef CONFIG_QUOTA struct dquot *i_dquot[MAXQUOTAS]; #endif /* These three should probably be a union */ diff -NurpP --minimal linux-2.6.17.11-vs2.1.1-rc30/include/linux/quota.h linux-2.6.17.11-vs2.1.1-rc30.1/include/linux/quota.h --- linux-2.6.17.11-vs2.1.1-rc30/include/linux/quota.h 2006-07-09 17:07:13 +0200 +++ linux-2.6.17.11-vs2.1.1-rc30.1/include/linux/quota.h 2006-08-25 17:37:22 +0200 @@ -338,8 +338,7 @@ struct dqhash { struct hlist_head *dqh_hash; }; -#if defined(CONFIG_QUOTA) - +#ifdef CONFIG_QUOTACTL struct dqhash *new_dqhash(struct super_block *, unsigned int); void destroy_dqhash(struct dqhash *); @@ -359,7 +358,7 @@ static inline struct dqhash *dqhget(stru return hash; } -#else /* CONFIG_QUOTA */ +#else /* CONFIG_QUOTACTL */ #define new_dqhash(sb, dqdom) (0) #define find_dqhash(dqdom) (0) @@ -368,7 +367,7 @@ static inline struct dqhash *dqhget(stru #define dqhput(hash) do { } while(0) #define dqhget(hash) (hash) -#endif /* CONFIG_QUOTA */ +#endif /* CONFIG_QUOTACTL */ #else