--------------------------- dquot_operations -------------------------------
prototypes:
- int (*initialize) (struct inode *, int);
int (*write_dquot) (struct dquot *);
int (*acquire_dquot) (struct dquot *);
int (*release_dquot) (struct dquot *);
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
#include <linux/time.h>
#include <linux/pagemap.h>
+#include <linux/quotaops.h>
#include "ext2.h"
#include "xattr.h"
#include "acl.h"
goto fail_drop;
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto fail_drop;
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))
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);
{
struct inode *inode;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ext2_new_inode(dir, mode);
if (IS_ERR(inode))
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ext2_new_inode (dir, mode);
err = PTR_ERR(inode);
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);
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);
if (dir->i_nlink >= EXT2_LINK_MAX)
goto out;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode_inc_link_count(dir);
struct page * page;
int err = -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
de = ext2_find_entry (dir, &dentry->d_name, &page);
if (!de)
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)
#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"
* 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);
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;
handle_t *handle;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
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;
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
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) +
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) +
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) +
/* 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))
/* 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))
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) +
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
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);
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,
}
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",
* 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()
*
*/
#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"
* 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);
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;
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);
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;
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) +
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) +
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) +
/* 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))
/* 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))
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) +
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
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);
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
}
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",
* 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()
*
*/
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);
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)) {
/*
* Free the inode from the quota allocation.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
dquot_free_inode(inode);
dquot_drop(inode);
}
/*
* Allocate inode to quota.
*/
- vfs_dq_init(inode);
+ dquot_initialize(inode);
rc = dquot_alloc_inode(inode);
if (rc)
goto fail_drop;
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
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) {
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)) {
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;
if (ip->i_nlink == 0)
return -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
tid = txBegin(ip->i_sb, 0);
jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name);
- vfs_dq_init(dip);
+ dquot_initialize(dip);
ssize = strlen(name) + 1;
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;
} else if (new_ip) {
IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL);
/* Init inode for quota operations. */
- vfs_dq_init(new_ip);
+ dquot_initialize(new_ip);
}
/*
jfs_info("jfs_mknod: %s", dentry->d_name.name);
- vfs_dq_init(dir);
+ dquot_initialize(dir);
if ((rc = get_UCSname(&dname, dentry)))
goto out;
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);
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) {
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
} else
inode->i_gid = current_fsgid();
inode->i_mode = mode;
- vfs_dq_init(inode);
+ dquot_initialize(inode);
return inode;
}
(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);
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) {
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);
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);
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);
}
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,
}
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)
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)
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
}
/*
- * 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++) {
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);
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;
}
* 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,
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);
int err;
if (!is_bad_inode(inode))
- vfs_dq_init(inode);
+ dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0);
BUG_ON(!th->t_trans_id);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err)
goto out_end_trans;
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
}
/* 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.
*/
} else {
inode->i_gid = current_fsgid();
}
- vfs_dq_init(inode);
+ dquot_initialize(inode);
return 0;
}
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;
if (!new_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
if (!(inode = new_inode(dir->i_sb))) {
return -ENOMEM;
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 */
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);
unsigned long savelink;
int depth;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = dentry->d_inode;
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;
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) {
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;
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.
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,
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)) {
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);
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);
int err;
struct udf_inode_info *iinfo;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode = udf_new_inode(dir, mode, &err);
if (!old_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
err = -EIO;
struct udf_inode_info *dinfo = UDF_I(dir);
struct udf_inode_info *iinfo;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
err = -EMLINK;
struct fileIdentDesc *fi, cfi;
struct kernel_lb_addr tloc;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retval = -ENOENT;
lock_kernel();
struct fileIdentDesc cfi;
struct kernel_lb_addr tloc;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
retval = -ENOENT;
lock_kernel();
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);
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) {
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);
*/
#include <linux/fs.h>
+#include <linux/quotaops.h>
#include "ufs_fs.h"
#include "ufs.h"
unlock_super (sb);
- vfs_dq_init(inode);
+ dquot_initialize(inode);
err = dquot_alloc_inode(inode);
if (err) {
dquot_drop(inode);
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))
UFSD("BEGIN\n");
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
if (!old_valid_dev(rdev))
return -EINVAL;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode = ufs_new_inode(dir, mode);
err = PTR_ERR(inode);
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);
return -EMLINK;
}
- vfs_dq_init(dir);
+ dquot_initialize(dir);
inode->i_ctime = CURRENT_TIME_SEC;
inode_inc_link_count(inode);
if (dir->i_nlink >= UFS_LINK_MAX)
goto out;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
lock_kernel();
inode_inc_link_count(dir);
struct page *page;
int err = -ENOENT;
- vfs_dq_init(dir);
+ dquot_initialize(dir);
de = ufs_find_entry(dir, &dentry->d_name, &page);
if (!de)
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)
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)
/* 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 */
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);
#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)
{
#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)
{
}
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)
__dquot_free_space(inode, nr << inode->i_blkbits, 1);
}
-#define dquot_file_open generic_file_open
-
#endif /* _LINUX_QUOTAOPS_ */