aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:00 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:28 -0500
commit5dd4056db84387975140ff2568eaa0406f07985e (patch)
tree03c26d7f6e3367b167bfeeb1a01654c6619573f4 /fs/ext4/inode.c
parent49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (diff)
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>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e11952404e02..9f607ea411c8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1093,9 +1093,9 @@ void ext4_da_update_reserve_space(struct inode *inode,
1093 1093
1094 /* Update quota subsystem */ 1094 /* Update quota subsystem */
1095 if (quota_claim) { 1095 if (quota_claim) {
1096 vfs_dq_claim_block(inode, used); 1096 dquot_claim_block(inode, used);
1097 if (mdb_free) 1097 if (mdb_free)
1098 vfs_dq_release_reservation_block(inode, mdb_free); 1098 dquot_release_reservation_block(inode, mdb_free);
1099 } else { 1099 } else {
1100 /* 1100 /*
1101 * We did fallocate with an offset that is already delayed 1101 * We did fallocate with an offset that is already delayed
@@ -1106,8 +1106,8 @@ void ext4_da_update_reserve_space(struct inode *inode,
1106 * that 1106 * that
1107 */ 1107 */
1108 if (allocated_meta_blocks) 1108 if (allocated_meta_blocks)
1109 vfs_dq_claim_block(inode, allocated_meta_blocks); 1109 dquot_claim_block(inode, allocated_meta_blocks);
1110 vfs_dq_release_reservation_block(inode, mdb_free + used); 1110 dquot_release_reservation_block(inode, mdb_free + used);
1111 } 1111 }
1112 1112
1113 /* 1113 /*
@@ -1836,6 +1836,7 @@ static int ext4_da_reserve_space(struct inode *inode, sector_t lblock)
1836 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1836 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1837 struct ext4_inode_info *ei = EXT4_I(inode); 1837 struct ext4_inode_info *ei = EXT4_I(inode);
1838 unsigned long md_needed, md_reserved; 1838 unsigned long md_needed, md_reserved;
1839 int ret;
1839 1840
1840 /* 1841 /*
1841 * recalculate the amount of metadata blocks to reserve 1842 * recalculate the amount of metadata blocks to reserve
@@ -1853,11 +1854,12 @@ repeat:
1853 * later. Real quota accounting is done at pages writeout 1854 * later. Real quota accounting is done at pages writeout
1854 * time. 1855 * time.
1855 */ 1856 */
1856 if (vfs_dq_reserve_block(inode, md_needed + 1)) 1857 ret = dquot_reserve_block(inode, md_needed + 1);
1857 return -EDQUOT; 1858 if (ret)
1859 return ret;
1858 1860
1859 if (ext4_claim_free_blocks(sbi, md_needed + 1)) { 1861 if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
1860 vfs_dq_release_reservation_block(inode, md_needed + 1); 1862 dquot_release_reservation_block(inode, md_needed + 1);
1861 if (ext4_should_retry_alloc(inode->i_sb, &retries)) { 1863 if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
1862 yield(); 1864 yield();
1863 goto repeat; 1865 goto repeat;
@@ -1914,7 +1916,7 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1914 1916
1915 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1917 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1916 1918
1917 vfs_dq_release_reservation_block(inode, to_free); 1919 dquot_release_reservation_block(inode, to_free);
1918} 1920}
1919 1921
1920static void ext4_da_page_release_reservation(struct page *page, 1922static void ext4_da_page_release_reservation(struct page *page,
@@ -5641,7 +5643,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
5641 * i_size has been changed by generic_commit_write() and we thus need 5643 * i_size has been changed by generic_commit_write() and we thus need
5642 * to include the updated inode in the current transaction. 5644 * to include the updated inode in the current transaction.
5643 * 5645 *
5644 * Also, vfs_dq_alloc_block() will always dirty the inode when blocks 5646 * Also, dquot_alloc_block() will always dirty the inode when blocks
5645 * are allocated to the file. 5647 * are allocated to the file.
5646 * 5648 *
5647 * If the inode is marked synchronous, we don't honour that here - doing 5649 * If the inode is marked synchronous, we don't honour that here - doing