Commit 0ed60de3 authored by Jan Kara's avatar Jan Kara

quota: Inline functions into their callsites

inode_add_rsv_space() and inode_sub_rsv_space() had only one callsite.
Inline them there directly. inode_claim_rsv_space() and
inode_reclaim_rsv_space() had two callsites so inline them there as
well. This will simplify further locking changes.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 91389240
...@@ -1583,40 +1583,6 @@ static qsize_t *inode_reserved_space(struct inode * inode) ...@@ -1583,40 +1583,6 @@ static qsize_t *inode_reserved_space(struct inode * inode)
return inode->i_sb->dq_op->get_reserved_space(inode); return inode->i_sb->dq_op->get_reserved_space(inode);
} }
void inode_add_rsv_space(struct inode *inode, qsize_t number)
{
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(inode_add_rsv_space);
void inode_claim_rsv_space(struct inode *inode, qsize_t number)
{
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
__inode_add_bytes(inode, number);
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(inode_claim_rsv_space);
void inode_reclaim_rsv_space(struct inode *inode, qsize_t number)
{
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
__inode_sub_bytes(inode, number);
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(inode_reclaim_rsv_space);
void inode_sub_rsv_space(struct inode *inode, qsize_t number)
{
spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(inode_sub_rsv_space);
static qsize_t inode_get_rsv_space(struct inode *inode) static qsize_t inode_get_rsv_space(struct inode *inode)
{ {
qsize_t ret; qsize_t ret;
...@@ -1632,18 +1598,24 @@ static qsize_t inode_get_rsv_space(struct inode *inode) ...@@ -1632,18 +1598,24 @@ static qsize_t inode_get_rsv_space(struct inode *inode)
static void inode_incr_space(struct inode *inode, qsize_t number, static void inode_incr_space(struct inode *inode, qsize_t number,
int reserve) int reserve)
{ {
if (reserve) if (reserve) {
inode_add_rsv_space(inode, number); spin_lock(&inode->i_lock);
else *inode_reserved_space(inode) += number;
spin_unlock(&inode->i_lock);
} else {
inode_add_bytes(inode, number); inode_add_bytes(inode, number);
}
} }
static void inode_decr_space(struct inode *inode, qsize_t number, int reserve) static void inode_decr_space(struct inode *inode, qsize_t number, int reserve)
{ {
if (reserve) if (reserve) {
inode_sub_rsv_space(inode, number); spin_lock(&inode->i_lock);
else *inode_reserved_space(inode) -= number;
spin_unlock(&inode->i_lock);
} else {
inode_sub_bytes(inode, number); inode_sub_bytes(inode, number);
}
} }
/* /*
...@@ -1759,7 +1731,10 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) ...@@ -1759,7 +1731,10 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
int cnt, index; int cnt, index;
if (!dquot_active(inode)) { if (!dquot_active(inode)) {
inode_claim_rsv_space(inode, number); spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
__inode_add_bytes(inode, number);
spin_unlock(&inode->i_lock);
return 0; return 0;
} }
...@@ -1772,7 +1747,10 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) ...@@ -1772,7 +1747,10 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
dquot_claim_reserved_space(dquots[cnt], number); dquot_claim_reserved_space(dquots[cnt], number);
} }
/* Update inode bytes */ /* Update inode bytes */
inode_claim_rsv_space(inode, number); spin_lock(&inode->i_lock);
*inode_reserved_space(inode) -= number;
__inode_add_bytes(inode, number);
spin_unlock(&inode->i_lock);
spin_unlock(&dq_data_lock); spin_unlock(&dq_data_lock);
mark_all_dquot_dirty(dquots); mark_all_dquot_dirty(dquots);
srcu_read_unlock(&dquot_srcu, index); srcu_read_unlock(&dquot_srcu, index);
...@@ -1789,7 +1767,10 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number) ...@@ -1789,7 +1767,10 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
int cnt, index; int cnt, index;
if (!dquot_active(inode)) { if (!dquot_active(inode)) {
inode_reclaim_rsv_space(inode, number); spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
__inode_sub_bytes(inode, number);
spin_unlock(&inode->i_lock);
return; return;
} }
...@@ -1802,7 +1783,10 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number) ...@@ -1802,7 +1783,10 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)
dquot_reclaim_reserved_space(dquots[cnt], number); dquot_reclaim_reserved_space(dquots[cnt], number);
} }
/* Update inode bytes */ /* Update inode bytes */
inode_reclaim_rsv_space(inode, number); spin_lock(&inode->i_lock);
*inode_reserved_space(inode) += number;
__inode_sub_bytes(inode, number);
spin_unlock(&inode->i_lock);
spin_unlock(&dq_data_lock); spin_unlock(&dq_data_lock);
mark_all_dquot_dirty(dquots); mark_all_dquot_dirty(dquots);
srcu_read_unlock(&dquot_srcu, index); srcu_read_unlock(&dquot_srcu, index);
......
...@@ -38,11 +38,6 @@ void __quota_error(struct super_block *sb, const char *func, ...@@ -38,11 +38,6 @@ void __quota_error(struct super_block *sb, const char *func,
/* /*
* declaration of quota_function calls in kernel. * declaration of quota_function calls in kernel.
*/ */
void inode_add_rsv_space(struct inode *inode, qsize_t number);
void inode_claim_rsv_space(struct inode *inode, qsize_t number);
void inode_sub_rsv_space(struct inode *inode, qsize_t number);
void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
int dquot_initialize(struct inode *inode); int dquot_initialize(struct inode *inode);
bool dquot_initialize_needed(struct inode *inode); bool dquot_initialize_needed(struct inode *inode);
void dquot_drop(struct inode *inode); void dquot_drop(struct inode *inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment