aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:07 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:30 -0500
commit871a293155a24554e153538d36e3a80fa169aefb (patch)
tree7e38f5a2f9e87f63cbc4bc1077a4bb49dde441b0
parent907f4554e2521cb28b0009d17167760650a9561c (diff)
dquot: cleanup dquot initialize routine
Get rid of the initialize dquot operation - it is now always called from the filesystem and if a filesystem really needs it's own (which none currently does) it can just call into it's own routine directly. Rename the now static low-level dquot_initialize helper to __dquot_initialize and vfs_dq_init to dquot_initialize to have a consistent namespace. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--fs/ext2/file.c1
-rw-r--r--fs/ext2/ialloc.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext2/namei.c16
-rw-r--r--fs/ext3/file.c1
-rw-r--r--fs/ext3/ialloc.c4
-rw-r--r--fs/ext3/inode.c6
-rw-r--r--fs/ext3/namei.c24
-rw-r--r--fs/ext3/super.c5
-rw-r--r--fs/ext4/file.c1
-rw-r--r--fs/ext4/ialloc.c4
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/ext4/namei.c24
-rw-r--r--fs/ext4/super.c5
-rw-r--r--fs/jfs/file.c2
-rw-r--r--fs/jfs/inode.c4
-rw-r--r--fs/jfs/jfs_inode.c2
-rw-r--r--fs/jfs/namei.c24
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/inode.c2
-rw-r--r--fs/ocfs2/namei.c14
-rw-r--r--fs/ocfs2/quota_global.c1
-rw-r--r--fs/ocfs2/refcounttree.c2
-rw-r--r--fs/quota/dquot.c32
-rw-r--r--fs/reiserfs/inode.c6
-rw-r--r--fs/reiserfs/namei.c22
-rw-r--r--fs/reiserfs/super.c3
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/udf/ialloc.c2
-rw-r--r--fs/udf/inode.c2
-rw-r--r--fs/udf/namei.c18
-rw-r--r--fs/ufs/file.c1
-rw-r--r--fs/ufs/ialloc.c2
-rw-r--r--fs/ufs/inode.c2
-rw-r--r--fs/ufs/namei.c16
-rw-r--r--fs/ufs/truncate.c2
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/quotaops.h17
39 files changed, 141 insertions, 145 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index fa10e4bf8e5e..06bbbed71206 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -460,7 +460,6 @@ in sys_read() and friends.
460 460
461--------------------------- dquot_operations ------------------------------- 461--------------------------- dquot_operations -------------------------------
462prototypes: 462prototypes:
463 int (*initialize) (struct inode *, int);
464 int (*write_dquot) (struct dquot *); 463 int (*write_dquot) (struct dquot *);
465 int (*acquire_dquot) (struct dquot *); 464 int (*acquire_dquot) (struct dquot *);
466 int (*release_dquot) (struct dquot *); 465 int (*release_dquot) (struct dquot *);
@@ -473,7 +472,6 @@ a proper locking wrt the filesystem and call the generic quota operations.
473What filesystem should expect from the generic quota functions: 472What filesystem should expect from the generic quota functions:
474 473
475 FS recursion Held locks when called 474 FS recursion Held locks when called
476initialize: yes maybe dqonoff_sem
477write_dquot: yes dqonoff_sem or dqptr_sem 475write_dquot: yes dqonoff_sem or dqptr_sem
478acquire_dquot: yes dqonoff_sem or dqptr_sem 476acquire_dquot: yes dqonoff_sem or dqptr_sem
479release_dquot: yes dqonoff_sem or dqptr_sem 477release_dquot: yes dqonoff_sem or dqptr_sem
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index d11f6e484519..5d198d0697fb 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/quotaops.h>
23#include "ext2.h" 24#include "ext2.h"
24#include "xattr.h" 25#include "xattr.h"
25#include "acl.h" 26#include "acl.h"
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 88b71972c626..ad7d572ee8dc 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -586,7 +586,7 @@ got:
586 goto fail_drop; 586 goto fail_drop;
587 } 587 }
588 588
589 vfs_dq_init(inode); 589 dquot_initialize(inode);
590 err = dquot_alloc_inode(inode); 590 err = dquot_alloc_inode(inode);
591 if (err) 591 if (err)
592 goto fail_drop; 592 goto fail_drop;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index c87840c33e17..45ff49f0a4b5 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -59,7 +59,7 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode)
59void ext2_delete_inode (struct inode * inode) 59void ext2_delete_inode (struct inode * inode)
60{ 60{
61 if (!is_bad_inode(inode)) 61 if (!is_bad_inode(inode))
62 vfs_dq_init(inode); 62 dquot_initialize(inode);
63 truncate_inode_pages(&inode->i_data, 0); 63 truncate_inode_pages(&inode->i_data, 0);
64 64
65 if (is_bad_inode(inode)) 65 if (is_bad_inode(inode))
@@ -1461,7 +1461,7 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr)
1461 return error; 1461 return error;
1462 1462
1463 if (iattr->ia_valid & ATTR_SIZE) 1463 if (iattr->ia_valid & ATTR_SIZE)
1464 vfs_dq_init(inode); 1464 dquot_initialize(inode);
1465 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 1465 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
1466 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 1466 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
1467 error = dquot_transfer(inode, iattr); 1467 error = dquot_transfer(inode, iattr);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 5923df7b22af..71efb0e9a3f2 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -102,7 +102,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st
102{ 102{
103 struct inode *inode; 103 struct inode *inode;
104 104
105 vfs_dq_init(dir); 105 dquot_initialize(dir);
106 106
107 inode = ext2_new_inode(dir, mode); 107 inode = ext2_new_inode(dir, mode);
108 if (IS_ERR(inode)) 108 if (IS_ERR(inode))
@@ -131,7 +131,7 @@ static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_
131 if (!new_valid_dev(rdev)) 131 if (!new_valid_dev(rdev))
132 return -EINVAL; 132 return -EINVAL;
133 133
134 vfs_dq_init(dir); 134 dquot_initialize(dir);
135 135
136 inode = ext2_new_inode (dir, mode); 136 inode = ext2_new_inode (dir, mode);
137 err = PTR_ERR(inode); 137 err = PTR_ERR(inode);
@@ -157,7 +157,7 @@ static int ext2_symlink (struct inode * dir, struct dentry * dentry,
157 if (l > sb->s_blocksize) 157 if (l > sb->s_blocksize)
158 goto out; 158 goto out;
159 159
160 vfs_dq_init(dir); 160 dquot_initialize(dir);
161 161
162 inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO); 162 inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO);
163 err = PTR_ERR(inode); 163 err = PTR_ERR(inode);
@@ -202,7 +202,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
202 if (inode->i_nlink >= EXT2_LINK_MAX) 202 if (inode->i_nlink >= EXT2_LINK_MAX)
203 return -EMLINK; 203 return -EMLINK;
204 204
205 vfs_dq_init(dir); 205 dquot_initialize(dir);
206 206
207 inode->i_ctime = CURRENT_TIME_SEC; 207 inode->i_ctime = CURRENT_TIME_SEC;
208 inode_inc_link_count(inode); 208 inode_inc_link_count(inode);
@@ -226,7 +226,7 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode)
226 if (dir->i_nlink >= EXT2_LINK_MAX) 226 if (dir->i_nlink >= EXT2_LINK_MAX)
227 goto out; 227 goto out;
228 228
229 vfs_dq_init(dir); 229 dquot_initialize(dir);
230 230
231 inode_inc_link_count(dir); 231 inode_inc_link_count(dir);
232 232
@@ -274,7 +274,7 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
274 struct page * page; 274 struct page * page;
275 int err = -ENOENT; 275 int err = -ENOENT;
276 276
277 vfs_dq_init(dir); 277 dquot_initialize(dir);
278 278
279 de = ext2_find_entry (dir, &dentry->d_name, &page); 279 de = ext2_find_entry (dir, &dentry->d_name, &page);
280 if (!de) 280 if (!de)
@@ -318,8 +318,8 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
318 struct ext2_dir_entry_2 * old_de; 318 struct ext2_dir_entry_2 * old_de;
319 int err = -ENOENT; 319 int err = -ENOENT;
320 320
321 vfs_dq_init(old_dir); 321 dquot_initialize(old_dir);
322 vfs_dq_init(new_dir); 322 dquot_initialize(new_dir);
323 323
324 old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page); 324 old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page);
325 if (!old_de) 325 if (!old_de)
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 3c7fb11a3b29..f55df0e61cbd 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -21,6 +21,7 @@
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/jbd.h> 23#include <linux/jbd.h>
24#include <linux/quotaops.h>
24#include <linux/ext3_fs.h> 25#include <linux/ext3_fs.h>
25#include <linux/ext3_jbd.h> 26#include <linux/ext3_jbd.h>
26#include "xattr.h" 27#include "xattr.h"
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 7d7238f9f6f3..ef9008b885b5 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -123,7 +123,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
123 * Note: we must free any quota before locking the superblock, 123 * Note: we must free any quota before locking the superblock,
124 * as writing the quota to disk may need the lock as well. 124 * as writing the quota to disk may need the lock as well.
125 */ 125 */
126 vfs_dq_init(inode); 126 dquot_initialize(inode);
127 ext3_xattr_delete_inode(handle, inode); 127 ext3_xattr_delete_inode(handle, inode);
128 dquot_free_inode(inode); 128 dquot_free_inode(inode);
129 dquot_drop(inode); 129 dquot_drop(inode);
@@ -588,7 +588,7 @@ got:
588 sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0; 588 sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
589 589
590 ret = inode; 590 ret = inode;
591 vfs_dq_init(inode); 591 dquot_initialize(inode);
592 err = dquot_alloc_inode(inode); 592 err = dquot_alloc_inode(inode);
593 if (err) 593 if (err)
594 goto fail_drop; 594 goto fail_drop;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index d7962b0c57b3..ffbbc65e3f68 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -197,7 +197,7 @@ void ext3_delete_inode (struct inode * inode)
197 handle_t *handle; 197 handle_t *handle;
198 198
199 if (!is_bad_inode(inode)) 199 if (!is_bad_inode(inode))
200 vfs_dq_init(inode); 200 dquot_initialize(inode);
201 201
202 truncate_inode_pages(&inode->i_data, 0); 202 truncate_inode_pages(&inode->i_data, 0);
203 203
@@ -3152,7 +3152,7 @@ int ext3_setattr(struct dentry *dentry, struct iattr *attr)
3152 return error; 3152 return error;
3153 3153
3154 if (ia_valid & ATTR_SIZE) 3154 if (ia_valid & ATTR_SIZE)
3155 vfs_dq_init(inode); 3155 dquot_initialize(inode);
3156 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 3156 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
3157 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 3157 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
3158 handle_t *handle; 3158 handle_t *handle;
@@ -3250,7 +3250,7 @@ static int ext3_writepage_trans_blocks(struct inode *inode)
3250 ret = 2 * (bpp + indirects) + 2; 3250 ret = 2 * (bpp + indirects) + 2;
3251 3251
3252#ifdef CONFIG_QUOTA 3252#ifdef CONFIG_QUOTA
3253 /* We know that structure was already allocated during vfs_dq_init so 3253 /* We know that structure was already allocated during dquot_initialize so
3254 * we will be updating only the data blocks + inodes */ 3254 * we will be updating only the data blocks + inodes */
3255 ret += EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb); 3255 ret += EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
3256#endif 3256#endif
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index a492b371b134..ee184084ca42 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1696,7 +1696,7 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode,
1696 struct inode * inode; 1696 struct inode * inode;
1697 int err, retries = 0; 1697 int err, retries = 0;
1698 1698
1699 vfs_dq_init(dir); 1699 dquot_initialize(dir);
1700 1700
1701retry: 1701retry:
1702 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1702 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1732,7 +1732,7 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
1732 if (!new_valid_dev(rdev)) 1732 if (!new_valid_dev(rdev))
1733 return -EINVAL; 1733 return -EINVAL;
1734 1734
1735 vfs_dq_init(dir); 1735 dquot_initialize(dir);
1736 1736
1737retry: 1737retry:
1738 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1738 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1770,7 +1770,7 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
1770 if (dir->i_nlink >= EXT3_LINK_MAX) 1770 if (dir->i_nlink >= EXT3_LINK_MAX)
1771 return -EMLINK; 1771 return -EMLINK;
1772 1772
1773 vfs_dq_init(dir); 1773 dquot_initialize(dir);
1774 1774
1775retry: 1775retry:
1776 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 1776 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2066,8 +2066,8 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
2066 2066
2067 /* Initialize quotas before so that eventual writes go in 2067 /* Initialize quotas before so that eventual writes go in
2068 * separate transaction */ 2068 * separate transaction */
2069 vfs_dq_init(dir); 2069 dquot_initialize(dir);
2070 vfs_dq_init(dentry->d_inode); 2070 dquot_initialize(dentry->d_inode);
2071 2071
2072 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); 2072 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
2073 if (IS_ERR(handle)) 2073 if (IS_ERR(handle))
@@ -2127,8 +2127,8 @@ static int ext3_unlink(struct inode * dir, struct dentry *dentry)
2127 2127
2128 /* Initialize quotas before so that eventual writes go 2128 /* Initialize quotas before so that eventual writes go
2129 * in separate transaction */ 2129 * in separate transaction */
2130 vfs_dq_init(dir); 2130 dquot_initialize(dir);
2131 vfs_dq_init(dentry->d_inode); 2131 dquot_initialize(dentry->d_inode);
2132 2132
2133 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb)); 2133 handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
2134 if (IS_ERR(handle)) 2134 if (IS_ERR(handle))
@@ -2184,7 +2184,7 @@ static int ext3_symlink (struct inode * dir,
2184 if (l > dir->i_sb->s_blocksize) 2184 if (l > dir->i_sb->s_blocksize)
2185 return -ENAMETOOLONG; 2185 return -ENAMETOOLONG;
2186 2186
2187 vfs_dq_init(dir); 2187 dquot_initialize(dir);
2188 2188
2189retry: 2189retry:
2190 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 2190 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2241,7 +2241,7 @@ static int ext3_link (struct dentry * old_dentry,
2241 if (inode->i_nlink >= EXT3_LINK_MAX) 2241 if (inode->i_nlink >= EXT3_LINK_MAX)
2242 return -EMLINK; 2242 return -EMLINK;
2243 2243
2244 vfs_dq_init(dir); 2244 dquot_initialize(dir);
2245 2245
2246 /* 2246 /*
2247 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing 2247 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
@@ -2293,15 +2293,15 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2293 struct ext3_dir_entry_2 * old_de, * new_de; 2293 struct ext3_dir_entry_2 * old_de, * new_de;
2294 int retval, flush_file = 0; 2294 int retval, flush_file = 0;
2295 2295
2296 vfs_dq_init(old_dir); 2296 dquot_initialize(old_dir);
2297 vfs_dq_init(new_dir); 2297 dquot_initialize(new_dir);
2298 2298
2299 old_bh = new_bh = dir_bh = NULL; 2299 old_bh = new_bh = dir_bh = NULL;
2300 2300
2301 /* Initialize quotas before so that eventual writes go 2301 /* Initialize quotas before so that eventual writes go
2302 * in separate transaction */ 2302 * in separate transaction */
2303 if (new_dentry->d_inode) 2303 if (new_dentry->d_inode)
2304 vfs_dq_init(new_dentry->d_inode); 2304 dquot_initialize(new_dentry->d_inode);
2305 handle = ext3_journal_start(old_dir, 2 * 2305 handle = ext3_journal_start(old_dir, 2 *
2306 EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) + 2306 EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) +
2307 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2); 2307 EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 0163d0dae124..e844accbf55d 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -752,7 +752,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
752 const char *data, size_t len, loff_t off); 752 const char *data, size_t len, loff_t off);
753 753
754static const struct dquot_operations ext3_quota_operations = { 754static const struct dquot_operations ext3_quota_operations = {
755 .initialize = dquot_initialize,
756 .write_dquot = ext3_write_dquot, 755 .write_dquot = ext3_write_dquot,
757 .acquire_dquot = ext3_acquire_dquot, 756 .acquire_dquot = ext3_acquire_dquot,
758 .release_dquot = ext3_release_dquot, 757 .release_dquot = ext3_release_dquot,
@@ -1480,7 +1479,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1480 } 1479 }
1481 1480
1482 list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan); 1481 list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1483 vfs_dq_init(inode); 1482 dquot_initialize(inode);
1484 if (inode->i_nlink) { 1483 if (inode->i_nlink) {
1485 printk(KERN_DEBUG 1484 printk(KERN_DEBUG
1486 "%s: truncating inode %lu to %Ld bytes\n", 1485 "%s: truncating inode %lu to %Ld bytes\n",
@@ -2736,7 +2735,7 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf)
2736 * Process 1 Process 2 2735 * Process 1 Process 2
2737 * ext3_create() quota_sync() 2736 * ext3_create() quota_sync()
2738 * journal_start() write_dquot() 2737 * journal_start() write_dquot()
2739 * vfs_dq_init() down(dqio_mutex) 2738 * dquot_initialize() down(dqio_mutex)
2740 * down(dqio_mutex) journal_start() 2739 * down(dqio_mutex) journal_start()
2741 * 2740 *
2742 */ 2741 */
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 85fa464a24ad..a08a12998c49 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -23,6 +23,7 @@
23#include <linux/jbd2.h> 23#include <linux/jbd2.h>
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <linux/path.h> 25#include <linux/path.h>
26#include <linux/quotaops.h>
26#include "ext4.h" 27#include "ext4.h"
27#include "ext4_jbd2.h" 28#include "ext4_jbd2.h"
28#include "xattr.h" 29#include "xattr.h"
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index ca8986e4b528..9bb2bb9f67ad 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -217,7 +217,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
217 * Note: we must free any quota before locking the superblock, 217 * Note: we must free any quota before locking the superblock,
218 * as writing the quota to disk may need the lock as well. 218 * as writing the quota to disk may need the lock as well.
219 */ 219 */
220 vfs_dq_init(inode); 220 dquot_initialize(inode);
221 ext4_xattr_delete_inode(handle, inode); 221 ext4_xattr_delete_inode(handle, inode);
222 dquot_free_inode(inode); 222 dquot_free_inode(inode);
223 dquot_drop(inode); 223 dquot_drop(inode);
@@ -1034,7 +1034,7 @@ got:
1034 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; 1034 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
1035 1035
1036 ret = inode; 1036 ret = inode;
1037 vfs_dq_init(inode); 1037 dquot_initialize(inode);
1038 err = dquot_alloc_inode(inode); 1038 err = dquot_alloc_inode(inode);
1039 if (err) 1039 if (err)
1040 goto fail_drop; 1040 goto fail_drop;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index eaa22ae9f1f6..bec222ca9ba4 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -171,7 +171,7 @@ void ext4_delete_inode(struct inode *inode)
171 int err; 171 int err;
172 172
173 if (!is_bad_inode(inode)) 173 if (!is_bad_inode(inode))
174 vfs_dq_init(inode); 174 dquot_initialize(inode);
175 175
176 if (ext4_should_order_data(inode)) 176 if (ext4_should_order_data(inode))
177 ext4_begin_ordered_truncate(inode, 0); 177 ext4_begin_ordered_truncate(inode, 0);
@@ -5255,7 +5255,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
5255 return error; 5255 return error;
5256 5256
5257 if (ia_valid & ATTR_SIZE) 5257 if (ia_valid & ATTR_SIZE)
5258 vfs_dq_init(inode); 5258 dquot_initialize(inode);
5259 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 5259 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
5260 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 5260 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
5261 handle_t *handle; 5261 handle_t *handle;
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 20f55c2e7571..7f3d2d75a0dc 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1766,7 +1766,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, int mode,
1766 struct inode *inode; 1766 struct inode *inode;
1767 int err, retries = 0; 1767 int err, retries = 0;
1768 1768
1769 vfs_dq_init(dir); 1769 dquot_initialize(dir);
1770 1770
1771retry: 1771retry:
1772 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 1772 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1802,7 +1802,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
1802 if (!new_valid_dev(rdev)) 1802 if (!new_valid_dev(rdev))
1803 return -EINVAL; 1803 return -EINVAL;
1804 1804
1805 vfs_dq_init(dir); 1805 dquot_initialize(dir);
1806 1806
1807retry: 1807retry:
1808 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 1808 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1841,7 +1841,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1841 if (EXT4_DIR_LINK_MAX(dir)) 1841 if (EXT4_DIR_LINK_MAX(dir))
1842 return -EMLINK; 1842 return -EMLINK;
1843 1843
1844 vfs_dq_init(dir); 1844 dquot_initialize(dir);
1845 1845
1846retry: 1846retry:
1847 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 1847 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2142,8 +2142,8 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
2142 2142
2143 /* Initialize quotas before so that eventual writes go in 2143 /* Initialize quotas before so that eventual writes go in
2144 * separate transaction */ 2144 * separate transaction */
2145 vfs_dq_init(dir); 2145 dquot_initialize(dir);
2146 vfs_dq_init(dentry->d_inode); 2146 dquot_initialize(dentry->d_inode);
2147 2147
2148 handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); 2148 handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
2149 if (IS_ERR(handle)) 2149 if (IS_ERR(handle))
@@ -2203,8 +2203,8 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
2203 2203
2204 /* Initialize quotas before so that eventual writes go 2204 /* Initialize quotas before so that eventual writes go
2205 * in separate transaction */ 2205 * in separate transaction */
2206 vfs_dq_init(dir); 2206 dquot_initialize(dir);
2207 vfs_dq_init(dentry->d_inode); 2207 dquot_initialize(dentry->d_inode);
2208 2208
2209 handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb)); 2209 handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
2210 if (IS_ERR(handle)) 2210 if (IS_ERR(handle))
@@ -2260,7 +2260,7 @@ static int ext4_symlink(struct inode *dir,
2260 if (l > dir->i_sb->s_blocksize) 2260 if (l > dir->i_sb->s_blocksize)
2261 return -ENAMETOOLONG; 2261 return -ENAMETOOLONG;
2262 2262
2263 vfs_dq_init(dir); 2263 dquot_initialize(dir);
2264 2264
2265retry: 2265retry:
2266 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2266 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2320,7 +2320,7 @@ static int ext4_link(struct dentry *old_dentry,
2320 if (inode->i_nlink >= EXT4_LINK_MAX) 2320 if (inode->i_nlink >= EXT4_LINK_MAX)
2321 return -EMLINK; 2321 return -EMLINK;
2322 2322
2323 vfs_dq_init(dir); 2323 dquot_initialize(dir);
2324 2324
2325 /* 2325 /*
2326 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing 2326 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
@@ -2372,15 +2372,15 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
2372 struct ext4_dir_entry_2 *old_de, *new_de; 2372 struct ext4_dir_entry_2 *old_de, *new_de;
2373 int retval, force_da_alloc = 0; 2373 int retval, force_da_alloc = 0;
2374 2374
2375 vfs_dq_init(old_dir); 2375 dquot_initialize(old_dir);
2376 vfs_dq_init(new_dir); 2376 dquot_initialize(new_dir);
2377 2377
2378 old_bh = new_bh = dir_bh = NULL; 2378 old_bh = new_bh = dir_bh = NULL;
2379 2379
2380 /* Initialize quotas before so that eventual writes go 2380 /* Initialize quotas before so that eventual writes go
2381 * in separate transaction */ 2381 * in separate transaction */
2382 if (new_dentry->d_inode) 2382 if (new_dentry->d_inode)
2383 vfs_dq_init(new_dentry->d_inode); 2383 dquot_initialize(new_dentry->d_inode);
2384 handle = ext4_journal_start(old_dir, 2 * 2384 handle = ext4_journal_start(old_dir, 2 *
2385 EXT4_DATA_TRANS_BLOCKS(old_dir->i_sb) + 2385 EXT4_DATA_TRANS_BLOCKS(old_dir->i_sb) +
2386 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2); 2386 EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 035516c80df2..edcf3b0239d1 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1013,7 +1013,6 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
1013 const char *data, size_t len, loff_t off); 1013 const char *data, size_t len, loff_t off);
1014 1014
1015static const struct dquot_operations ext4_quota_operations = { 1015static const struct dquot_operations ext4_quota_operations = {
1016 .initialize = dquot_initialize,
1017#ifdef CONFIG_QUOTA 1016#ifdef CONFIG_QUOTA
1018 .get_reserved_space = ext4_get_reserved_space, 1017 .get_reserved_space = ext4_get_reserved_space,
1019#endif 1018#endif
@@ -1931,7 +1930,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
1931 } 1930 }
1932 1931
1933 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan); 1932 list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
1934 vfs_dq_init(inode); 1933 dquot_initialize(inode);
1935 if (inode->i_nlink) { 1934 if (inode->i_nlink) {
1936 ext4_msg(sb, KERN_DEBUG, 1935 ext4_msg(sb, KERN_DEBUG,
1937 "%s: truncating inode %lu to %lld bytes", 1936 "%s: truncating inode %lu to %lld bytes",
@@ -3700,7 +3699,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
3700 * Process 1 Process 2 3699 * Process 1 Process 2
3701 * ext4_create() quota_sync() 3700 * ext4_create() quota_sync()
3702 * jbd2_journal_start() write_dquot() 3701 * jbd2_journal_start() write_dquot()
3703 * vfs_dq_init() down(dqio_mutex) 3702 * dquot_initialize() down(dqio_mutex)
3704 * down(dqio_mutex) jbd2_journal_start() 3703 * down(dqio_mutex) jbd2_journal_start()
3705 * 3704 *
3706 */ 3705 */
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index f19bb33eb1eb..14ba982b3f24 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -99,7 +99,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
99 return rc; 99 return rc;
100 100
101 if (iattr->ia_valid & ATTR_SIZE) 101 if (iattr->ia_valid & ATTR_SIZE)
102 vfs_dq_init(inode); 102 dquot_initialize(inode);
103 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 103 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
104 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 104 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
105 rc = dquot_transfer(inode, iattr); 105 rc = dquot_transfer(inode, iattr);
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 1aa2dda16590..c694a5f15380 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -147,7 +147,7 @@ void jfs_delete_inode(struct inode *inode)
147 jfs_info("In jfs_delete_inode, inode = 0x%p", inode); 147 jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
148 148
149 if (!is_bad_inode(inode)) 149 if (!is_bad_inode(inode))
150 vfs_dq_init(inode); 150 dquot_initialize(inode);
151 151
152 if (!is_bad_inode(inode) && 152 if (!is_bad_inode(inode) &&
153 (JFS_IP(inode)->fileset == FILESYSTEM_I)) { 153 (JFS_IP(inode)->fileset == FILESYSTEM_I)) {
@@ -161,7 +161,7 @@ void jfs_delete_inode(struct inode *inode)
161 /* 161 /*
162 * Free the inode from the quota allocation. 162 * Free the inode from the quota allocation.
163 */ 163 */
164 vfs_dq_init(inode); 164 dquot_initialize(inode);
165 dquot_free_inode(inode); 165 dquot_free_inode(inode);
166 dquot_drop(inode); 166 dquot_drop(inode);
167 } 167 }
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 72b30895422c..829921b67765 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -116,7 +116,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
116 /* 116 /*
117 * Allocate inode to quota. 117 * Allocate inode to quota.
118 */ 118 */
119 vfs_dq_init(inode); 119 dquot_initialize(inode);
120 rc = dquot_alloc_inode(inode); 120 rc = dquot_alloc_inode(inode);
121 if (rc) 121 if (rc)
122 goto fail_drop; 122 goto fail_drop;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b7cc29da50b4..4a3e9f39c21d 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -85,7 +85,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode,
85 85
86 jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); 86 jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name);
87 87
88 vfs_dq_init(dip); 88 dquot_initialize(dip);
89 89
90 /* 90 /*
91 * search parent directory for entry/freespace 91 * search parent directory for entry/freespace
@@ -217,7 +217,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
217 217
218 jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); 218 jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name);
219 219
220 vfs_dq_init(dip); 220 dquot_initialize(dip);
221 221
222 /* link count overflow on parent directory ? */ 222 /* link count overflow on parent directory ? */
223 if (dip->i_nlink == JFS_LINK_MAX) { 223 if (dip->i_nlink == JFS_LINK_MAX) {
@@ -360,8 +360,8 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
360 jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); 360 jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name);
361 361
362 /* Init inode for quota operations. */ 362 /* Init inode for quota operations. */
363 vfs_dq_init(dip); 363 dquot_initialize(dip);
364 vfs_dq_init(ip); 364 dquot_initialize(ip);
365 365
366 /* directory must be empty to be removed */ 366 /* directory must be empty to be removed */
367 if (!dtEmpty(ip)) { 367 if (!dtEmpty(ip)) {
@@ -488,8 +488,8 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
488 jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); 488 jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name);
489 489
490 /* Init inode for quota operations. */ 490 /* Init inode for quota operations. */
491 vfs_dq_init(dip); 491 dquot_initialize(dip);
492 vfs_dq_init(ip); 492 dquot_initialize(ip);
493 493
494 if ((rc = get_UCSname(&dname, dentry))) 494 if ((rc = get_UCSname(&dname, dentry)))
495 goto out; 495 goto out;
@@ -811,7 +811,7 @@ static int jfs_link(struct dentry *old_dentry,
811 if (ip->i_nlink == 0) 811 if (ip->i_nlink == 0)
812 return -ENOENT; 812 return -ENOENT;
813 813
814 vfs_dq_init(dir); 814 dquot_initialize(dir);
815 815
816 tid = txBegin(ip->i_sb, 0); 816 tid = txBegin(ip->i_sb, 0);
817 817
@@ -904,7 +904,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
904 904
905 jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); 905 jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name);
906 906
907 vfs_dq_init(dip); 907 dquot_initialize(dip);
908 908
909 ssize = strlen(name) + 1; 909 ssize = strlen(name) + 1;
910 910
@@ -1097,8 +1097,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1097 jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, 1097 jfs_info("jfs_rename: %s %s", old_dentry->d_name.name,
1098 new_dentry->d_name.name); 1098 new_dentry->d_name.name);
1099 1099
1100 vfs_dq_init(old_dir); 1100 dquot_initialize(old_dir);
1101 vfs_dq_init(new_dir); 1101 dquot_initialize(new_dir);
1102 1102
1103 old_ip = old_dentry->d_inode; 1103 old_ip = old_dentry->d_inode;
1104 new_ip = new_dentry->d_inode; 1104 new_ip = new_dentry->d_inode;
@@ -1149,7 +1149,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1149 } else if (new_ip) { 1149 } else if (new_ip) {
1150 IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); 1150 IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
1151 /* Init inode for quota operations. */ 1151 /* Init inode for quota operations. */
1152 vfs_dq_init(new_ip); 1152 dquot_initialize(new_ip);
1153 } 1153 }
1154 1154
1155 /* 1155 /*
@@ -1373,7 +1373,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1373 1373
1374 jfs_info("jfs_mknod: %s", dentry->d_name.name); 1374 jfs_info("jfs_mknod: %s", dentry->d_name.name);
1375 1375
1376 vfs_dq_init(dir); 1376 dquot_initialize(dir);
1377 1377
1378 if ((rc = get_UCSname(&dname, dentry))) 1378 if ((rc = get_UCSname(&dname, dentry)))
1379 goto out; 1379 goto out;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 126198f5a67c..364105291282 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -108,7 +108,7 @@ static int ocfs2_file_open(struct inode *inode, struct file *file)
108 file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); 108 file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
109 109
110 if (file->f_mode & FMODE_WRITE) 110 if (file->f_mode & FMODE_WRITE)
111 vfs_dq_init(inode); 111 dquot_initialize(inode);
112 112
113 spin_lock(&oi->ip_lock); 113 spin_lock(&oi->ip_lock);
114 114
@@ -980,7 +980,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
980 980
981 size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; 981 size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE;
982 if (size_change) { 982 if (size_change) {
983 vfs_dq_init(inode); 983 dquot_initialize(inode);
984 984
985 status = ocfs2_rw_lock(inode, 1); 985 status = ocfs2_rw_lock(inode, 1);
986 if (status < 0) { 986 if (status < 0) {
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 77681a690d16..278a223aae14 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -971,7 +971,7 @@ void ocfs2_delete_inode(struct inode *inode)
971 goto bail; 971 goto bail;
972 } 972 }
973 973
974 vfs_dq_init(inode); 974 dquot_initialize(inode);
975 975
976 if (!ocfs2_inode_is_valid_to_delete(inode)) { 976 if (!ocfs2_inode_is_valid_to_delete(inode)) {
977 /* It's probably not necessary to truncate_inode_pages 977 /* It's probably not necessary to truncate_inode_pages
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 8b5b142eb638..d9cd4e373a53 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -212,7 +212,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode)
212 } else 212 } else
213 inode->i_gid = current_fsgid(); 213 inode->i_gid = current_fsgid();
214 inode->i_mode = mode; 214 inode->i_mode = mode;
215 vfs_dq_init(inode); 215 dquot_initialize(inode);
216 return inode; 216 return inode;
217} 217}
218 218
@@ -244,7 +244,7 @@ static int ocfs2_mknod(struct inode *dir,
244 (unsigned long)dev, dentry->d_name.len, 244 (unsigned long)dev, dentry->d_name.len,
245 dentry->d_name.name); 245 dentry->d_name.name);
246 246
247 vfs_dq_init(dir); 247 dquot_initialize(dir);
248 248
249 /* get our super block */ 249 /* get our super block */
250 osb = OCFS2_SB(dir->i_sb); 250 osb = OCFS2_SB(dir->i_sb);
@@ -634,7 +634,7 @@ static int ocfs2_link(struct dentry *old_dentry,
634 if (S_ISDIR(inode->i_mode)) 634 if (S_ISDIR(inode->i_mode))
635 return -EPERM; 635 return -EPERM;
636 636
637 vfs_dq_init(dir); 637 dquot_initialize(dir);
638 638
639 err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); 639 err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT);
640 if (err < 0) { 640 if (err < 0) {
@@ -791,7 +791,7 @@ static int ocfs2_unlink(struct inode *dir,
791 mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, 791 mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
792 dentry->d_name.len, dentry->d_name.name); 792 dentry->d_name.len, dentry->d_name.name);
793 793
794 vfs_dq_init(dir); 794 dquot_initialize(dir);
795 795
796 BUG_ON(dentry->d_parent->d_inode != dir); 796 BUG_ON(dentry->d_parent->d_inode != dir);
797 797
@@ -1053,8 +1053,8 @@ static int ocfs2_rename(struct inode *old_dir,
1053 old_dentry->d_name.len, old_dentry->d_name.name, 1053 old_dentry->d_name.len, old_dentry->d_name.name,
1054 new_dentry->d_name.len, new_dentry->d_name.name); 1054 new_dentry->d_name.len, new_dentry->d_name.name);
1055 1055
1056 vfs_dq_init(old_dir); 1056 dquot_initialize(old_dir);
1057 vfs_dq_init(new_dir); 1057 dquot_initialize(new_dir);
1058 1058
1059 osb = OCFS2_SB(old_dir->i_sb); 1059 osb = OCFS2_SB(old_dir->i_sb);
1060 1060
@@ -1604,7 +1604,7 @@ static int ocfs2_symlink(struct inode *dir,
1604 mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, 1604 mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir,
1605 dentry, symname, dentry->d_name.len, dentry->d_name.name); 1605 dentry, symname, dentry->d_name.len, dentry->d_name.name);
1606 1606
1607 vfs_dq_init(dir); 1607 dquot_initialize(dir);
1608 1608
1609 sb = dir->i_sb; 1609 sb = dir->i_sb;
1610 osb = OCFS2_SB(sb); 1610 osb = OCFS2_SB(sb);
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 4dca38f487cf..355f41d1d520 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -851,7 +851,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
851} 851}
852 852
853const struct dquot_operations ocfs2_quota_operations = { 853const struct dquot_operations ocfs2_quota_operations = {
854 .initialize = dquot_initialize,
855 .write_dquot = ocfs2_write_dquot, 854 .write_dquot = ocfs2_write_dquot,
856 .acquire_dquot = ocfs2_acquire_dquot, 855 .acquire_dquot = ocfs2_acquire_dquot,
857 .release_dquot = ocfs2_release_dquot, 856 .release_dquot = ocfs2_release_dquot,
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 8ae65c9c020c..f3ae10cde841 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4390,7 +4390,7 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
4390 } 4390 }
4391 4391
4392 mutex_lock(&inode->i_mutex); 4392 mutex_lock(&inode->i_mutex);
4393 vfs_dq_init(dir); 4393 dquot_initialize(dir);
4394 error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve); 4394 error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve);
4395 mutex_unlock(&inode->i_mutex); 4395 mutex_unlock(&inode->i_mutex);
4396 if (!error) 4396 if (!error)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6244bca45c9d..3c0a7e0dff78 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -230,6 +230,7 @@ struct dqstats dqstats;
230EXPORT_SYMBOL(dqstats); 230EXPORT_SYMBOL(dqstats);
231 231
232static qsize_t inode_get_rsv_space(struct inode *inode); 232static qsize_t inode_get_rsv_space(struct inode *inode);
233static void __dquot_initialize(struct inode *inode, int type);
233 234
234static inline unsigned int 235static inline unsigned int
235hashfn(const struct super_block *sb, unsigned int id, int type) 236hashfn(const struct super_block *sb, unsigned int id, int type)
@@ -890,7 +891,7 @@ static void add_dquot_ref(struct super_block *sb, int type)
890 spin_unlock(&inode_lock); 891 spin_unlock(&inode_lock);
891 892
892 iput(old_inode); 893 iput(old_inode);
893 sb->dq_op->initialize(inode, type); 894 __dquot_initialize(inode, type);
894 /* We hold a reference to 'inode' so it couldn't have been 895 /* We hold a reference to 'inode' so it couldn't have been
895 * removed from s_inodes list while we dropped the inode_lock. 896 * removed from s_inodes list while we dropped the inode_lock.
896 * We cannot iput the inode now as we can be holding the last 897 * We cannot iput the inode now as we can be holding the last
@@ -1293,22 +1294,26 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
1293} 1294}
1294 1295
1295/* 1296/*
1296 * Initialize quota pointers in inode 1297 * Initialize quota pointers in inode
1297 * We do things in a bit complicated way but by that we avoid calling 1298 *
1298 * dqget() and thus filesystem callbacks under dqptr_sem. 1299 * We do things in a bit complicated way but by that we avoid calling
1300 * dqget() and thus filesystem callbacks under dqptr_sem.
1301 *
1302 * It is better to call this function outside of any transaction as it
1303 * might need a lot of space in journal for dquot structure allocation.
1299 */ 1304 */
1300int dquot_initialize(struct inode *inode, int type) 1305static void __dquot_initialize(struct inode *inode, int type)
1301{ 1306{
1302 unsigned int id = 0; 1307 unsigned int id = 0;
1303 int cnt, ret = 0; 1308 int cnt;
1304 struct dquot *got[MAXQUOTAS]; 1309 struct dquot *got[MAXQUOTAS];
1305 struct super_block *sb = inode->i_sb; 1310 struct super_block *sb = inode->i_sb;
1306 qsize_t rsv; 1311 qsize_t rsv;
1307 1312
1308 /* First test before acquiring mutex - solves deadlocks when we 1313 /* First test before acquiring mutex - solves deadlocks when we
1309 * re-enter the quota code and are already holding the mutex */ 1314 * re-enter the quota code and are already holding the mutex */
1310 if (IS_NOQUOTA(inode)) 1315 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
1311 return 0; 1316 return;
1312 1317
1313 /* First get references to structures we might need. */ 1318 /* First get references to structures we might need. */
1314 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1319 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -1351,7 +1356,11 @@ out_err:
1351 up_write(&sb_dqopt(sb)->dqptr_sem); 1356 up_write(&sb_dqopt(sb)->dqptr_sem);
1352 /* Drop unused references */ 1357 /* Drop unused references */
1353 dqput_all(got); 1358 dqput_all(got);
1354 return ret; 1359}
1360
1361void dquot_initialize(struct inode *inode)
1362{
1363 __dquot_initialize(inode, -1);
1355} 1364}
1356EXPORT_SYMBOL(dquot_initialize); 1365EXPORT_SYMBOL(dquot_initialize);
1357 1366
@@ -1783,7 +1792,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1783 chid[GRPQUOTA] = iattr->ia_gid; 1792 chid[GRPQUOTA] = iattr->ia_gid;
1784 } 1793 }
1785 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) { 1794 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
1786 vfs_dq_init(inode); 1795 dquot_initialize(inode);
1787 if (__dquot_transfer(inode, chid, mask) == NO_QUOTA) 1796 if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
1788 return -EDQUOT; 1797 return -EDQUOT;
1789 } 1798 }
@@ -1810,7 +1819,6 @@ EXPORT_SYMBOL(dquot_commit_info);
1810 * Definitions of diskquota operations. 1819 * Definitions of diskquota operations.
1811 */ 1820 */
1812const struct dquot_operations dquot_operations = { 1821const struct dquot_operations dquot_operations = {
1813 .initialize = dquot_initialize,
1814 .write_dquot = dquot_commit, 1822 .write_dquot = dquot_commit,
1815 .acquire_dquot = dquot_acquire, 1823 .acquire_dquot = dquot_acquire,
1816 .release_dquot = dquot_release, 1824 .release_dquot = dquot_release,
@@ -1829,7 +1837,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
1829 1837
1830 error = generic_file_open(inode, file); 1838 error = generic_file_open(inode, file);
1831 if (!error && (file->f_mode & FMODE_WRITE)) 1839 if (!error && (file->f_mode & FMODE_WRITE))
1832 vfs_dq_init(inode); 1840 dquot_initialize(inode);
1833 return error; 1841 return error;
1834} 1842}
1835EXPORT_SYMBOL(dquot_file_open); 1843EXPORT_SYMBOL(dquot_file_open);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 06995cb48e39..b8671a54e8ed 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -35,7 +35,7 @@ void reiserfs_delete_inode(struct inode *inode)
35 int err; 35 int err;
36 36
37 if (!is_bad_inode(inode)) 37 if (!is_bad_inode(inode))
38 vfs_dq_init(inode); 38 dquot_initialize(inode);
39 39
40 truncate_inode_pages(&inode->i_data, 0); 40 truncate_inode_pages(&inode->i_data, 0);
41 41
@@ -1768,7 +1768,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1768 1768
1769 BUG_ON(!th->t_trans_id); 1769 BUG_ON(!th->t_trans_id);
1770 1770
1771 vfs_dq_init(inode); 1771 dquot_initialize(inode);
1772 err = dquot_alloc_inode(inode); 1772 err = dquot_alloc_inode(inode);
1773 if (err) 1773 if (err)
1774 goto out_end_trans; 1774 goto out_end_trans;
@@ -3076,7 +3076,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3076 3076
3077 depth = reiserfs_write_lock_once(inode->i_sb); 3077 depth = reiserfs_write_lock_once(inode->i_sb);
3078 if (attr->ia_valid & ATTR_SIZE) { 3078 if (attr->ia_valid & ATTR_SIZE) {
3079 vfs_dq_init(inode); 3079 dquot_initialize(inode);
3080 3080
3081 /* version 2 items will be caught by the s_maxbytes check 3081 /* version 2 items will be caught by the s_maxbytes check
3082 ** done for us in vmtruncate 3082 ** done for us in vmtruncate
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index c55e1b9fee5f..96e4cbbfaa18 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -554,7 +554,7 @@ static int drop_new_inode(struct inode *inode)
554} 554}
555 555
556/* utility function that does setup for reiserfs_new_inode. 556/* utility function that does setup for reiserfs_new_inode.
557** vfs_dq_init needs lots of credits so it's better to have it 557** dquot_initialize needs lots of credits so it's better to have it
558** outside of a transaction, so we had to pull some bits of 558** outside of a transaction, so we had to pull some bits of
559** reiserfs_new_inode out into this func. 559** reiserfs_new_inode out into this func.
560*/ 560*/
@@ -577,7 +577,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
577 } else { 577 } else {
578 inode->i_gid = current_fsgid(); 578 inode->i_gid = current_fsgid();
579 } 579 }
580 vfs_dq_init(inode); 580 dquot_initialize(inode);
581 return 0; 581 return 0;
582} 582}
583 583
@@ -594,7 +594,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode,
594 struct reiserfs_transaction_handle th; 594 struct reiserfs_transaction_handle th;
595 struct reiserfs_security_handle security; 595 struct reiserfs_security_handle security;
596 596
597 vfs_dq_init(dir); 597 dquot_initialize(dir);
598 598
599 if (!(inode = new_inode(dir->i_sb))) { 599 if (!(inode = new_inode(dir->i_sb))) {
600 return -ENOMEM; 600 return -ENOMEM;
@@ -668,7 +668,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
668 if (!new_valid_dev(rdev)) 668 if (!new_valid_dev(rdev))
669 return -EINVAL; 669 return -EINVAL;
670 670
671 vfs_dq_init(dir); 671 dquot_initialize(dir);
672 672
673 if (!(inode = new_inode(dir->i_sb))) { 673 if (!(inode = new_inode(dir->i_sb))) {
674 return -ENOMEM; 674 return -ENOMEM;
@@ -743,7 +743,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
743 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) + 743 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
744 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb)); 744 REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
745 745
746 vfs_dq_init(dir); 746 dquot_initialize(dir);
747 747
748#ifdef DISPLACE_NEW_PACKING_LOCALITIES 748#ifdef DISPLACE_NEW_PACKING_LOCALITIES
749 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */ 749 /* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
@@ -848,7 +848,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
848 JOURNAL_PER_BALANCE_CNT * 2 + 2 + 848 JOURNAL_PER_BALANCE_CNT * 2 + 2 +
849 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 849 4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
850 850
851 vfs_dq_init(dir); 851 dquot_initialize(dir);
852 852
853 reiserfs_write_lock(dir->i_sb); 853 reiserfs_write_lock(dir->i_sb);
854 retval = journal_begin(&th, dir->i_sb, jbegin_count); 854 retval = journal_begin(&th, dir->i_sb, jbegin_count);
@@ -931,7 +931,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
931 unsigned long savelink; 931 unsigned long savelink;
932 int depth; 932 int depth;
933 933
934 vfs_dq_init(dir); 934 dquot_initialize(dir);
935 935
936 inode = dentry->d_inode; 936 inode = dentry->d_inode;
937 937
@@ -1034,7 +1034,7 @@ static int reiserfs_symlink(struct inode *parent_dir,
1034 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) + 1034 2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
1035 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb)); 1035 REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
1036 1036
1037 vfs_dq_init(parent_dir); 1037 dquot_initialize(parent_dir);
1038 1038
1039 if (!(inode = new_inode(parent_dir->i_sb))) { 1039 if (!(inode = new_inode(parent_dir->i_sb))) {
1040 return -ENOMEM; 1040 return -ENOMEM;
@@ -1123,7 +1123,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1123 JOURNAL_PER_BALANCE_CNT * 3 + 1123 JOURNAL_PER_BALANCE_CNT * 3 +
1124 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb); 1124 2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
1125 1125
1126 vfs_dq_init(dir); 1126 dquot_initialize(dir);
1127 1127
1128 reiserfs_write_lock(dir->i_sb); 1128 reiserfs_write_lock(dir->i_sb);
1129 if (inode->i_nlink >= REISERFS_LINK_MAX) { 1129 if (inode->i_nlink >= REISERFS_LINK_MAX) {
@@ -1249,8 +1249,8 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1249 JOURNAL_PER_BALANCE_CNT * 3 + 5 + 1249 JOURNAL_PER_BALANCE_CNT * 3 + 5 +
1250 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb); 1250 4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
1251 1251
1252 vfs_dq_init(old_dir); 1252 dquot_initialize(old_dir);
1253 vfs_dq_init(new_dir); 1253 dquot_initialize(new_dir);
1254 1254
1255 old_inode = old_dentry->d_inode; 1255 old_inode = old_dentry->d_inode;
1256 new_dentry_inode = new_dentry->d_inode; 1256 new_dentry_inode = new_dentry->d_inode;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 34f7cd0cb02d..04bf5d791bda 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -246,7 +246,7 @@ static int finish_unfinished(struct super_block *s)
246 retval = remove_save_link_only(s, &save_link_key, 0); 246 retval = remove_save_link_only(s, &save_link_key, 0);
247 continue; 247 continue;
248 } 248 }
249 vfs_dq_init(inode); 249 dquot_initialize(inode);
250 250
251 if (truncate && S_ISDIR(inode->i_mode)) { 251 if (truncate && S_ISDIR(inode->i_mode)) {
252 /* We got a truncate request for a dir which is impossible. 252 /* We got a truncate request for a dir which is impossible.
@@ -622,7 +622,6 @@ static int reiserfs_write_info(struct super_block *, int);
622static int reiserfs_quota_on(struct super_block *, int, int, char *, int); 622static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
623 623
624static const struct dquot_operations reiserfs_quota_operations = { 624static const struct dquot_operations reiserfs_quota_operations = {
625 .initialize = dquot_initialize,
626 .write_dquot = reiserfs_write_dquot, 625 .write_dquot = reiserfs_write_dquot,
627 .acquire_dquot = reiserfs_acquire_dquot, 626 .acquire_dquot = reiserfs_acquire_dquot,
628 .release_dquot = reiserfs_release_dquot, 627 .release_dquot = reiserfs_release_dquot,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 013fa44d9a5e..1eb06774ed90 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -228,7 +228,7 @@ static int udf_setattr(struct dentry *dentry, struct iattr *iattr)
228 return error; 228 return error;
229 229
230 if (iattr->ia_valid & ATTR_SIZE) 230 if (iattr->ia_valid & ATTR_SIZE)
231 vfs_dq_init(inode); 231 dquot_initialize(inode);
232 232
233 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) || 233 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
234 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) { 234 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 15c6e992e587..fb68c9cd0c3e 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -153,7 +153,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
153 insert_inode_hash(inode); 153 insert_inode_hash(inode);
154 mark_inode_dirty(inode); 154 mark_inode_dirty(inode);
155 155
156 vfs_dq_init(inode); 156 dquot_initialize(inode);
157 ret = dquot_alloc_inode(inode); 157 ret = dquot_alloc_inode(inode);
158 if (ret) { 158 if (ret) {
159 dquot_drop(inode); 159 dquot_drop(inode);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index f19520268404..c7da1a32b364 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -72,7 +72,7 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
72void udf_delete_inode(struct inode *inode) 72void udf_delete_inode(struct inode *inode)
73{ 73{
74 if (!is_bad_inode(inode)) 74 if (!is_bad_inode(inode))
75 vfs_dq_init(inode); 75 dquot_initialize(inode);
76 76
77 truncate_inode_pages(&inode->i_data, 0); 77 truncate_inode_pages(&inode->i_data, 0);
78 78
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index e360c3fc4ae4..96757e3e3e04 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -563,7 +563,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
563 int err; 563 int err;
564 struct udf_inode_info *iinfo; 564 struct udf_inode_info *iinfo;
565 565
566 vfs_dq_init(dir); 566 dquot_initialize(dir);
567 567
568 lock_kernel(); 568 lock_kernel();
569 inode = udf_new_inode(dir, mode, &err); 569 inode = udf_new_inode(dir, mode, &err);
@@ -618,7 +618,7 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
618 if (!old_valid_dev(rdev)) 618 if (!old_valid_dev(rdev))
619 return -EINVAL; 619 return -EINVAL;
620 620
621 vfs_dq_init(dir); 621 dquot_initialize(dir);
622 622
623 lock_kernel(); 623 lock_kernel();
624 err = -EIO; 624 err = -EIO;
@@ -666,7 +666,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
666 struct udf_inode_info *dinfo = UDF_I(dir); 666 struct udf_inode_info *dinfo = UDF_I(dir);
667 struct udf_inode_info *iinfo; 667 struct udf_inode_info *iinfo;
668 668
669 vfs_dq_init(dir); 669 dquot_initialize(dir);
670 670
671 lock_kernel(); 671 lock_kernel();
672 err = -EMLINK; 672 err = -EMLINK;
@@ -805,7 +805,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
805 struct fileIdentDesc *fi, cfi; 805 struct fileIdentDesc *fi, cfi;
806 struct kernel_lb_addr tloc; 806 struct kernel_lb_addr tloc;
807 807
808 vfs_dq_init(dir); 808 dquot_initialize(dir);
809 809
810 retval = -ENOENT; 810 retval = -ENOENT;
811 lock_kernel(); 811 lock_kernel();
@@ -853,7 +853,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
853 struct fileIdentDesc cfi; 853 struct fileIdentDesc cfi;
854 struct kernel_lb_addr tloc; 854 struct kernel_lb_addr tloc;
855 855
856 vfs_dq_init(dir); 856 dquot_initialize(dir);
857 857
858 retval = -ENOENT; 858 retval = -ENOENT;
859 lock_kernel(); 859 lock_kernel();
@@ -909,7 +909,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
909 struct buffer_head *bh; 909 struct buffer_head *bh;
910 struct udf_inode_info *iinfo; 910 struct udf_inode_info *iinfo;
911 911
912 vfs_dq_init(dir); 912 dquot_initialize(dir);
913 913
914 lock_kernel(); 914 lock_kernel();
915 inode = udf_new_inode(dir, S_IFLNK, &err); 915 inode = udf_new_inode(dir, S_IFLNK, &err);
@@ -1081,7 +1081,7 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1081 int err; 1081 int err;
1082 struct buffer_head *bh; 1082 struct buffer_head *bh;
1083 1083
1084 vfs_dq_init(dir); 1084 dquot_initialize(dir);
1085 1085
1086 lock_kernel(); 1086 lock_kernel();
1087 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { 1087 if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
@@ -1145,8 +1145,8 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1145 struct kernel_lb_addr tloc; 1145 struct kernel_lb_addr tloc;
1146 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1146 struct udf_inode_info *old_iinfo = UDF_I(old_inode);
1147 1147
1148 vfs_dq_init(old_dir); 1148 dquot_initialize(old_dir);
1149 vfs_dq_init(new_dir); 1149 dquot_initialize(new_dir);
1150 1150
1151 lock_kernel(); 1151 lock_kernel();
1152 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); 1152 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index d84762f3028e..a8962cecde5b 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/quotaops.h>
27 28
28#include "ufs_fs.h" 29#include "ufs_fs.h"
29#include "ufs.h" 30#include "ufs.h"
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 67b4bdb056fb..230ecf608026 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -355,7 +355,7 @@ cg_found:
355 355
356 unlock_super (sb); 356 unlock_super (sb);
357 357
358 vfs_dq_init(inode); 358 dquot_initialize(inode);
359 err = dquot_alloc_inode(inode); 359 err = dquot_alloc_inode(inode);
360 if (err) { 360 if (err) {
361 dquot_drop(inode); 361 dquot_drop(inode);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index fff8edab382f..09aef49beedb 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -910,7 +910,7 @@ void ufs_delete_inode (struct inode * inode)
910 loff_t old_i_size; 910 loff_t old_i_size;
911 911
912 if (!is_bad_inode(inode)) 912 if (!is_bad_inode(inode))
913 vfs_dq_init(inode); 913 dquot_initialize(inode);
914 914
915 truncate_inode_pages(&inode->i_data, 0); 915 truncate_inode_pages(&inode->i_data, 0);
916 if (is_bad_inode(inode)) 916 if (is_bad_inode(inode))
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index c33cb90c516d..118556243e7a 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -86,7 +86,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode,
86 86
87 UFSD("BEGIN\n"); 87 UFSD("BEGIN\n");
88 88
89 vfs_dq_init(dir); 89 dquot_initialize(dir);
90 90
91 inode = ufs_new_inode(dir, mode); 91 inode = ufs_new_inode(dir, mode);
92 err = PTR_ERR(inode); 92 err = PTR_ERR(inode);
@@ -112,7 +112,7 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t
112 if (!old_valid_dev(rdev)) 112 if (!old_valid_dev(rdev))
113 return -EINVAL; 113 return -EINVAL;
114 114
115 vfs_dq_init(dir); 115 dquot_initialize(dir);
116 116
117 inode = ufs_new_inode(dir, mode); 117 inode = ufs_new_inode(dir, mode);
118 err = PTR_ERR(inode); 118 err = PTR_ERR(inode);
@@ -138,7 +138,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
138 if (l > sb->s_blocksize) 138 if (l > sb->s_blocksize)
139 goto out_notlocked; 139 goto out_notlocked;
140 140
141 vfs_dq_init(dir); 141 dquot_initialize(dir);
142 142
143 lock_kernel(); 143 lock_kernel();
144 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); 144 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
@@ -185,7 +185,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
185 return -EMLINK; 185 return -EMLINK;
186 } 186 }
187 187
188 vfs_dq_init(dir); 188 dquot_initialize(dir);
189 189
190 inode->i_ctime = CURRENT_TIME_SEC; 190 inode->i_ctime = CURRENT_TIME_SEC;
191 inode_inc_link_count(inode); 191 inode_inc_link_count(inode);
@@ -204,7 +204,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
204 if (dir->i_nlink >= UFS_LINK_MAX) 204 if (dir->i_nlink >= UFS_LINK_MAX)
205 goto out; 205 goto out;
206 206
207 vfs_dq_init(dir); 207 dquot_initialize(dir);
208 208
209 lock_kernel(); 209 lock_kernel();
210 inode_inc_link_count(dir); 210 inode_inc_link_count(dir);
@@ -250,7 +250,7 @@ static int ufs_unlink(struct inode *dir, struct dentry *dentry)
250 struct page *page; 250 struct page *page;
251 int err = -ENOENT; 251 int err = -ENOENT;
252 252
253 vfs_dq_init(dir); 253 dquot_initialize(dir);
254 254
255 de = ufs_find_entry(dir, &dentry->d_name, &page); 255 de = ufs_find_entry(dir, &dentry->d_name, &page);
256 if (!de) 256 if (!de)
@@ -296,8 +296,8 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
296 struct ufs_dir_entry *old_de; 296 struct ufs_dir_entry *old_de;
297 int err = -ENOENT; 297 int err = -ENOENT;
298 298
299 vfs_dq_init(old_dir); 299 dquot_initialize(old_dir);
300 vfs_dq_init(new_dir); 300 dquot_initialize(new_dir);
301 301
302 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); 302 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
303 if (!old_de) 303 if (!old_de)
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index e5ef8a3ec230..d3b6270cb377 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -528,7 +528,7 @@ static int ufs_setattr(struct dentry *dentry, struct iattr *attr)
528 attr->ia_size != i_size_read(inode)) { 528 attr->ia_size != i_size_read(inode)) {
529 loff_t old_i_size = inode->i_size; 529 loff_t old_i_size = inode->i_size;
530 530
531 vfs_dq_init(inode); 531 dquot_initialize(inode);
532 532
533 error = vmtruncate(inode, attr->ia_size); 533 error = vmtruncate(inode, attr->ia_size);
534 if (error) 534 if (error)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index aec2e9dac2d7..4aa93554f0eb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -295,7 +295,6 @@ struct quota_format_ops {
295 295
296/* Operations working with dquots */ 296/* Operations working with dquots */
297struct dquot_operations { 297struct dquot_operations {
298 int (*initialize) (struct inode *, int);
299 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 298 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
300 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */ 299 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
301 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */ 300 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 93ac788345e2..e6fa7acce290 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -23,7 +23,7 @@ void inode_add_rsv_space(struct inode *inode, qsize_t number);
23void inode_claim_rsv_space(struct inode *inode, qsize_t number); 23void inode_claim_rsv_space(struct inode *inode, qsize_t number);
24void inode_sub_rsv_space(struct inode *inode, qsize_t number); 24void inode_sub_rsv_space(struct inode *inode, qsize_t number);
25 25
26int dquot_initialize(struct inode *inode, int type); 26void dquot_initialize(struct inode *inode);
27void dquot_drop(struct inode *inode); 27void dquot_drop(struct inode *inode);
28struct dquot *dqget(struct super_block *sb, unsigned int id, int type); 28struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
29void dqput(struct dquot *dquot); 29void dqput(struct dquot *dquot);
@@ -139,15 +139,6 @@ extern const struct quotactl_ops vfs_quotactl_ops;
139#define sb_dquot_ops (&dquot_operations) 139#define sb_dquot_ops (&dquot_operations)
140#define sb_quotactl_ops (&vfs_quotactl_ops) 140#define sb_quotactl_ops (&vfs_quotactl_ops)
141 141
142/* It is better to call this function outside of any transaction as it might
143 * need a lot of space in journal for dquot structure allocation. */
144static inline void vfs_dq_init(struct inode *inode)
145{
146 BUG_ON(!inode->i_sb);
147 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
148 inode->i_sb->dq_op->initialize(inode, -1);
149}
150
151/* Cannot be called inside a transaction */ 142/* Cannot be called inside a transaction */
152static inline int vfs_dq_off(struct super_block *sb, int remount) 143static inline int vfs_dq_off(struct super_block *sb, int remount)
153{ 144{
@@ -207,7 +198,7 @@ static inline int sb_any_quota_active(struct super_block *sb)
207#define sb_dquot_ops (NULL) 198#define sb_dquot_ops (NULL)
208#define sb_quotactl_ops (NULL) 199#define sb_quotactl_ops (NULL)
209 200
210static inline void vfs_dq_init(struct inode *inode) 201static inline void dquot_initialize(struct inode *inode)
211{ 202{
212} 203}
213 204
@@ -260,6 +251,8 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
260 return 0; 251 return 0;
261} 252}
262 253
254#define dquot_file_open generic_file_open
255
263#endif /* CONFIG_QUOTA */ 256#endif /* CONFIG_QUOTA */
264 257
265static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) 258static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
@@ -344,6 +337,4 @@ static inline void dquot_release_reservation_block(struct inode *inode,
344 __dquot_free_space(inode, nr << inode->i_blkbits, 1); 337 __dquot_free_space(inode, nr << inode->i_blkbits, 1);
345} 338}
346 339
347#define dquot_file_open generic_file_open
348
349#endif /* _LINUX_QUOTAOPS_ */ 340#endif /* _LINUX_QUOTAOPS_ */