dquot: cleanup space allocation / freeing routines
Get rid of the alloc_space, free_space, reserve_space, claim_space and release_rsv 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. Move shared logic into the common __dquot_alloc_space, dquot_claim_space_nodirty and __dquot_free_space low-level methods, and rationalize the wrappers around it to move as much as possible code into the common block for CONFIG_QUOTA vs not. Also rename all these helpers to be named dquot_* instead of vfs_dq_*. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
committed by
Jan Kara
parent
49792c806d
commit
5dd4056db8
@ -1299,7 +1299,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th,
|
||||
"reiserquota delete_item(): freeing %u, id=%u type=%c",
|
||||
quota_cut_bytes, inode->i_uid, head2type(&s_ih));
|
||||
#endif
|
||||
vfs_dq_free_space_nodirty(inode, quota_cut_bytes);
|
||||
dquot_free_space_nodirty(inode, quota_cut_bytes);
|
||||
|
||||
/* Return deleted body length */
|
||||
return ret_value;
|
||||
@ -1383,7 +1383,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th,
|
||||
quota_cut_bytes, inode->i_uid,
|
||||
key2type(key));
|
||||
#endif
|
||||
vfs_dq_free_space_nodirty(inode,
|
||||
dquot_free_space_nodirty(inode,
|
||||
quota_cut_bytes);
|
||||
}
|
||||
break;
|
||||
@ -1733,7 +1733,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th,
|
||||
"reiserquota cut_from_item(): freeing %u id=%u type=%c",
|
||||
quota_cut_bytes, inode->i_uid, '?');
|
||||
#endif
|
||||
vfs_dq_free_space_nodirty(inode, quota_cut_bytes);
|
||||
dquot_free_space_nodirty(inode, quota_cut_bytes);
|
||||
return ret_value;
|
||||
}
|
||||
|
||||
@ -1968,9 +1968,10 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
|
||||
key2type(&(key->on_disk_key)));
|
||||
#endif
|
||||
|
||||
if (vfs_dq_alloc_space_nodirty(inode, pasted_size)) {
|
||||
retval = dquot_alloc_space_nodirty(inode, pasted_size);
|
||||
if (retval) {
|
||||
pathrelse(search_path);
|
||||
return -EDQUOT;
|
||||
return retval;
|
||||
}
|
||||
init_tb_struct(th, &s_paste_balance, th->t_super, search_path,
|
||||
pasted_size);
|
||||
@ -2024,7 +2025,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree
|
||||
pasted_size, inode->i_uid,
|
||||
key2type(&(key->on_disk_key)));
|
||||
#endif
|
||||
vfs_dq_free_space_nodirty(inode, pasted_size);
|
||||
dquot_free_space_nodirty(inode, pasted_size);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -2062,9 +2063,10 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
|
||||
#endif
|
||||
/* We can't dirty inode here. It would be immediately written but
|
||||
* appropriate stat item isn't inserted yet... */
|
||||
if (vfs_dq_alloc_space_nodirty(inode, quota_bytes)) {
|
||||
retval = dquot_alloc_space_nodirty(inode, quota_bytes);
|
||||
if (retval) {
|
||||
pathrelse(path);
|
||||
return -EDQUOT;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
init_tb_struct(th, &s_ins_balance, th->t_super, path,
|
||||
@ -2113,6 +2115,6 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,
|
||||
quota_bytes, inode->i_uid, head2type(ih));
|
||||
#endif
|
||||
if (inode)
|
||||
vfs_dq_free_space_nodirty(inode, quota_bytes);
|
||||
dquot_free_space_nodirty(inode, quota_bytes);
|
||||
return retval;
|
||||
}
|
||||
|
Reference in New Issue
Block a user