===================================================================
@@ -1276,33 +1276,28 @@ int dquot_alloc_space(struct inode *inod
/*
* First test before acquiring mutex - solves deadlocks when we
- * re-enter the quota code and are already holding the mutex
- */
- if (IS_NOQUOTA(inode)) {
- inode_add_bytes(inode, number);
- return ret;
- }
+ * re-enter the quota code and are already holding the mutex
+ */
+ if (IS_NOQUOTA(inode))
+ goto out;
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- if (IS_NOQUOTA(inode)) {
- /* Now we can do reliable test... */
- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- inode_add_bytes(inode, number);
- return ret;
- }
+ if (IS_NOQUOTA(inode))
+ goto out_unlock;
ret = __dquot_alloc_space(inode, number, warn, 0);
- if (ret == NO_QUOTA) {
- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- return ret;
- }
+ if (ret == NO_QUOTA)
+ goto out_unlock;
/* Dirtify all the dquots - this can block when journalling */
for (cnt = 0; cnt < MAXQUOTAS; cnt++)
if (inode->i_dquot[cnt])
mark_dquot_dirty(inode->i_dquot[cnt]);
+out_unlock:
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- inode_add_bytes(inode, number);
+out:
+ if (ret == QUOTA_OK)
+ inode_add_bytes(inode, number);
return ret;
}
@@ -1311,17 +1306,16 @@ int dquot_reserve_space(struct inode *in
int ret = QUOTA_OK;
if (IS_NOQUOTA(inode))
- return ret;
+ goto out;
down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- if (IS_NOQUOTA(inode)) {
- /* Now we can do reliable test... */
- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
- return ret;
- }
+ if (IS_NOQUOTA(inode))
+ goto out_unlock;
ret = __dquot_alloc_space(inode, number, warn, 1);
+out_unlock:
up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
+out:
return ret;
}
===================================================================
@@ -383,7 +383,7 @@ static inline int vfs_dq_alloc_block(str
static inline int vfs_dq_reserve_block(struct inode *inode, qsize_t nr)
{
return vfs_dq_reserve_space(inode,
- nr << inode->i_sb->s_blocksize_bits);
+ nr << inode->i_blkbits);
}
static inline void vfs_dq_free_block_nodirty(struct inode *inode, qsize_t nr)