aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f977aade0d1b..986120f30066 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -171,6 +171,9 @@ void ext4_delete_inode(struct inode *inode)
171 handle_t *handle; 171 handle_t *handle;
172 int err; 172 int err;
173 173
174 if (!is_bad_inode(inode))
175 dquot_initialize(inode);
176
174 if (ext4_should_order_data(inode)) 177 if (ext4_should_order_data(inode))
175 ext4_begin_ordered_truncate(inode, 0); 178 ext4_begin_ordered_truncate(inode, 0);
176 truncate_inode_pages(&inode->i_data, 0); 179 truncate_inode_pages(&inode->i_data, 0);
@@ -1108,9 +1111,9 @@ void ext4_da_update_reserve_space(struct inode *inode,
1108 1111
1109 /* Update quota subsystem */ 1112 /* Update quota subsystem */
1110 if (quota_claim) { 1113 if (quota_claim) {
1111 vfs_dq_claim_block(inode, used); 1114 dquot_claim_block(inode, used);
1112 if (mdb_free) 1115 if (mdb_free)
1113 vfs_dq_release_reservation_block(inode, mdb_free); 1116 dquot_release_reservation_block(inode, mdb_free);
1114 } else { 1117 } else {
1115 /* 1118 /*
1116 * We did fallocate with an offset that is already delayed 1119 * We did fallocate with an offset that is already delayed
@@ -1121,8 +1124,8 @@ void ext4_da_update_reserve_space(struct inode *inode,
1121 * that 1124 * that
1122 */ 1125 */
1123 if (allocated_meta_blocks) 1126 if (allocated_meta_blocks)
1124 vfs_dq_claim_block(inode, allocated_meta_blocks); 1127 dquot_claim_block(inode, allocated_meta_blocks);
1125 vfs_dq_release_reservation_block(inode, mdb_free + used); 1128 dquot_release_reservation_block(inode, mdb_free + used);
1126 } 1129 }
1127 1130
1128 /* 1131 /*
@@ -1857,6 +1860,7 @@ static int ext4_da_reserve_space(struct inode *inode, sector_t lblock)
1857 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1860 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1858 struct ext4_inode_info *ei = EXT4_I(inode); 1861 struct ext4_inode_info *ei = EXT4_I(inode);
1859 unsigned long md_needed, md_reserved; 1862 unsigned long md_needed, md_reserved;
1863 int ret;
1860 1864
1861 /* 1865 /*
1862 * recalculate the amount of metadata blocks to reserve 1866 * recalculate the amount of metadata blocks to reserve
@@ -1875,11 +1879,12 @@ repeat:
1875 * later. Real quota accounting is done at pages writeout 1879 * later. Real quota accounting is done at pages writeout
1876 * time. 1880 * time.
1877 */ 1881 */
1878 if (vfs_dq_reserve_block(inode, md_needed + 1)) 1882 ret = dquot_reserve_block(inode, md_needed + 1);
1879 return -EDQUOT; 1883 if (ret)
1884 return ret;
1880 1885
1881 if (ext4_claim_free_blocks(sbi, md_needed + 1)) { 1886 if (ext4_claim_free_blocks(sbi, md_needed + 1)) {
1882 vfs_dq_release_reservation_block(inode, md_needed + 1); 1887 dquot_release_reservation_block(inode, md_needed + 1);
1883 if (ext4_should_retry_alloc(inode->i_sb, &retries)) { 1888 if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
1884 yield(); 1889 yield();
1885 goto repeat; 1890 goto repeat;
@@ -1936,7 +1941,7 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1936 1941
1937 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1942 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1938 1943
1939 vfs_dq_release_reservation_block(inode, to_free); 1944 dquot_release_reservation_block(inode, to_free);
1940} 1945}
1941 1946
1942static void ext4_da_page_release_reservation(struct page *page, 1947static void ext4_da_page_release_reservation(struct page *page,
@@ -5418,6 +5423,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
5418 if (error) 5423 if (error)
5419 return error; 5424 return error;
5420 5425
5426 if (ia_valid & ATTR_SIZE)
5427 dquot_initialize(inode);
5421 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || 5428 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
5422 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { 5429 (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
5423 handle_t *handle; 5430 handle_t *handle;
@@ -5430,7 +5437,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
5430 error = PTR_ERR(handle); 5437 error = PTR_ERR(handle);
5431 goto err_out; 5438 goto err_out;
5432 } 5439 }
5433 error = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; 5440 error = dquot_transfer(inode, attr);
5434 if (error) { 5441 if (error) {
5435 ext4_journal_stop(handle); 5442 ext4_journal_stop(handle);
5436 return error; 5443 return error;
@@ -5816,7 +5823,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
5816 * i_size has been changed by generic_commit_write() and we thus need 5823 * i_size has been changed by generic_commit_write() and we thus need
5817 * to include the updated inode in the current transaction. 5824 * to include the updated inode in the current transaction.
5818 * 5825 *
5819 * Also, vfs_dq_alloc_block() will always dirty the inode when blocks 5826 * Also, dquot_alloc_block() will always dirty the inode when blocks
5820 * are allocated to the file. 5827 * are allocated to the file.
5821 * 5828 *
5822 * If the inode is marked synchronous, we don't honour that here - doing 5829 * If the inode is marked synchronous, we don't honour that here - doing