aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 16:20:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-05 16:20:53 -0500
commite213e26ab3988c516c06eba4dcd030ac052f6dc9 (patch)
tree6e26fbdbb842b387697d73daf6e70cf718269a77 /fs/ext4/inode.c
parentc812a51d11bbe983f4c24e32b59b265705ddd3c2 (diff)
parentefd8f0e6f6c1faa041f228d7113bd3a9db802d49 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (33 commits) quota: stop using QUOTA_OK / NO_QUOTA dquot: cleanup dquot initialize routine dquot: move dquot initialization responsibility into the filesystem dquot: cleanup dquot drop routine dquot: move dquot drop responsibility into the filesystem dquot: cleanup dquot transfer routine dquot: move dquot transfer responsibility into the filesystem dquot: cleanup inode allocation / freeing routines dquot: cleanup space allocation / freeing routines ext3: add writepage sanity checks ext3: Truncate allocated blocks if direct IO write fails to update i_size quota: Properly invalidate caches even for filesystems with blocksize < pagesize quota: generalize quota transfer interface quota: sb_quota state flags cleanup jbd: Delay discarding buffers in journal_unmap_buffer ext3: quota_write cross block boundary behaviour quota: drop permission checks from xfs_fs_set_xstate/xfs_fs_set_xquota quota: split out compat_sys_quotactl support from quota.c quota: split out netlink notification support from quota.c quota: remove invalid optimization from quota_sync_all ... Fixed trivial conflicts in fs/namei.c and fs/ufs/inode.c
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