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>
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index fa10e4b..06bbbed 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -460,7 +460,6 @@
--------------------------- dquot_operations -------------------------------
prototypes:
- int (*initialize) (struct inode *, int);
int (*write_dquot) (struct dquot *);
int (*acquire_dquot) (struct dquot *);
int (*release_dquot) (struct dquot *);
@@ -473,7 +472,6 @@
What filesystem should expect from the generic quota functions:
FS recursion Held locks when called
-initialize: yes maybe dqonoff_sem
write_dquot: yes dqonoff_sem or dqptr_sem
acquire_dquot: yes dqonoff_sem or dqptr_sem
release_dquot: yes dqonoff_sem or dqptr_sem
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index d11f6e4..5d198d0 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -20,6 +20,7 @@
#include <linux/time.h>
#include <linux/pagemap.h>
+#include <linux/quotaops.h>
#include "ext2.h"
#include "xattr.h"
#include "acl.h"
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 88b7197..ad7d572 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -586,7 +586,7 @@
goto fail_drop;
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto fail_drop;
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index c87840c..45ff49f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -59,7 +59,7 @@
void ext2_delete_inode (struct inode * inode)
{
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
if (is_bad_inode(inode))
@@ -1461,7 +1461,7 @@
return error;
if (iattr->ia_valid & ATTR_SIZE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
error = dquot_transfer(inode, iattr);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 5923df7b..71efb0e 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -102,7 +102,7 @@
{
struct inode *inode;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ext2_new_inode(dir, mode);
if (IS_ERR(inode))
@@ -131,7 +131,7 @@
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ext2_new_inode (dir, mode);
err = PTR_ERR(inode);
@@ -157,7 +157,7 @@
if (l > sb->s_blocksize)
goto out;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ext2_new_inode (dir, S_IFLNK | S_IRWXUGO);
err = PTR_ERR(inode);
@@ -202,7 +202,7 @@
if (inode->i_nlink >= EXT2_LINK_MAX)
return -EMLINK;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode->i_ctime = CURRENT_TIME_SEC;
inode_inc_link_count(inode);
@@ -226,7 +226,7 @@
if (dir->i_nlink >= EXT2_LINK_MAX)
goto out;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode_inc_link_count(dir);
@@ -274,7 +274,7 @@
struct page * page;
int err = -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
de = ext2_find_entry (dir, &dentry->d_name, &page);
if (!de)
@@ -318,8 +318,8 @@
struct ext2_dir_entry_2 * old_de;
int err = -ENOENT;
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_de = ext2_find_entry (old_dir, &old_dentry->d_name, &old_page);
if (!old_de)
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 3c7fb11..f55df0e 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -21,6 +21,7 @@
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/jbd.h>
+#include <linux/quotaops.h>
#include <linux/ext3_fs.h>
#include <linux/ext3_jbd.h>
#include "xattr.h"
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 7d7238f..ef9008b 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -123,7 +123,7 @@
* Note: we must free any quota before locking the superblock,
* as writing the quota to disk may need the lock as well.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
ext3_xattr_delete_inode(handle, inode);
dquot_free_inode(inode);
dquot_drop(inode);
@@ -588,7 +588,7 @@
sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
ret = inode;
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto fail_drop;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index d7962b0..ffbbc65 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -197,7 +197,7 @@
handle_t *handle;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
@@ -3152,7 +3152,7 @@
return error;
if (ia_valid & ATTR_SIZE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
handle_t *handle;
@@ -3250,7 +3250,7 @@
ret = 2 * (bpp + indirects) + 2;
#ifdef CONFIG_QUOTA
- /* We know that structure was already allocated during vfs_dq_init so
+ /* We know that structure was already allocated during dquot_initialize so
* we will be updating only the data blocks + inodes */
ret += EXT3_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
#endif
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index a492b37..ee18408 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1696,7 +1696,7 @@
struct inode * inode;
int err, retries = 0;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1732,7 +1732,7 @@
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1770,7 +1770,7 @@
if (dir->i_nlink >= EXT3_LINK_MAX)
return -EMLINK;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2066,8 +2066,8 @@
/* Initialize quotas before so that eventual writes go in
* separate transaction */
- vfs_dq_init(dir);
- vfs_dq_init(dentry->d_inode);
+ dquot_initialize(dir);
+ dquot_initialize(dentry->d_inode);
handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
@@ -2127,8 +2127,8 @@
/* Initialize quotas before so that eventual writes go
* in separate transaction */
- vfs_dq_init(dir);
- vfs_dq_init(dentry->d_inode);
+ dquot_initialize(dir);
+ dquot_initialize(dentry->d_inode);
handle = ext3_journal_start(dir, EXT3_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
@@ -2184,7 +2184,7 @@
if (l > dir->i_sb->s_blocksize)
return -ENAMETOOLONG;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2241,7 +2241,7 @@
if (inode->i_nlink >= EXT3_LINK_MAX)
return -EMLINK;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
/*
* Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
@@ -2293,15 +2293,15 @@
struct ext3_dir_entry_2 * old_de, * new_de;
int retval, flush_file = 0;
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_bh = new_bh = dir_bh = NULL;
/* Initialize quotas before so that eventual writes go
* in separate transaction */
if (new_dentry->d_inode)
- vfs_dq_init(new_dentry->d_inode);
+ dquot_initialize(new_dentry->d_inode);
handle = ext3_journal_start(old_dir, 2 *
EXT3_DATA_TRANS_BLOCKS(old_dir->i_sb) +
EXT3_INDEX_EXTRA_TRANS_BLOCKS + 2);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 0163d0d..e844acc 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -752,7 +752,6 @@
const char *data, size_t len, loff_t off);
static const struct dquot_operations ext3_quota_operations = {
- .initialize = dquot_initialize,
.write_dquot = ext3_write_dquot,
.acquire_dquot = ext3_acquire_dquot,
.release_dquot = ext3_release_dquot,
@@ -1480,7 +1479,7 @@
}
list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (inode->i_nlink) {
printk(KERN_DEBUG
"%s: truncating inode %lu to %Ld bytes\n",
@@ -2736,7 +2735,7 @@
* Process 1 Process 2
* ext3_create() quota_sync()
* journal_start() write_dquot()
- * vfs_dq_init() down(dqio_mutex)
+ * dquot_initialize() down(dqio_mutex)
* down(dqio_mutex) journal_start()
*
*/
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 85fa464..a08a129 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -23,6 +23,7 @@
#include <linux/jbd2.h>
#include <linux/mount.h>
#include <linux/path.h>
+#include <linux/quotaops.h>
#include "ext4.h"
#include "ext4_jbd2.h"
#include "xattr.h"
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index ca8986e..9bb2bb9 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -217,7 +217,7 @@
* Note: we must free any quota before locking the superblock,
* as writing the quota to disk may need the lock as well.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
ext4_xattr_delete_inode(handle, inode);
dquot_free_inode(inode);
dquot_drop(inode);
@@ -1034,7 +1034,7 @@
ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
ret = inode;
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto fail_drop;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index eaa22ae..bec222c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -171,7 +171,7 @@
int err;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (ext4_should_order_data(inode))
ext4_begin_ordered_truncate(inode, 0);
@@ -5255,7 +5255,7 @@
return error;
if (ia_valid & ATTR_SIZE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
handle_t *handle;
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 20f55c2..7f3d2d7 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1766,7 +1766,7 @@
struct inode *inode;
int err, retries = 0;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1802,7 +1802,7 @@
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -1841,7 +1841,7 @@
if (EXT4_DIR_LINK_MAX(dir))
return -EMLINK;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2142,8 +2142,8 @@
/* Initialize quotas before so that eventual writes go in
* separate transaction */
- vfs_dq_init(dir);
- vfs_dq_init(dentry->d_inode);
+ dquot_initialize(dir);
+ dquot_initialize(dentry->d_inode);
handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
@@ -2203,8 +2203,8 @@
/* Initialize quotas before so that eventual writes go
* in separate transaction */
- vfs_dq_init(dir);
- vfs_dq_init(dentry->d_inode);
+ dquot_initialize(dir);
+ dquot_initialize(dentry->d_inode);
handle = ext4_journal_start(dir, EXT4_DELETE_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle))
@@ -2260,7 +2260,7 @@
if (l > dir->i_sb->s_blocksize)
return -ENAMETOOLONG;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retry:
handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2320,7 +2320,7 @@
if (inode->i_nlink >= EXT4_LINK_MAX)
return -EMLINK;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
/*
* Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
@@ -2372,15 +2372,15 @@
struct ext4_dir_entry_2 *old_de, *new_de;
int retval, force_da_alloc = 0;
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_bh = new_bh = dir_bh = NULL;
/* Initialize quotas before so that eventual writes go
* in separate transaction */
if (new_dentry->d_inode)
- vfs_dq_init(new_dentry->d_inode);
+ dquot_initialize(new_dentry->d_inode);
handle = ext4_journal_start(old_dir, 2 *
EXT4_DATA_TRANS_BLOCKS(old_dir->i_sb) +
EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 035516c8..edcf3b0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1013,7 +1013,6 @@
const char *data, size_t len, loff_t off);
static const struct dquot_operations ext4_quota_operations = {
- .initialize = dquot_initialize,
#ifdef CONFIG_QUOTA
.get_reserved_space = ext4_get_reserved_space,
#endif
@@ -1931,7 +1930,7 @@
}
list_add(&EXT4_I(inode)->i_orphan, &EXT4_SB(sb)->s_orphan);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (inode->i_nlink) {
ext4_msg(sb, KERN_DEBUG,
"%s: truncating inode %lu to %lld bytes",
@@ -3700,7 +3699,7 @@
* Process 1 Process 2
* ext4_create() quota_sync()
* jbd2_journal_start() write_dquot()
- * vfs_dq_init() down(dqio_mutex)
+ * dquot_initialize() down(dqio_mutex)
* down(dqio_mutex) jbd2_journal_start()
*
*/
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index f19bb33..14ba982 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -99,7 +99,7 @@
return rc;
if (iattr->ia_valid & ATTR_SIZE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
rc = dquot_transfer(inode, iattr);
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 1aa2dda..c694a5f 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -147,7 +147,7 @@
jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (!is_bad_inode(inode) &&
(JFS_IP(inode)->fileset == FILESYSTEM_I)) {
@@ -161,7 +161,7 @@
/*
* Free the inode from the quota allocation.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
dquot_free_inode(inode);
dquot_drop(inode);
}
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 72b3089..829921b 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -116,7 +116,7 @@
/*
* Allocate inode to quota.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
rc = dquot_alloc_inode(inode);
if (rc)
goto fail_drop;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index b7cc29d..4a3e9f3 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -85,7 +85,7 @@
jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name);
- vfs_dq_init(dip);
+ dquot_initialize(dip);
/*
* search parent directory for entry/freespace
@@ -217,7 +217,7 @@
jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name);
- vfs_dq_init(dip);
+ dquot_initialize(dip);
/* link count overflow on parent directory ? */
if (dip->i_nlink == JFS_LINK_MAX) {
@@ -360,8 +360,8 @@
jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name);
/* Init inode for quota operations. */
- vfs_dq_init(dip);
- vfs_dq_init(ip);
+ dquot_initialize(dip);
+ dquot_initialize(ip);
/* directory must be empty to be removed */
if (!dtEmpty(ip)) {
@@ -488,8 +488,8 @@
jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name);
/* Init inode for quota operations. */
- vfs_dq_init(dip);
- vfs_dq_init(ip);
+ dquot_initialize(dip);
+ dquot_initialize(ip);
if ((rc = get_UCSname(&dname, dentry)))
goto out;
@@ -811,7 +811,7 @@
if (ip->i_nlink == 0)
return -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
tid = txBegin(ip->i_sb, 0);
@@ -904,7 +904,7 @@
jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name);
- vfs_dq_init(dip);
+ dquot_initialize(dip);
ssize = strlen(name) + 1;
@@ -1097,8 +1097,8 @@
jfs_info("jfs_rename: %s %s", old_dentry->d_name.name,
new_dentry->d_name.name);
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_ip = old_dentry->d_inode;
new_ip = new_dentry->d_inode;
@@ -1149,7 +1149,7 @@
} else if (new_ip) {
IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
/* Init inode for quota operations. */
- vfs_dq_init(new_ip);
+ dquot_initialize(new_ip);
}
/*
@@ -1373,7 +1373,7 @@
jfs_info("jfs_mknod: %s", dentry->d_name.name);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
if ((rc = get_UCSname(&dname, dentry)))
goto out;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 126198f..3641052 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -108,7 +108,7 @@
file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name);
if (file->f_mode & FMODE_WRITE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
spin_lock(&oi->ip_lock);
@@ -980,7 +980,7 @@
size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE;
if (size_change) {
- vfs_dq_init(inode);
+ dquot_initialize(inode);
status = ocfs2_rw_lock(inode, 1);
if (status < 0) {
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 77681a6..278a223 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -971,7 +971,7 @@
goto bail;
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (!ocfs2_inode_is_valid_to_delete(inode)) {
/* It's probably not necessary to truncate_inode_pages
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 8b5b142..d9cd4e3 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -212,7 +212,7 @@
} else
inode->i_gid = current_fsgid();
inode->i_mode = mode;
- vfs_dq_init(inode);
+ dquot_initialize(inode);
return inode;
}
@@ -244,7 +244,7 @@
(unsigned long)dev, dentry->d_name.len,
dentry->d_name.name);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
/* get our super block */
osb = OCFS2_SB(dir->i_sb);
@@ -634,7 +634,7 @@
if (S_ISDIR(inode->i_mode))
return -EPERM;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT);
if (err < 0) {
@@ -791,7 +791,7 @@
mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry,
dentry->d_name.len, dentry->d_name.name);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
BUG_ON(dentry->d_parent->d_inode != dir);
@@ -1053,8 +1053,8 @@
old_dentry->d_name.len, old_dentry->d_name.name,
new_dentry->d_name.len, new_dentry->d_name.name);
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
osb = OCFS2_SB(old_dir->i_sb);
@@ -1604,7 +1604,7 @@
mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir,
dentry, symname, dentry->d_name.len, dentry->d_name.name);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
sb = dir->i_sb;
osb = OCFS2_SB(sb);
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 4dca38f..355f41d 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -851,7 +851,6 @@
}
const struct dquot_operations ocfs2_quota_operations = {
- .initialize = dquot_initialize,
.write_dquot = ocfs2_write_dquot,
.acquire_dquot = ocfs2_acquire_dquot,
.release_dquot = ocfs2_release_dquot,
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 8ae65c9..f3ae10c 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -4390,7 +4390,7 @@
}
mutex_lock(&inode->i_mutex);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve);
mutex_unlock(&inode->i_mutex);
if (!error)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 6244bca..3c0a7e0 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -230,6 +230,7 @@
EXPORT_SYMBOL(dqstats);
static qsize_t inode_get_rsv_space(struct inode *inode);
+static void __dquot_initialize(struct inode *inode, int type);
static inline unsigned int
hashfn(const struct super_block *sb, unsigned int id, int type)
@@ -890,7 +891,7 @@
spin_unlock(&inode_lock);
iput(old_inode);
- sb->dq_op->initialize(inode, type);
+ __dquot_initialize(inode, type);
/* We hold a reference to 'inode' so it couldn't have been
* removed from s_inodes list while we dropped the inode_lock.
* We cannot iput the inode now as we can be holding the last
@@ -1293,22 +1294,26 @@
}
/*
- * Initialize quota pointers in inode
- * We do things in a bit complicated way but by that we avoid calling
- * dqget() and thus filesystem callbacks under dqptr_sem.
+ * Initialize quota pointers in inode
+ *
+ * We do things in a bit complicated way but by that we avoid calling
+ * dqget() and thus filesystem callbacks under dqptr_sem.
+ *
+ * It is better to call this function outside of any transaction as it
+ * might need a lot of space in journal for dquot structure allocation.
*/
-int dquot_initialize(struct inode *inode, int type)
+static void __dquot_initialize(struct inode *inode, int type)
{
unsigned int id = 0;
- int cnt, ret = 0;
+ int cnt;
struct dquot *got[MAXQUOTAS];
struct super_block *sb = inode->i_sb;
qsize_t rsv;
/* First test before acquiring mutex - solves deadlocks when we
* re-enter the quota code and are already holding the mutex */
- if (IS_NOQUOTA(inode))
- return 0;
+ if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
+ return;
/* First get references to structures we might need. */
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
@@ -1351,7 +1356,11 @@
up_write(&sb_dqopt(sb)->dqptr_sem);
/* Drop unused references */
dqput_all(got);
- return ret;
+}
+
+void dquot_initialize(struct inode *inode)
+{
+ __dquot_initialize(inode, -1);
}
EXPORT_SYMBOL(dquot_initialize);
@@ -1783,7 +1792,7 @@
chid[GRPQUOTA] = iattr->ia_gid;
}
if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (__dquot_transfer(inode, chid, mask) == NO_QUOTA)
return -EDQUOT;
}
@@ -1810,7 +1819,6 @@
* Definitions of diskquota operations.
*/
const struct dquot_operations dquot_operations = {
- .initialize = dquot_initialize,
.write_dquot = dquot_commit,
.acquire_dquot = dquot_acquire,
.release_dquot = dquot_release,
@@ -1829,7 +1837,7 @@
error = generic_file_open(inode, file);
if (!error && (file->f_mode & FMODE_WRITE))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
return error;
}
EXPORT_SYMBOL(dquot_file_open);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 06995cb..b8671a5 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -35,7 +35,7 @@
int err;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
@@ -1768,7 +1768,7 @@
BUG_ON(!th->t_trans_id);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto out_end_trans;
@@ -3076,7 +3076,7 @@
depth = reiserfs_write_lock_once(inode->i_sb);
if (attr->ia_valid & ATTR_SIZE) {
- vfs_dq_init(inode);
+ dquot_initialize(inode);
/* version 2 items will be caught by the s_maxbytes check
** done for us in vmtruncate
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index c55e1b9..96e4cbb 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -554,7 +554,7 @@
}
/* utility function that does setup for reiserfs_new_inode.
-** vfs_dq_init needs lots of credits so it's better to have it
+** dquot_initialize needs lots of credits so it's better to have it
** outside of a transaction, so we had to pull some bits of
** reiserfs_new_inode out into this func.
*/
@@ -577,7 +577,7 @@
} else {
inode->i_gid = current_fsgid();
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
return 0;
}
@@ -594,7 +594,7 @@
struct reiserfs_transaction_handle th;
struct reiserfs_security_handle security;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM;
@@ -668,7 +668,7 @@
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM;
@@ -743,7 +743,7 @@
2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
- vfs_dq_init(dir);
+ dquot_initialize(dir);
#ifdef DISPLACE_NEW_PACKING_LOCALITIES
/* set flag that new packing locality created and new blocks for the content * of that directory are not displaced yet */
@@ -848,7 +848,7 @@
JOURNAL_PER_BALANCE_CNT * 2 + 2 +
4 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
reiserfs_write_lock(dir->i_sb);
retval = journal_begin(&th, dir->i_sb, jbegin_count);
@@ -931,7 +931,7 @@
unsigned long savelink;
int depth;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = dentry->d_inode;
@@ -1034,7 +1034,7 @@
2 * (REISERFS_QUOTA_INIT_BLOCKS(parent_dir->i_sb) +
REISERFS_QUOTA_TRANS_BLOCKS(parent_dir->i_sb));
- vfs_dq_init(parent_dir);
+ dquot_initialize(parent_dir);
if (!(inode = new_inode(parent_dir->i_sb))) {
return -ENOMEM;
@@ -1123,7 +1123,7 @@
JOURNAL_PER_BALANCE_CNT * 3 +
2 * REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
reiserfs_write_lock(dir->i_sb);
if (inode->i_nlink >= REISERFS_LINK_MAX) {
@@ -1249,8 +1249,8 @@
JOURNAL_PER_BALANCE_CNT * 3 + 5 +
4 * REISERFS_QUOTA_TRANS_BLOCKS(old_dir->i_sb);
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_inode = old_dentry->d_inode;
new_dentry_inode = new_dentry->d_inode;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 34f7cd0..04bf5d7 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -246,7 +246,7 @@
retval = remove_save_link_only(s, &save_link_key, 0);
continue;
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if (truncate && S_ISDIR(inode->i_mode)) {
/* We got a truncate request for a dir which is impossible.
@@ -622,7 +622,6 @@
static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
static const struct dquot_operations reiserfs_quota_operations = {
- .initialize = dquot_initialize,
.write_dquot = reiserfs_write_dquot,
.acquire_dquot = reiserfs_acquire_dquot,
.release_dquot = reiserfs_release_dquot,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 013fa44..1eb0677 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -228,7 +228,7 @@
return error;
if (iattr->ia_valid & ATTR_SIZE)
- vfs_dq_init(inode);
+ dquot_initialize(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 15c6e99..fb68c9c 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -153,7 +153,7 @@
insert_inode_hash(inode);
mark_inode_dirty(inode);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
ret = dquot_alloc_inode(inode);
if (ret) {
dquot_drop(inode);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index f195202..c7da1a3 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -72,7 +72,7 @@
void udf_delete_inode(struct inode *inode)
{
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index e360c3f..96757e3 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -563,7 +563,7 @@
int err;
struct udf_inode_info *iinfo;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode = udf_new_inode(dir, mode, &err);
@@ -618,7 +618,7 @@
if (!old_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
err = -EIO;
@@ -666,7 +666,7 @@
struct udf_inode_info *dinfo = UDF_I(dir);
struct udf_inode_info *iinfo;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
err = -EMLINK;
@@ -805,7 +805,7 @@
struct fileIdentDesc *fi, cfi;
struct kernel_lb_addr tloc;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retval = -ENOENT;
lock_kernel();
@@ -853,7 +853,7 @@
struct fileIdentDesc cfi;
struct kernel_lb_addr tloc;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retval = -ENOENT;
lock_kernel();
@@ -909,7 +909,7 @@
struct buffer_head *bh;
struct udf_inode_info *iinfo;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode = udf_new_inode(dir, S_IFLNK, &err);
@@ -1081,7 +1081,7 @@
int err;
struct buffer_head *bh;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
@@ -1145,8 +1145,8 @@
struct kernel_lb_addr tloc;
struct udf_inode_info *old_iinfo = UDF_I(old_inode);
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
lock_kernel();
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 d84762f..a8962ce 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -24,6 +24,7 @@
*/
#include <linux/fs.h>
+#include <linux/quotaops.h>
#include "ufs_fs.h"
#include "ufs.h"
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 67b4bdb..230ecf6 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -355,7 +355,7 @@
unlock_super (sb);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err) {
dquot_drop(inode);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index fff8eda..09aef49 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -910,7 +910,7 @@
loff_t old_i_size;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
if (is_bad_inode(inode))
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index c33cb90..1185562 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -86,7 +86,7 @@
UFSD("BEGIN\n");
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
@@ -112,7 +112,7 @@
if (!old_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
@@ -138,7 +138,7 @@
if (l > sb->s_blocksize)
goto out_notlocked;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
@@ -185,7 +185,7 @@
return -EMLINK;
}
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode->i_ctime = CURRENT_TIME_SEC;
inode_inc_link_count(inode);
@@ -204,7 +204,7 @@
if (dir->i_nlink >= UFS_LINK_MAX)
goto out;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode_inc_link_count(dir);
@@ -250,7 +250,7 @@
struct page *page;
int err = -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
de = ufs_find_entry(dir, &dentry->d_name, &page);
if (!de)
@@ -296,8 +296,8 @@
struct ufs_dir_entry *old_de;
int err = -ENOENT;
- vfs_dq_init(old_dir);
- vfs_dq_init(new_dir);
+ dquot_initialize(old_dir);
+ dquot_initialize(new_dir);
old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
if (!old_de)
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index e5ef8a3..d3b6270 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -528,7 +528,7 @@
attr->ia_size != i_size_read(inode)) {
loff_t old_i_size = inode->i_size;
- vfs_dq_init(inode);
+ dquot_initialize(inode);
error = vmtruncate(inode, attr->ia_size);
if (error)
diff --git a/include/linux/quota.h b/include/linux/quota.h
index aec2e9d..4aa9355 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -295,7 +295,6 @@
/* Operations working with dquots */
struct dquot_operations {
- int (*initialize) (struct inode *, int);
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 93ac788..e6fa7ac 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -23,7 +23,7 @@
void inode_claim_rsv_space(struct inode *inode, qsize_t number);
void inode_sub_rsv_space(struct inode *inode, qsize_t number);
-int dquot_initialize(struct inode *inode, int type);
+void dquot_initialize(struct inode *inode);
void dquot_drop(struct inode *inode);
struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
void dqput(struct dquot *dquot);
@@ -139,15 +139,6 @@
#define sb_dquot_ops (&dquot_operations)
#define sb_quotactl_ops (&vfs_quotactl_ops)
-/* It is better to call this function outside of any transaction as it might
- * need a lot of space in journal for dquot structure allocation. */
-static inline void vfs_dq_init(struct inode *inode)
-{
- BUG_ON(!inode->i_sb);
- if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
- inode->i_sb->dq_op->initialize(inode, -1);
-}
-
/* Cannot be called inside a transaction */
static inline int vfs_dq_off(struct super_block *sb, int remount)
{
@@ -207,7 +198,7 @@
#define sb_dquot_ops (NULL)
#define sb_quotactl_ops (NULL)
-static inline void vfs_dq_init(struct inode *inode)
+static inline void dquot_initialize(struct inode *inode)
{
}
@@ -260,6 +251,8 @@
return 0;
}
+#define dquot_file_open generic_file_open
+
#endif /* CONFIG_QUOTA */
static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
@@ -344,6 +337,4 @@
__dquot_free_space(inode, nr << inode->i_blkbits, 1);
}
-#define dquot_file_open generic_file_open
-
#endif /* _LINUX_QUOTAOPS_ */