dquot: cleanup inode allocation / freeing routines
Get rid of the alloc_inode and free_inode dquot operations - they are always called from the filesystem and if a filesystem really needs their own (which none currently does) it can just call into it's own routine directly. Also get rid of the vfs_dq_alloc/vfs_dq_free wrappers and always call the lowlevel dquot_alloc_inode / dqout_free_inode routines directly, which now lose the number argument which is always 1. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
5dd4056db8
commit
63936ddaa1
|
@ -462,8 +462,6 @@ in sys_read() and friends.
|
||||||
prototypes:
|
prototypes:
|
||||||
int (*initialize) (struct inode *, int);
|
int (*initialize) (struct inode *, int);
|
||||||
int (*drop) (struct inode *);
|
int (*drop) (struct inode *);
|
||||||
int (*alloc_inode) (const struct inode *, unsigned long);
|
|
||||||
int (*free_inode) (const struct inode *, unsigned long);
|
|
||||||
int (*transfer) (struct inode *, struct iattr *);
|
int (*transfer) (struct inode *, struct iattr *);
|
||||||
int (*write_dquot) (struct dquot *);
|
int (*write_dquot) (struct dquot *);
|
||||||
int (*acquire_dquot) (struct dquot *);
|
int (*acquire_dquot) (struct dquot *);
|
||||||
|
@ -479,8 +477,6 @@ What filesystem should expect from the generic quota functions:
|
||||||
FS recursion Held locks when called
|
FS recursion Held locks when called
|
||||||
initialize: yes maybe dqonoff_sem
|
initialize: yes maybe dqonoff_sem
|
||||||
drop: yes -
|
drop: yes -
|
||||||
alloc_inode: ->mark_dirty() -
|
|
||||||
free_inode: ->mark_dirty() -
|
|
||||||
transfer: yes -
|
transfer: yes -
|
||||||
write_dquot: yes dqonoff_sem or dqptr_sem
|
write_dquot: yes dqonoff_sem or dqptr_sem
|
||||||
acquire_dquot: yes dqonoff_sem or dqptr_sem
|
acquire_dquot: yes dqonoff_sem or dqptr_sem
|
||||||
|
@ -491,10 +487,6 @@ write_info: yes dqonoff_sem
|
||||||
FS recursion means calling ->quota_read() and ->quota_write() from superblock
|
FS recursion means calling ->quota_read() and ->quota_write() from superblock
|
||||||
operations.
|
operations.
|
||||||
|
|
||||||
->alloc_inode(), ->free_inode() are called
|
|
||||||
only directly by the filesystem and do not call any fs functions only
|
|
||||||
the ->mark_dirty() operation.
|
|
||||||
|
|
||||||
More details about quota locking can be found in fs/dquot.c.
|
More details about quota locking can be found in fs/dquot.c.
|
||||||
|
|
||||||
--------------------------- vm_operations_struct -----------------------------
|
--------------------------- vm_operations_struct -----------------------------
|
||||||
|
|
|
@ -121,7 +121,7 @@ void ext2_free_inode (struct inode * inode)
|
||||||
if (!is_bad_inode(inode)) {
|
if (!is_bad_inode(inode)) {
|
||||||
/* Quota is already initialized in iput() */
|
/* Quota is already initialized in iput() */
|
||||||
ext2_xattr_delete_inode(inode);
|
ext2_xattr_delete_inode(inode);
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,10 +586,10 @@ got:
|
||||||
goto fail_drop;
|
goto fail_drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
err = -EDQUOT;
|
err = dquot_alloc_inode(inode);
|
||||||
|
if (err)
|
||||||
goto fail_drop;
|
goto fail_drop;
|
||||||
}
|
|
||||||
|
|
||||||
err = ext2_init_acl(inode, dir);
|
err = ext2_init_acl(inode, dir);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -605,7 +605,7 @@ got:
|
||||||
return inode;
|
return inode;
|
||||||
|
|
||||||
fail_free_drop:
|
fail_free_drop:
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
fail_drop:
|
fail_drop:
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
|
@ -125,7 +125,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
|
||||||
*/
|
*/
|
||||||
vfs_dq_init(inode);
|
vfs_dq_init(inode);
|
||||||
ext3_xattr_delete_inode(handle, inode);
|
ext3_xattr_delete_inode(handle, inode);
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
||||||
is_directory = S_ISDIR(inode->i_mode);
|
is_directory = S_ISDIR(inode->i_mode);
|
||||||
|
@ -588,10 +588,10 @@ got:
|
||||||
sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
|
sizeof(struct ext3_inode) - EXT3_GOOD_OLD_INODE_SIZE : 0;
|
||||||
|
|
||||||
ret = inode;
|
ret = inode;
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
err = -EDQUOT;
|
err = dquot_alloc_inode(inode);
|
||||||
|
if (err)
|
||||||
goto fail_drop;
|
goto fail_drop;
|
||||||
}
|
|
||||||
|
|
||||||
err = ext3_init_acl(handle, inode, dir);
|
err = ext3_init_acl(handle, inode, dir);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -619,7 +619,7 @@ really_out:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fail_free_drop:
|
fail_free_drop:
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
fail_drop:
|
fail_drop:
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
|
@ -752,8 +752,6 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
|
||||||
static const struct dquot_operations ext3_quota_operations = {
|
static const struct dquot_operations ext3_quota_operations = {
|
||||||
.initialize = dquot_initialize,
|
.initialize = dquot_initialize,
|
||||||
.drop = dquot_drop,
|
.drop = dquot_drop,
|
||||||
.alloc_inode = dquot_alloc_inode,
|
|
||||||
.free_inode = dquot_free_inode,
|
|
||||||
.transfer = dquot_transfer,
|
.transfer = dquot_transfer,
|
||||||
.write_dquot = ext3_write_dquot,
|
.write_dquot = ext3_write_dquot,
|
||||||
.acquire_dquot = ext3_acquire_dquot,
|
.acquire_dquot = ext3_acquire_dquot,
|
||||||
|
|
|
@ -219,7 +219,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
|
||||||
*/
|
*/
|
||||||
vfs_dq_init(inode);
|
vfs_dq_init(inode);
|
||||||
ext4_xattr_delete_inode(handle, inode);
|
ext4_xattr_delete_inode(handle, inode);
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
||||||
is_directory = S_ISDIR(inode->i_mode);
|
is_directory = S_ISDIR(inode->i_mode);
|
||||||
|
@ -1034,10 +1034,10 @@ got:
|
||||||
ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
|
ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
|
||||||
|
|
||||||
ret = inode;
|
ret = inode;
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
err = -EDQUOT;
|
err = dquot_alloc_inode(inode);
|
||||||
|
if (err)
|
||||||
goto fail_drop;
|
goto fail_drop;
|
||||||
}
|
|
||||||
|
|
||||||
err = ext4_init_acl(handle, inode, dir);
|
err = ext4_init_acl(handle, inode, dir);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -1074,7 +1074,7 @@ really_out:
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
fail_free_drop:
|
fail_free_drop:
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
fail_drop:
|
fail_drop:
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
|
@ -1017,8 +1017,6 @@ static const struct dquot_operations ext4_quota_operations = {
|
||||||
#ifdef CONFIG_QUOTA
|
#ifdef CONFIG_QUOTA
|
||||||
.get_reserved_space = ext4_get_reserved_space,
|
.get_reserved_space = ext4_get_reserved_space,
|
||||||
#endif
|
#endif
|
||||||
.alloc_inode = dquot_alloc_inode,
|
|
||||||
.free_inode = dquot_free_inode,
|
|
||||||
.transfer = dquot_transfer,
|
.transfer = dquot_transfer,
|
||||||
.write_dquot = ext4_write_dquot,
|
.write_dquot = ext4_write_dquot,
|
||||||
.acquire_dquot = ext4_acquire_dquot,
|
.acquire_dquot = ext4_acquire_dquot,
|
||||||
|
|
|
@ -159,7 +159,7 @@ void jfs_delete_inode(struct inode *inode)
|
||||||
* Free the inode from the quota allocation.
|
* Free the inode from the quota allocation.
|
||||||
*/
|
*/
|
||||||
vfs_dq_init(inode);
|
vfs_dq_init(inode);
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,10 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
|
||||||
/*
|
/*
|
||||||
* Allocate inode to quota.
|
* Allocate inode to quota.
|
||||||
*/
|
*/
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
rc = -EDQUOT;
|
rc = dquot_alloc_inode(inode);
|
||||||
|
if (rc)
|
||||||
goto fail_drop;
|
goto fail_drop;
|
||||||
}
|
|
||||||
|
|
||||||
inode->i_mode = mode;
|
inode->i_mode = mode;
|
||||||
/* inherit flags from parent */
|
/* inherit flags from parent */
|
||||||
|
|
|
@ -665,7 +665,7 @@ static int ocfs2_remove_inode(struct inode *inode,
|
||||||
}
|
}
|
||||||
|
|
||||||
ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh);
|
ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh);
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
status = ocfs2_free_dinode(handle, inode_alloc_inode,
|
status = ocfs2_free_dinode(handle, inode_alloc_inode,
|
||||||
inode_alloc_bh, di);
|
inode_alloc_bh, di);
|
||||||
|
|
|
@ -348,13 +348,9 @@ static int ocfs2_mknod(struct inode *dir,
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't use standard VFS wrapper because we don't want vfs_dq_init
|
status = dquot_alloc_inode(inode);
|
||||||
* to be called. */
|
if (status)
|
||||||
if (sb_any_quota_active(osb->sb) &&
|
|
||||||
osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
|
|
||||||
status = -EDQUOT;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
|
||||||
did_quota_inode = 1;
|
did_quota_inode = 1;
|
||||||
|
|
||||||
mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
|
mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
|
||||||
|
@ -431,7 +427,7 @@ static int ocfs2_mknod(struct inode *dir,
|
||||||
status = 0;
|
status = 0;
|
||||||
leave:
|
leave:
|
||||||
if (status < 0 && did_quota_inode)
|
if (status < 0 && did_quota_inode)
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
if (handle)
|
if (handle)
|
||||||
ocfs2_commit_trans(osb, handle);
|
ocfs2_commit_trans(osb, handle);
|
||||||
|
|
||||||
|
@ -1688,13 +1684,9 @@ static int ocfs2_symlink(struct inode *dir,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't use standard VFS wrapper because we don't want vfs_dq_init
|
status = dquot_alloc_inode(inode);
|
||||||
* to be called. */
|
if (status)
|
||||||
if (sb_any_quota_active(osb->sb) &&
|
|
||||||
osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
|
|
||||||
status = -EDQUOT;
|
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
|
||||||
did_quota_inode = 1;
|
did_quota_inode = 1;
|
||||||
|
|
||||||
mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry,
|
mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry,
|
||||||
|
@ -1790,7 +1782,7 @@ bail:
|
||||||
dquot_free_space_nodirty(inode,
|
dquot_free_space_nodirty(inode,
|
||||||
ocfs2_clusters_to_bytes(osb->sb, 1));
|
ocfs2_clusters_to_bytes(osb->sb, 1));
|
||||||
if (status < 0 && did_quota_inode)
|
if (status < 0 && did_quota_inode)
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
if (handle)
|
if (handle)
|
||||||
ocfs2_commit_trans(osb, handle);
|
ocfs2_commit_trans(osb, handle);
|
||||||
|
|
||||||
|
@ -2098,13 +2090,9 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't use standard VFS wrapper because we don't want vfs_dq_init
|
status = dquot_alloc_inode(inode);
|
||||||
* to be called. */
|
if (status)
|
||||||
if (sb_any_quota_active(osb->sb) &&
|
|
||||||
osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
|
|
||||||
status = -EDQUOT;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
|
||||||
did_quota_inode = 1;
|
did_quota_inode = 1;
|
||||||
|
|
||||||
inode->i_nlink = 0;
|
inode->i_nlink = 0;
|
||||||
|
@ -2139,7 +2127,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
|
||||||
insert_inode_hash(inode);
|
insert_inode_hash(inode);
|
||||||
leave:
|
leave:
|
||||||
if (status < 0 && did_quota_inode)
|
if (status < 0 && did_quota_inode)
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
if (handle)
|
if (handle)
|
||||||
ocfs2_commit_trans(osb, handle);
|
ocfs2_commit_trans(osb, handle);
|
||||||
|
|
||||||
|
|
|
@ -853,8 +853,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
|
||||||
const struct dquot_operations ocfs2_quota_operations = {
|
const struct dquot_operations ocfs2_quota_operations = {
|
||||||
.initialize = dquot_initialize,
|
.initialize = dquot_initialize,
|
||||||
.drop = dquot_drop,
|
.drop = dquot_drop,
|
||||||
.alloc_inode = dquot_alloc_inode,
|
|
||||||
.free_inode = dquot_free_inode,
|
|
||||||
.transfer = dquot_transfer,
|
.transfer = dquot_transfer,
|
||||||
.write_dquot = ocfs2_write_dquot,
|
.write_dquot = ocfs2_write_dquot,
|
||||||
.acquire_dquot = ocfs2_acquire_dquot,
|
.acquire_dquot = ocfs2_acquire_dquot,
|
||||||
|
|
|
@ -1531,15 +1531,15 @@ EXPORT_SYMBOL(__dquot_alloc_space);
|
||||||
/*
|
/*
|
||||||
* This operation can block, but only after everything is updated
|
* This operation can block, but only after everything is updated
|
||||||
*/
|
*/
|
||||||
int dquot_alloc_inode(const struct inode *inode, qsize_t number)
|
int dquot_alloc_inode(const struct inode *inode)
|
||||||
{
|
{
|
||||||
int cnt, ret = NO_QUOTA;
|
int cnt, ret = -EDQUOT;
|
||||||
char warntype[MAXQUOTAS];
|
char warntype[MAXQUOTAS];
|
||||||
|
|
||||||
/* First test before acquiring mutex - solves deadlocks when we
|
/* First test before acquiring mutex - solves deadlocks when we
|
||||||
* re-enter the quota code and are already holding the mutex */
|
* re-enter the quota code and are already holding the mutex */
|
||||||
if (IS_NOQUOTA(inode))
|
if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
|
||||||
return QUOTA_OK;
|
return 0;
|
||||||
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
|
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
|
||||||
warntype[cnt] = QUOTA_NL_NOWARN;
|
warntype[cnt] = QUOTA_NL_NOWARN;
|
||||||
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
||||||
|
@ -1547,7 +1547,7 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number)
|
||||||
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
||||||
if (!inode->i_dquot[cnt])
|
if (!inode->i_dquot[cnt])
|
||||||
continue;
|
continue;
|
||||||
if (check_idq(inode->i_dquot[cnt], number, warntype+cnt)
|
if (check_idq(inode->i_dquot[cnt], 1, warntype+cnt)
|
||||||
== NO_QUOTA)
|
== NO_QUOTA)
|
||||||
goto warn_put_all;
|
goto warn_put_all;
|
||||||
}
|
}
|
||||||
|
@ -1555,12 +1555,12 @@ int dquot_alloc_inode(const struct inode *inode, qsize_t number)
|
||||||
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
||||||
if (!inode->i_dquot[cnt])
|
if (!inode->i_dquot[cnt])
|
||||||
continue;
|
continue;
|
||||||
dquot_incr_inodes(inode->i_dquot[cnt], number);
|
dquot_incr_inodes(inode->i_dquot[cnt], 1);
|
||||||
}
|
}
|
||||||
ret = QUOTA_OK;
|
ret = 0;
|
||||||
warn_put_all:
|
warn_put_all:
|
||||||
spin_unlock(&dq_data_lock);
|
spin_unlock(&dq_data_lock);
|
||||||
if (ret == QUOTA_OK)
|
if (ret == 0)
|
||||||
mark_all_dquot_dirty(inode->i_dquot);
|
mark_all_dquot_dirty(inode->i_dquot);
|
||||||
flush_warnings(inode->i_dquot, warntype);
|
flush_warnings(inode->i_dquot, warntype);
|
||||||
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
||||||
|
@ -1638,29 +1638,28 @@ EXPORT_SYMBOL(__dquot_free_space);
|
||||||
/*
|
/*
|
||||||
* This operation can block, but only after everything is updated
|
* This operation can block, but only after everything is updated
|
||||||
*/
|
*/
|
||||||
int dquot_free_inode(const struct inode *inode, qsize_t number)
|
void dquot_free_inode(const struct inode *inode)
|
||||||
{
|
{
|
||||||
unsigned int cnt;
|
unsigned int cnt;
|
||||||
char warntype[MAXQUOTAS];
|
char warntype[MAXQUOTAS];
|
||||||
|
|
||||||
/* First test before acquiring mutex - solves deadlocks when we
|
/* First test before acquiring mutex - solves deadlocks when we
|
||||||
* re-enter the quota code and are already holding the mutex */
|
* re-enter the quota code and are already holding the mutex */
|
||||||
if (IS_NOQUOTA(inode))
|
if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
|
||||||
return QUOTA_OK;
|
return;
|
||||||
|
|
||||||
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
||||||
spin_lock(&dq_data_lock);
|
spin_lock(&dq_data_lock);
|
||||||
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
|
||||||
if (!inode->i_dquot[cnt])
|
if (!inode->i_dquot[cnt])
|
||||||
continue;
|
continue;
|
||||||
warntype[cnt] = info_idq_free(inode->i_dquot[cnt], number);
|
warntype[cnt] = info_idq_free(inode->i_dquot[cnt], 1);
|
||||||
dquot_decr_inodes(inode->i_dquot[cnt], number);
|
dquot_decr_inodes(inode->i_dquot[cnt], 1);
|
||||||
}
|
}
|
||||||
spin_unlock(&dq_data_lock);
|
spin_unlock(&dq_data_lock);
|
||||||
mark_all_dquot_dirty(inode->i_dquot);
|
mark_all_dquot_dirty(inode->i_dquot);
|
||||||
flush_warnings(inode->i_dquot, warntype);
|
flush_warnings(inode->i_dquot, warntype);
|
||||||
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
|
||||||
return QUOTA_OK;
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dquot_free_inode);
|
EXPORT_SYMBOL(dquot_free_inode);
|
||||||
|
|
||||||
|
@ -1815,8 +1814,6 @@ EXPORT_SYMBOL(dquot_commit_info);
|
||||||
const struct dquot_operations dquot_operations = {
|
const struct dquot_operations dquot_operations = {
|
||||||
.initialize = dquot_initialize,
|
.initialize = dquot_initialize,
|
||||||
.drop = dquot_drop,
|
.drop = dquot_drop,
|
||||||
.alloc_inode = dquot_alloc_inode,
|
|
||||||
.free_inode = dquot_free_inode,
|
|
||||||
.transfer = dquot_transfer,
|
.transfer = dquot_transfer,
|
||||||
.write_dquot = dquot_commit,
|
.write_dquot = dquot_commit,
|
||||||
.acquire_dquot = dquot_acquire,
|
.acquire_dquot = dquot_acquire,
|
||||||
|
|
|
@ -54,7 +54,7 @@ void reiserfs_delete_inode(struct inode *inode)
|
||||||
* after delete_object so that quota updates go into the same transaction as
|
* after delete_object so that quota updates go into the same transaction as
|
||||||
* stat data deletion */
|
* stat data deletion */
|
||||||
if (!err)
|
if (!err)
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
if (journal_end(&th, inode->i_sb, jbegin_count))
|
if (journal_end(&th, inode->i_sb, jbegin_count))
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1765,10 +1765,10 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
|
||||||
|
|
||||||
BUG_ON(!th->t_trans_id);
|
BUG_ON(!th->t_trans_id);
|
||||||
|
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
err = -EDQUOT;
|
err = dquot_alloc_inode(inode);
|
||||||
|
if (err)
|
||||||
goto out_end_trans;
|
goto out_end_trans;
|
||||||
}
|
|
||||||
if (!dir->i_nlink) {
|
if (!dir->i_nlink) {
|
||||||
err = -EPERM;
|
err = -EPERM;
|
||||||
goto out_bad_inode;
|
goto out_bad_inode;
|
||||||
|
@ -1959,7 +1959,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
|
||||||
INODE_PKEY(inode)->k_objectid = 0;
|
INODE_PKEY(inode)->k_objectid = 0;
|
||||||
|
|
||||||
/* Quota change must be inside a transaction for journaling */
|
/* Quota change must be inside a transaction for journaling */
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
|
|
||||||
out_end_trans:
|
out_end_trans:
|
||||||
journal_end(th, th->t_super, th->t_blocks_allocated);
|
journal_end(th, th->t_super, th->t_blocks_allocated);
|
||||||
|
|
|
@ -618,8 +618,6 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int);
|
||||||
static const struct dquot_operations reiserfs_quota_operations = {
|
static const struct dquot_operations reiserfs_quota_operations = {
|
||||||
.initialize = dquot_initialize,
|
.initialize = dquot_initialize,
|
||||||
.drop = dquot_drop,
|
.drop = dquot_drop,
|
||||||
.alloc_inode = dquot_alloc_inode,
|
|
||||||
.free_inode = dquot_free_inode,
|
|
||||||
.transfer = dquot_transfer,
|
.transfer = dquot_transfer,
|
||||||
.write_dquot = reiserfs_write_dquot,
|
.write_dquot = reiserfs_write_dquot,
|
||||||
.acquire_dquot = reiserfs_acquire_dquot,
|
.acquire_dquot = reiserfs_acquire_dquot,
|
||||||
|
|
|
@ -36,7 +36,7 @@ void udf_free_inode(struct inode *inode)
|
||||||
* Note: we must free any quota before locking the superblock,
|
* Note: we must free any quota before locking the superblock,
|
||||||
* as writing the quota to disk may need the lock as well.
|
* as writing the quota to disk may need the lock as well.
|
||||||
*/
|
*/
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
||||||
clear_inode(inode);
|
clear_inode(inode);
|
||||||
|
@ -61,7 +61,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
||||||
struct super_block *sb = dir->i_sb;
|
struct super_block *sb = dir->i_sb;
|
||||||
struct udf_sb_info *sbi = UDF_SB(sb);
|
struct udf_sb_info *sbi = UDF_SB(sb);
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
int block;
|
int block, ret;
|
||||||
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
|
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
|
||||||
struct udf_inode_info *iinfo;
|
struct udf_inode_info *iinfo;
|
||||||
struct udf_inode_info *dinfo = UDF_I(dir);
|
struct udf_inode_info *dinfo = UDF_I(dir);
|
||||||
|
@ -153,12 +153,14 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
|
||||||
insert_inode_hash(inode);
|
insert_inode_hash(inode);
|
||||||
mark_inode_dirty(inode);
|
mark_inode_dirty(inode);
|
||||||
|
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
|
ret = dquot_alloc_inode(inode);
|
||||||
|
if (ret) {
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
inode->i_flags |= S_NOQUOTA;
|
inode->i_flags |= S_NOQUOTA;
|
||||||
inode->i_nlink = 0;
|
inode->i_nlink = 0;
|
||||||
iput(inode);
|
iput(inode);
|
||||||
*err = -EDQUOT;
|
*err = ret;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ void ufs_free_inode (struct inode * inode)
|
||||||
|
|
||||||
is_directory = S_ISDIR(inode->i_mode);
|
is_directory = S_ISDIR(inode->i_mode);
|
||||||
|
|
||||||
vfs_dq_free_inode(inode);
|
dquot_free_inode(inode);
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
|
|
||||||
clear_inode (inode);
|
clear_inode (inode);
|
||||||
|
@ -355,9 +355,10 @@ cg_found:
|
||||||
|
|
||||||
unlock_super (sb);
|
unlock_super (sb);
|
||||||
|
|
||||||
if (vfs_dq_alloc_inode(inode)) {
|
vfs_dq_init(inode);
|
||||||
|
err = dquot_alloc_inode(inode);
|
||||||
|
if (err) {
|
||||||
vfs_dq_drop(inode);
|
vfs_dq_drop(inode);
|
||||||
err = -EDQUOT;
|
|
||||||
goto fail_without_unlock;
|
goto fail_without_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,8 +297,6 @@ struct quota_format_ops {
|
||||||
struct dquot_operations {
|
struct dquot_operations {
|
||||||
int (*initialize) (struct inode *, int);
|
int (*initialize) (struct inode *, int);
|
||||||
int (*drop) (struct inode *);
|
int (*drop) (struct inode *);
|
||||||
int (*alloc_inode) (const struct inode *, qsize_t);
|
|
||||||
int (*free_inode) (const struct inode *, qsize_t);
|
|
||||||
int (*transfer) (struct inode *, qid_t *, unsigned long);
|
int (*transfer) (struct inode *, qid_t *, unsigned long);
|
||||||
int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
|
int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
|
||||||
struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
|
struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
|
||||||
|
|
|
@ -37,10 +37,10 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
|
||||||
int warn, int reserve);
|
int warn, int reserve);
|
||||||
void __dquot_free_space(struct inode *inode, qsize_t number, int reserve);
|
void __dquot_free_space(struct inode *inode, qsize_t number, int reserve);
|
||||||
|
|
||||||
int dquot_alloc_inode(const struct inode *inode, qsize_t number);
|
int dquot_alloc_inode(const struct inode *inode);
|
||||||
|
|
||||||
int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
|
int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
|
||||||
int dquot_free_inode(const struct inode *inode, qsize_t number);
|
void dquot_free_inode(const struct inode *inode);
|
||||||
|
|
||||||
int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask);
|
int dquot_transfer(struct inode *inode, qid_t *chid, unsigned long mask);
|
||||||
int dquot_commit(struct dquot *dquot);
|
int dquot_commit(struct dquot *dquot);
|
||||||
|
@ -148,22 +148,6 @@ static inline void vfs_dq_init(struct inode *inode)
|
||||||
inode->i_sb->dq_op->initialize(inode, -1);
|
inode->i_sb->dq_op->initialize(inode, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int vfs_dq_alloc_inode(struct inode *inode)
|
|
||||||
{
|
|
||||||
if (sb_any_quota_active(inode->i_sb)) {
|
|
||||||
vfs_dq_init(inode);
|
|
||||||
if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void vfs_dq_free_inode(struct inode *inode)
|
|
||||||
{
|
|
||||||
if (sb_any_quota_active(inode->i_sb))
|
|
||||||
inode->i_sb->dq_op->free_inode(inode, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cannot be called inside a transaction */
|
/* Cannot be called inside a transaction */
|
||||||
static inline int vfs_dq_off(struct super_block *sb, int remount)
|
static inline int vfs_dq_off(struct super_block *sb, int remount)
|
||||||
{
|
{
|
||||||
|
@ -231,12 +215,12 @@ static inline void vfs_dq_drop(struct inode *inode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int vfs_dq_alloc_inode(struct inode *inode)
|
static inline int dquot_alloc_inode(const struct inode *inode)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void vfs_dq_free_inode(struct inode *inode)
|
static inline void dquot_free_inode(const struct inode *inode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue