diff mbox

[V5,1/5] quota: Add reservation support for delayed block allocation

Message ID 1231893775.8719.22.camel@mingming-laptop
State Not Applicable, archived
Headers show

Commit Message

Mingming Cao Jan. 14, 2009, 12:42 a.m. UTC
在 2009-01-13二的 20:09 +0100,Jan Kara写道:
> On Tue 13-01-09 10:53:17, Mingming Cao wrote:
> > 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
> > > On Mon 12-01-09 16:19:06, Mingming Cao wrote:
> > > > Thanks for your review and suggestions. All points are taken. I have
> > > > updated the quota patches.I am attaching the updated patch here just for
> > > > your review.
> > > > 
> > > > I am waiting for the ext4 tree to updated to rebase the whole series
> > > > against 2.6.29-rc1 plus ext4 patch queue.  
> > > > 
> > >   <snip>
> > > > Quota: Add quota reservation support
> > > > 
> > > > Delayed allocation defers the block allocation at the dirty pages
> > > > flush-out time, doing quota charge/check at that time is too late.
> > > > But we can't charge the quota blocks until blocks are really allocated,
> > > > otherwise users could get overcharged after reboot from system crash.
> > > > 
> > > > This patch adds quota reservation for delayed llocation. Quota blocks
> > > > are reserved in memory, inode and quota won't gets dirtied until later
> > > > block allocation time.
> > > > 
> > > > Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> > >   The patch is fine. You can add
> > > 
> > >   Acked-by: Jan Kara <jack@suse.cz>
> > > 
> > >   How do you want to merge the patches? Via ext4 patch queue?
> > > There's one generic quota patch that I also need to push to fix some OCFS2
> > > issue and it collides with your patchset. And also there're further
> > > cleanups in quota code which are long overdue which I want to base on all
> > > other patches. So I've decided to setup quota git tree. I'll pull in your
> > > two VFS quota patches. Will that work for you?
> > 
> > I think a quota tree is the best place to hold all these quota changes.
> > The ext4 part probably make sense to stay together with the vfs changes,
> > but it will need to coordinate with Ted's ext4 tree.  Ted, what do you
> > think?
>   Yes. The best would be if could pull quota changes from my tree but you
> could also just carry your two patches and only leave merging them with
> vanilla to me.
> 
Sure, that works for me.

> > BTW, there are other two quota cleanup patches that you have already
> > acked. I will sent the 2.6.29-rc1 based version.
>   Yes. Thanks.
> 

Attached are all the 5 2.6.29-rc1 based patches, including the two
cleanups.

Thanks!

Mingming

Comments

Jan Kara Jan. 14, 2009, 3:45 p.m. UTC | #1
On Tue 13-01-09 16:42:55, Mingming Cao wrote:
> Attached are all the 5 2.6.29-rc1 based patches, including the two
> cleanups.
> 
> Thanks!
  OK, merged the two cleanups.

									Honza
Gui Xiaohua Feb. 3, 2009, 7:11 a.m. UTC | #2
Hi mingming:
I have tested your patch in 2.6.29-rc1. The sum of characters which 
i had written were fewer than the block softlimit,but a warning occurs.

# edquota -u quser1
Disk quotas for user quser1 (uid 504):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/sda7                         0          5         10          0        5       10

Steps to reproduce:

# mkfs.ext4 /dev/sda7
# mount /dev/sda7 /mnt -t ext4
# setquota -u quser1 5 10 5 10 /mnt

Then log in as quser1
$ cd /mnt
$ ll
total 20
-rw------- 1 root root  7168 01-20 01:51 aquota.user
drwx------ 2 root root 12288 01-20 01:44 lost+found
$ vim dd.sh

I written some characters,such as abc,then i do wq,
the warning occurs likes below:
"dd.sh" sda7: write failed, user block limit reached.

Mingming Cao 写道:
> 在 2009-01-13二的 20:09 +0100,Jan Kara写道:
>> On Tue 13-01-09 10:53:17, Mingming Cao wrote:
>>> 在 2009-01-13二的 16:37 +0100,Jan Kara写道:
>>>> On Mon 12-01-09 16:19:06, Mingming Cao wrote:
>>>>> Thanks for your review and suggestions. All points are taken. I have
>>>>> updated the quota patches.I am attaching the updated patch here just for
>>>>> your review.
>>>>>
>>>>> I am waiting for the ext4 tree to updated to rebase the whole series
>>>>> against 2.6.29-rc1 plus ext4 patch queue.  
>>>>>
>>>>   <snip>
>>>>> Quota: Add quota reservation support
>>>>>
>>>>> Delayed allocation defers the block allocation at the dirty pages
>>>>> flush-out time, doing quota charge/check at that time is too late.
>>>>> But we can't charge the quota blocks until blocks are really allocated,
>>>>> otherwise users could get overcharged after reboot from system crash.
>>>>>
>>>>> This patch adds quota reservation for delayed llocation. Quota blocks
>>>>> are reserved in memory, inode and quota won't gets dirtied until later
>>>>> block allocation time.
>>>>>
>>>>> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>>>>   The patch is fine. You can add
>>>>
>>>>   Acked-by: Jan Kara <jack@suse.cz>
>>>>
>>>>   How do you want to merge the patches? Via ext4 patch queue?
>>>> There's one generic quota patch that I also need to push to fix some OCFS2
>>>> issue and it collides with your patchset. And also there're further
>>>> cleanups in quota code which are long overdue which I want to base on all
>>>> other patches. So I've decided to setup quota git tree. I'll pull in your
>>>> two VFS quota patches. Will that work for you?
>>> I think a quota tree is the best place to hold all these quota changes.
>>> The ext4 part probably make sense to stay together with the vfs changes,
>>> but it will need to coordinate with Ted's ext4 tree.  Ted, what do you
>>> think?
>>   Yes. The best would be if could pull quota changes from my tree but you
>> could also just carry your two patches and only leave merging them with
>> vanilla to me.
>>
> Sure, that works for me.
> 
>>> BTW, there are other two quota cleanup patches that you have already
>>> acked. I will sent the 2.6.29-rc1 based version.
>>   Yes. Thanks.
>>
> 
> Attached are all the 5 2.6.29-rc1 based patches, including the two
> cleanups.
> 
> Thanks!
> 
> Mingming
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara Feb. 19, 2009, 2:15 p.m. UTC | #3
Hi,

> I have tested your patch in 2.6.29-rc1. The sum of characters which 
> i had written were fewer than the block softlimit,but a warning occurs.
  I haven't seen any reply to this. Did it get resolved?

> # edquota -u quser1
> Disk quotas for user quser1 (uid 504):
>   Filesystem                   blocks       soft       hard     inodes     soft     hard
>   /dev/sda7                         0          5         10          0        5       10
> 
> Steps to reproduce:
> 
> # mkfs.ext4 /dev/sda7
> # mount /dev/sda7 /mnt -t ext4
> # setquota -u quser1 5 10 5 10 /mnt
> 
> Then log in as quser1
> $ cd /mnt
> $ ll
> total 20
> -rw------- 1 root root  7168 01-20 01:51 aquota.user
> drwx------ 2 root root 12288 01-20 01:44 lost+found
> $ vim dd.sh
  Well, vim creates backup files and possibly some other stuff so it's
quite possible that the block limit of 10 KB has been exceeded. Could
you verify that e.g.: echo "abc" >dd.sh
works as expected (you should then see 4KB used).

> I written some characters,such as abc,then i do wq,
> the warning occurs likes below:
> "dd.sh" sda7: write failed, user block limit reached.

									Honza
diff mbox

Patch

quota: Move EXPORT_SYMBOL immediatlely next to the functions/varibles

From: Mingming Cao <cmm@us.ibm.com>

According to checkpatch: EXPORT_SYMBOL(foo); should immediately follow its
 function/variable

Signed-off-by: Mingming Cao <cmm@us.ibm.com>
---
 fs/dquot.c |   73 +++++++++++++++++++++++++++++--------------------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

Index: linux-2.6.29-rc1/fs/dquot.c
===================================================================
--- linux-2.6.29-rc1.orig/fs/dquot.c	2009-01-12 16:28:57.000000000 -0800
+++ linux-2.6.29-rc1/fs/dquot.c	2009-01-12 16:44:57.000000000 -0800
@@ -127,6 +127,7 @@ 
 
 static DEFINE_SPINLOCK(dq_list_lock);
 DEFINE_SPINLOCK(dq_data_lock);
+EXPORT_SYMBOL(dq_data_lock);
 
 static char *quotatypes[] = INITQFNAMES;
 static struct quota_format_type *quota_formats;	/* List of registered formats */
@@ -143,6 +144,7 @@  int register_quota_format(struct quota_f
 	spin_unlock(&dq_list_lock);
 	return 0;
 }
+EXPORT_SYMBOL(register_quota_format);
 
 void unregister_quota_format(struct quota_format_type *fmt)
 {
@@ -154,6 +156,7 @@  void unregister_quota_format(struct quot
 		*actqf = (*actqf)->qf_next;
 	spin_unlock(&dq_list_lock);
 }
+EXPORT_SYMBOL(unregister_quota_format);
 
 static struct quota_format_type *find_quota_format(int id)
 {
@@ -210,6 +213,7 @@  static unsigned int dq_hash_bits, dq_has
 static struct hlist_head *dquot_hash;
 
 struct dqstats dqstats;
+EXPORT_SYMBOL(dqstats);
 
 static inline unsigned int
 hashfn(const struct super_block *sb, unsigned int id, int type)
@@ -304,6 +308,7 @@  int dquot_mark_dquot_dirty(struct dquot 
 	spin_unlock(&dq_list_lock);
 	return 0;
 }
+EXPORT_SYMBOL(dquot_mark_dquot_dirty);
 
 /* This function needs dq_list_lock */
 static inline int clear_dquot_dirty(struct dquot *dquot)
@@ -355,6 +360,7 @@  out_iolock:
 	mutex_unlock(&dquot->dq_lock);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_acquire);
 
 /*
  *	Write dquot to disk
@@ -384,6 +390,7 @@  out_sem:
 	mutex_unlock(&dqopt->dqio_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_commit);
 
 /*
  *	Release dquot
@@ -412,6 +419,7 @@  out_dqlock:
 	mutex_unlock(&dquot->dq_lock);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_release);
 
 void dquot_destroy(struct dquot *dquot)
 {
@@ -511,6 +519,7 @@  out:
 	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_scan_active);
 
 int vfs_quota_sync(struct super_block *sb, int type)
 {
@@ -558,6 +567,7 @@  int vfs_quota_sync(struct super_block *s
 
 	return 0;
 }
+EXPORT_SYMBOL(vfs_quota_sync);
 
 /* Free unused dquots from cache */
 static void prune_dqcache(int count)
@@ -668,6 +678,7 @@  we_slept:
 	put_dquot_last(dquot);
 	spin_unlock(&dq_list_lock);
 }
+EXPORT_SYMBOL(dqput);
 
 struct dquot *dquot_alloc(struct super_block *sb, int type)
 {
@@ -713,6 +724,7 @@  int dquot_is_cached(struct super_block *
 	spin_unlock(&dq_list_lock);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_is_cached);
 
 /*
  * Get reference to dquot
@@ -766,6 +778,7 @@  we_slept:
 
 	return dquot;
 }
+EXPORT_SYMBOL(dqget);
 
 static int dqinit_needed(struct inode *inode, int type)
 {
@@ -1263,6 +1276,7 @@  out_err:
 	up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_initialize);
 
 /*
  * 	Release all quotas referenced by inode
@@ -1280,6 +1294,7 @@  int dquot_drop_locked(struct inode *inod
 	}
 	return 0;
 }
+EXPORT_SYMBOL(dquot_drop_locked);
 
 int dquot_drop(struct inode *inode)
 {
@@ -1288,6 +1303,7 @@  int dquot_drop(struct inode *inode)
 	up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return 0;
 }
+EXPORT_SYMBOL(dquot_drop);
 
 /* Wrapper to remove references to quota structures from inode */
 void vfs_dq_drop(struct inode *inode)
@@ -1310,6 +1326,7 @@  void vfs_dq_drop(struct inode *inode)
 			inode->i_sb->dq_op->drop(inode);
 	}
 }
+EXPORT_SYMBOL(vfs_dq_drop);
 
 /*
  * Following four functions update i_blocks+i_bytes fields and
@@ -1390,6 +1407,7 @@  out_unlock:
 out:
 	return ret;
 }
+EXPORT_SYMBOL(dquot_alloc_space);
 
 int dquot_reserve_space(struct inode *inode, qsize_t number, int warn)
 {
@@ -1454,6 +1472,7 @@  warn_put_all:
 	up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_alloc_inode);
 
 int dquot_claim_space(struct inode *inode, qsize_t number)
 {
@@ -1560,6 +1579,7 @@  out_sub:
 	up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return QUOTA_OK;
 }
+EXPORT_SYMBOL(dquot_free_space);
 
 /*
  * This operation can block, but only after everything is updated
@@ -1596,6 +1616,7 @@  int dquot_free_inode(const struct inode 
 	up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return QUOTA_OK;
 }
+EXPORT_SYMBOL(dquot_free_inode);
 
 /*
  * call back function, get reserved quota space from underlying fs
@@ -1725,6 +1746,7 @@  warn_put_all:
 	up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_transfer);
 
 /* Wrapper for transferring ownership of an inode */
 int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
@@ -1736,7 +1758,7 @@  int vfs_dq_transfer(struct inode *inode,
 	}
 	return 0;
 }
-
+EXPORT_SYMBOL(vfs_dq_transfer);
 
 /*
  * Write info of quota file to disk
@@ -1751,6 +1773,7 @@  int dquot_commit_info(struct super_block
 	mutex_unlock(&dqopt->dqio_mutex);
 	return ret;
 }
+EXPORT_SYMBOL(dquot_commit_info);
 
 /*
  * Definitions of diskquota operations.
@@ -1898,13 +1921,14 @@  put_inodes:
 		}
 	return ret;
 }
+EXPORT_SYMBOL(vfs_quota_disable);
 
 int vfs_quota_off(struct super_block *sb, int type, int remount)
 {
 	return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED :
 				 (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED));
 }
-
+EXPORT_SYMBOL(vfs_quota_off);
 /*
  *	Turn quotas on on a device
  */
@@ -2057,6 +2081,7 @@  int vfs_quota_on_path(struct super_block
 					     DQUOT_LIMITS_ENABLED);
 	return error;
 }
+EXPORT_SYMBOL(vfs_quota_on_path);
 
 int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
 		 int remount)
@@ -2074,6 +2099,7 @@  int vfs_quota_on(struct super_block *sb,
 	}
 	return error;
 }
+EXPORT_SYMBOL(vfs_quota_on);
 
 /*
  * More powerful function for turning on quotas allowing setting
@@ -2118,6 +2144,7 @@  out_lock:
 load_quota:
 	return vfs_load_quota_inode(inode, type, format_id, flags);
 }
+EXPORT_SYMBOL(vfs_quota_enable);
 
 /*
  * This function is used when filesystem needs to initialize quotas
@@ -2147,6 +2174,7 @@  out:
 	dput(dentry);
 	return error;
 }
+EXPORT_SYMBOL(vfs_quota_on_mount);
 
 /* Wrapper to turn on quotas when remounting rw */
 int vfs_dq_quota_on_remount(struct super_block *sb)
@@ -2163,6 +2191,7 @@  int vfs_dq_quota_on_remount(struct super
 	}
 	return ret;
 }
+EXPORT_SYMBOL(vfs_dq_quota_on_remount);
 
 static inline qsize_t qbtos(qsize_t blocks)
 {
@@ -2206,6 +2235,7 @@  int vfs_get_dqblk(struct super_block *sb
 	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
 	return 0;
 }
+EXPORT_SYMBOL(vfs_get_dqblk);
 
 /* Generic routine for setting common part of quota structure */
 static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di)
@@ -2299,6 +2329,7 @@  out:
 	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
 	return rc;
 }
+EXPORT_SYMBOL(vfs_set_dqblk);
 
 /* Generic routine for getting common part of quota file information */
 int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
@@ -2320,6 +2351,7 @@  int vfs_get_dqinfo(struct super_block *s
 	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
 	return 0;
 }
+EXPORT_SYMBOL(vfs_get_dqinfo);
 
 /* Generic routine for setting common part of quota file information */
 int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
@@ -2348,6 +2380,7 @@  out:
 	mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
 	return err;
 }
+EXPORT_SYMBOL(vfs_set_dqinfo);
 
 struct quotactl_ops vfs_quotactl_ops = {
 	.quota_on	= vfs_quota_on,
@@ -2503,39 +2536,3 @@  static int __init dquot_init(void)
 	return 0;
 }
 module_init(dquot_init);
-
-EXPORT_SYMBOL(register_quota_format);
-EXPORT_SYMBOL(unregister_quota_format);
-EXPORT_SYMBOL(dqstats);
-EXPORT_SYMBOL(dq_data_lock);
-EXPORT_SYMBOL(vfs_quota_enable);
-EXPORT_SYMBOL(vfs_quota_on);
-EXPORT_SYMBOL(vfs_quota_on_path);
-EXPORT_SYMBOL(vfs_quota_on_mount);
-EXPORT_SYMBOL(vfs_quota_disable);
-EXPORT_SYMBOL(vfs_quota_off);
-EXPORT_SYMBOL(dquot_scan_active);
-EXPORT_SYMBOL(vfs_quota_sync);
-EXPORT_SYMBOL(vfs_get_dqinfo);
-EXPORT_SYMBOL(vfs_set_dqinfo);
-EXPORT_SYMBOL(vfs_get_dqblk);
-EXPORT_SYMBOL(vfs_set_dqblk);
-EXPORT_SYMBOL(dquot_commit);
-EXPORT_SYMBOL(dquot_commit_info);
-EXPORT_SYMBOL(dquot_acquire);
-EXPORT_SYMBOL(dquot_release);
-EXPORT_SYMBOL(dquot_mark_dquot_dirty);
-EXPORT_SYMBOL(dquot_initialize);
-EXPORT_SYMBOL(dquot_drop);
-EXPORT_SYMBOL(dquot_drop_locked);
-EXPORT_SYMBOL(vfs_dq_drop);
-EXPORT_SYMBOL(dqget);
-EXPORT_SYMBOL(dqput);
-EXPORT_SYMBOL(dquot_is_cached);
-EXPORT_SYMBOL(dquot_alloc_space);
-EXPORT_SYMBOL(dquot_alloc_inode);
-EXPORT_SYMBOL(dquot_free_space);
-EXPORT_SYMBOL(dquot_free_inode);
-EXPORT_SYMBOL(dquot_transfer);
-EXPORT_SYMBOL(vfs_dq_transfer);
-EXPORT_SYMBOL(vfs_dq_quota_on_remount);