diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 16:20:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-05 16:20:53 -0500 |
commit | e213e26ab3988c516c06eba4dcd030ac052f6dc9 (patch) | |
tree | 6e26fbdbb842b387697d73daf6e70cf718269a77 /fs/ocfs2 | |
parent | c812a51d11bbe983f4c24e32b59b265705ddd3c2 (diff) | |
parent | efd8f0e6f6c1faa041f228d7113bd3a9db802d49 (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/ocfs2')
-rw-r--r-- | fs/ocfs2/alloc.c | 13 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 11 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 37 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 20 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 52 | ||||
-rw-r--r-- | fs/ocfs2/quota_global.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 2 |
8 files changed, 71 insertions, 77 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 2bbe1ecc08c0..9f8bd913c51e 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5713,7 +5713,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5713 | goto out; | 5713 | goto out; |
5714 | } | 5714 | } |
5715 | 5715 | ||
5716 | vfs_dq_free_space_nodirty(inode, | 5716 | dquot_free_space_nodirty(inode, |
5717 | ocfs2_clusters_to_bytes(inode->i_sb, len)); | 5717 | ocfs2_clusters_to_bytes(inode->i_sb, len)); |
5718 | 5718 | ||
5719 | ret = ocfs2_remove_extent(handle, et, cpos, len, meta_ac, dealloc); | 5719 | ret = ocfs2_remove_extent(handle, et, cpos, len, meta_ac, dealloc); |
@@ -6936,7 +6936,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb, | |||
6936 | goto bail; | 6936 | goto bail; |
6937 | } | 6937 | } |
6938 | 6938 | ||
6939 | vfs_dq_free_space_nodirty(inode, | 6939 | dquot_free_space_nodirty(inode, |
6940 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_del)); | 6940 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_del)); |
6941 | spin_lock(&OCFS2_I(inode)->ip_lock); | 6941 | spin_lock(&OCFS2_I(inode)->ip_lock); |
6942 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters) - | 6942 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters) - |
@@ -7301,11 +7301,10 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
7301 | unsigned int page_end; | 7301 | unsigned int page_end; |
7302 | u64 phys; | 7302 | u64 phys; |
7303 | 7303 | ||
7304 | if (vfs_dq_alloc_space_nodirty(inode, | 7304 | ret = dquot_alloc_space_nodirty(inode, |
7305 | ocfs2_clusters_to_bytes(osb->sb, 1))) { | 7305 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
7306 | ret = -EDQUOT; | 7306 | if (ret) |
7307 | goto out_commit; | 7307 | goto out_commit; |
7308 | } | ||
7309 | did_quota = 1; | 7308 | did_quota = 1; |
7310 | 7309 | ||
7311 | ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, | 7310 | ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, |
@@ -7381,7 +7380,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
7381 | 7380 | ||
7382 | out_commit: | 7381 | out_commit: |
7383 | if (ret < 0 && did_quota) | 7382 | if (ret < 0 && did_quota) |
7384 | vfs_dq_free_space_nodirty(inode, | 7383 | dquot_free_space_nodirty(inode, |
7385 | ocfs2_clusters_to_bytes(osb->sb, 1)); | 7384 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
7386 | 7385 | ||
7387 | ocfs2_commit_trans(osb, handle); | 7386 | ocfs2_commit_trans(osb, handle); |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 4c2a6d282c4d..21441ddb5506 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1764,10 +1764,11 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1764 | 1764 | ||
1765 | wc->w_handle = handle; | 1765 | wc->w_handle = handle; |
1766 | 1766 | ||
1767 | if (clusters_to_alloc && vfs_dq_alloc_space_nodirty(inode, | 1767 | if (clusters_to_alloc) { |
1768 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc))) { | 1768 | ret = dquot_alloc_space_nodirty(inode, |
1769 | ret = -EDQUOT; | 1769 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc)); |
1770 | goto out_commit; | 1770 | if (ret) |
1771 | goto out_commit; | ||
1771 | } | 1772 | } |
1772 | /* | 1773 | /* |
1773 | * We don't want this to fail in ocfs2_write_end(), so do it | 1774 | * We don't want this to fail in ocfs2_write_end(), so do it |
@@ -1810,7 +1811,7 @@ success: | |||
1810 | return 0; | 1811 | return 0; |
1811 | out_quota: | 1812 | out_quota: |
1812 | if (clusters_to_alloc) | 1813 | if (clusters_to_alloc) |
1813 | vfs_dq_free_space(inode, | 1814 | dquot_free_space(inode, |
1814 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc)); | 1815 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc)); |
1815 | out_commit: | 1816 | out_commit: |
1816 | ocfs2_commit_trans(osb, handle); | 1817 | ocfs2_commit_trans(osb, handle); |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 765d66c70989..efd77d071c80 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -2964,12 +2964,10 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
2964 | goto out; | 2964 | goto out; |
2965 | } | 2965 | } |
2966 | 2966 | ||
2967 | if (vfs_dq_alloc_space_nodirty(dir, | 2967 | ret = dquot_alloc_space_nodirty(dir, |
2968 | ocfs2_clusters_to_bytes(osb->sb, | 2968 | ocfs2_clusters_to_bytes(osb->sb, alloc + dx_alloc)); |
2969 | alloc + dx_alloc))) { | 2969 | if (ret) |
2970 | ret = -EDQUOT; | ||
2971 | goto out_commit; | 2970 | goto out_commit; |
2972 | } | ||
2973 | did_quota = 1; | 2971 | did_quota = 1; |
2974 | 2972 | ||
2975 | if (ocfs2_supports_indexed_dirs(osb) && !dx_inline) { | 2973 | if (ocfs2_supports_indexed_dirs(osb) && !dx_inline) { |
@@ -3178,7 +3176,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, | |||
3178 | 3176 | ||
3179 | out_commit: | 3177 | out_commit: |
3180 | if (ret < 0 && did_quota) | 3178 | if (ret < 0 && did_quota) |
3181 | vfs_dq_free_space_nodirty(dir, bytes_allocated); | 3179 | dquot_free_space_nodirty(dir, bytes_allocated); |
3182 | 3180 | ||
3183 | ocfs2_commit_trans(osb, handle); | 3181 | ocfs2_commit_trans(osb, handle); |
3184 | 3182 | ||
@@ -3221,11 +3219,10 @@ static int ocfs2_do_extend_dir(struct super_block *sb, | |||
3221 | if (extend) { | 3219 | if (extend) { |
3222 | u32 offset = OCFS2_I(dir)->ip_clusters; | 3220 | u32 offset = OCFS2_I(dir)->ip_clusters; |
3223 | 3221 | ||
3224 | if (vfs_dq_alloc_space_nodirty(dir, | 3222 | status = dquot_alloc_space_nodirty(dir, |
3225 | ocfs2_clusters_to_bytes(sb, 1))) { | 3223 | ocfs2_clusters_to_bytes(sb, 1)); |
3226 | status = -EDQUOT; | 3224 | if (status) |
3227 | goto bail; | 3225 | goto bail; |
3228 | } | ||
3229 | did_quota = 1; | 3226 | did_quota = 1; |
3230 | 3227 | ||
3231 | status = ocfs2_add_inode_data(OCFS2_SB(sb), dir, &offset, | 3228 | status = ocfs2_add_inode_data(OCFS2_SB(sb), dir, &offset, |
@@ -3254,7 +3251,7 @@ static int ocfs2_do_extend_dir(struct super_block *sb, | |||
3254 | status = 0; | 3251 | status = 0; |
3255 | bail: | 3252 | bail: |
3256 | if (did_quota && status < 0) | 3253 | if (did_quota && status < 0) |
3257 | vfs_dq_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1)); | 3254 | dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1)); |
3258 | mlog_exit(status); | 3255 | mlog_exit(status); |
3259 | return status; | 3256 | return status; |
3260 | } | 3257 | } |
@@ -3889,11 +3886,10 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3889 | goto out; | 3886 | goto out; |
3890 | } | 3887 | } |
3891 | 3888 | ||
3892 | if (vfs_dq_alloc_space_nodirty(dir, | 3889 | ret = dquot_alloc_space_nodirty(dir, |
3893 | ocfs2_clusters_to_bytes(dir->i_sb, 1))) { | 3890 | ocfs2_clusters_to_bytes(dir->i_sb, 1)); |
3894 | ret = -EDQUOT; | 3891 | if (ret) |
3895 | goto out_commit; | 3892 | goto out_commit; |
3896 | } | ||
3897 | did_quota = 1; | 3893 | did_quota = 1; |
3898 | 3894 | ||
3899 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh, | 3895 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), dx_leaf_bh, |
@@ -3983,7 +3979,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3983 | 3979 | ||
3984 | out_commit: | 3980 | out_commit: |
3985 | if (ret < 0 && did_quota) | 3981 | if (ret < 0 && did_quota) |
3986 | vfs_dq_free_space_nodirty(dir, | 3982 | dquot_free_space_nodirty(dir, |
3987 | ocfs2_clusters_to_bytes(dir->i_sb, 1)); | 3983 | ocfs2_clusters_to_bytes(dir->i_sb, 1)); |
3988 | 3984 | ||
3989 | ocfs2_commit_trans(osb, handle); | 3985 | ocfs2_commit_trans(osb, handle); |
@@ -4165,11 +4161,10 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir, | |||
4165 | goto out; | 4161 | goto out; |
4166 | } | 4162 | } |
4167 | 4163 | ||
4168 | if (vfs_dq_alloc_space_nodirty(dir, | 4164 | ret = dquot_alloc_space_nodirty(dir, |
4169 | ocfs2_clusters_to_bytes(osb->sb, 1))) { | 4165 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
4170 | ret = -EDQUOT; | 4166 | if (ret) |
4171 | goto out_commit; | 4167 | goto out_commit; |
4172 | } | ||
4173 | did_quota = 1; | 4168 | did_quota = 1; |
4174 | 4169 | ||
4175 | /* | 4170 | /* |
@@ -4229,7 +4224,7 @@ static int ocfs2_expand_inline_dx_root(struct inode *dir, | |||
4229 | 4224 | ||
4230 | out_commit: | 4225 | out_commit: |
4231 | if (ret < 0 && did_quota) | 4226 | if (ret < 0 && did_quota) |
4232 | vfs_dq_free_space_nodirty(dir, | 4227 | dquot_free_space_nodirty(dir, |
4233 | ocfs2_clusters_to_bytes(dir->i_sb, 1)); | 4228 | ocfs2_clusters_to_bytes(dir->i_sb, 1)); |
4234 | 4229 | ||
4235 | ocfs2_commit_trans(osb, handle); | 4230 | ocfs2_commit_trans(osb, handle); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 5b52547d6299..17947dc8341e 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -107,6 +107,9 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) | |||
107 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, | 107 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, |
108 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); | 108 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); |
109 | 109 | ||
110 | if (file->f_mode & FMODE_WRITE) | ||
111 | dquot_initialize(inode); | ||
112 | |||
110 | spin_lock(&oi->ip_lock); | 113 | spin_lock(&oi->ip_lock); |
111 | 114 | ||
112 | /* Check that the inode hasn't been wiped from disk by another | 115 | /* Check that the inode hasn't been wiped from disk by another |
@@ -629,11 +632,10 @@ restart_all: | |||
629 | } | 632 | } |
630 | 633 | ||
631 | restarted_transaction: | 634 | restarted_transaction: |
632 | if (vfs_dq_alloc_space_nodirty(inode, ocfs2_clusters_to_bytes(osb->sb, | 635 | status = dquot_alloc_space_nodirty(inode, |
633 | clusters_to_add))) { | 636 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); |
634 | status = -EDQUOT; | 637 | if (status) |
635 | goto leave; | 638 | goto leave; |
636 | } | ||
637 | did_quota = 1; | 639 | did_quota = 1; |
638 | 640 | ||
639 | /* reserve a write to the file entry early on - that we if we | 641 | /* reserve a write to the file entry early on - that we if we |
@@ -674,7 +676,7 @@ restarted_transaction: | |||
674 | clusters_to_add -= (OCFS2_I(inode)->ip_clusters - prev_clusters); | 676 | clusters_to_add -= (OCFS2_I(inode)->ip_clusters - prev_clusters); |
675 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 677 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
676 | /* Release unused quota reservation */ | 678 | /* Release unused quota reservation */ |
677 | vfs_dq_free_space(inode, | 679 | dquot_free_space(inode, |
678 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); | 680 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); |
679 | did_quota = 0; | 681 | did_quota = 0; |
680 | 682 | ||
@@ -710,7 +712,7 @@ restarted_transaction: | |||
710 | 712 | ||
711 | leave: | 713 | leave: |
712 | if (status < 0 && did_quota) | 714 | if (status < 0 && did_quota) |
713 | vfs_dq_free_space(inode, | 715 | dquot_free_space(inode, |
714 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); | 716 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); |
715 | if (handle) { | 717 | if (handle) { |
716 | ocfs2_commit_trans(osb, handle); | 718 | ocfs2_commit_trans(osb, handle); |
@@ -978,6 +980,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
978 | 980 | ||
979 | size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; | 981 | size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; |
980 | if (size_change) { | 982 | if (size_change) { |
983 | dquot_initialize(inode); | ||
984 | |||
981 | status = ocfs2_rw_lock(inode, 1); | 985 | status = ocfs2_rw_lock(inode, 1); |
982 | if (status < 0) { | 986 | if (status < 0) { |
983 | mlog_errno(status); | 987 | mlog_errno(status); |
@@ -1020,7 +1024,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1020 | /* | 1024 | /* |
1021 | * Gather pointers to quota structures so that allocation / | 1025 | * Gather pointers to quota structures so that allocation / |
1022 | * freeing of quota structures happens here and not inside | 1026 | * freeing of quota structures happens here and not inside |
1023 | * vfs_dq_transfer() where we have problems with lock ordering | 1027 | * dquot_transfer() where we have problems with lock ordering |
1024 | */ | 1028 | */ |
1025 | if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid | 1029 | if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid |
1026 | && OCFS2_HAS_RO_COMPAT_FEATURE(sb, | 1030 | && OCFS2_HAS_RO_COMPAT_FEATURE(sb, |
@@ -1053,7 +1057,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1053 | mlog_errno(status); | 1057 | mlog_errno(status); |
1054 | goto bail_unlock; | 1058 | goto bail_unlock; |
1055 | } | 1059 | } |
1056 | status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0; | 1060 | status = dquot_transfer(inode, attr); |
1057 | if (status < 0) | 1061 | if (status < 0) |
1058 | goto bail_commit; | 1062 | goto bail_commit; |
1059 | } else { | 1063 | } else { |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 88459bdd1ff3..278a223aae14 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -665,7 +665,7 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
665 | } | 665 | } |
666 | 666 | ||
667 | ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh); | 667 | ocfs2_remove_from_cache(INODE_CACHE(inode), di_bh); |
668 | vfs_dq_free_inode(inode); | 668 | dquot_free_inode(inode); |
669 | 669 | ||
670 | status = ocfs2_free_dinode(handle, inode_alloc_inode, | 670 | status = ocfs2_free_dinode(handle, inode_alloc_inode, |
671 | inode_alloc_bh, di); | 671 | inode_alloc_bh, di); |
@@ -971,6 +971,8 @@ void ocfs2_delete_inode(struct inode *inode) | |||
971 | goto bail; | 971 | goto bail; |
972 | } | 972 | } |
973 | 973 | ||
974 | dquot_initialize(inode); | ||
975 | |||
974 | if (!ocfs2_inode_is_valid_to_delete(inode)) { | 976 | if (!ocfs2_inode_is_valid_to_delete(inode)) { |
975 | /* It's probably not necessary to truncate_inode_pages | 977 | /* It's probably not necessary to truncate_inode_pages |
976 | * here but we do it for safety anyway (it will most | 978 | * here but we do it for safety anyway (it will most |
@@ -1087,6 +1089,8 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1087 | mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, | 1089 | mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, |
1088 | "Inode=%lu\n", inode->i_ino); | 1090 | "Inode=%lu\n", inode->i_ino); |
1089 | 1091 | ||
1092 | dquot_drop(inode); | ||
1093 | |||
1090 | /* To preven remote deletes we hold open lock before, now it | 1094 | /* To preven remote deletes we hold open lock before, now it |
1091 | * is time to unlock PR and EX open locks. */ | 1095 | * is time to unlock PR and EX open locks. */ |
1092 | ocfs2_open_unlock(inode); | 1096 | ocfs2_open_unlock(inode); |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 50fb26a6a5f5..d9cd4e373a53 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -212,7 +212,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode) | |||
212 | } else | 212 | } else |
213 | inode->i_gid = current_fsgid(); | 213 | inode->i_gid = current_fsgid(); |
214 | inode->i_mode = mode; | 214 | inode->i_mode = mode; |
215 | vfs_dq_init(inode); | 215 | dquot_initialize(inode); |
216 | return inode; | 216 | return inode; |
217 | } | 217 | } |
218 | 218 | ||
@@ -244,6 +244,8 @@ static int ocfs2_mknod(struct inode *dir, | |||
244 | (unsigned long)dev, dentry->d_name.len, | 244 | (unsigned long)dev, dentry->d_name.len, |
245 | dentry->d_name.name); | 245 | dentry->d_name.name); |
246 | 246 | ||
247 | dquot_initialize(dir); | ||
248 | |||
247 | /* get our super block */ | 249 | /* get our super block */ |
248 | osb = OCFS2_SB(dir->i_sb); | 250 | osb = OCFS2_SB(dir->i_sb); |
249 | 251 | ||
@@ -348,13 +350,9 @@ static int ocfs2_mknod(struct inode *dir, | |||
348 | goto leave; | 350 | goto leave; |
349 | } | 351 | } |
350 | 352 | ||
351 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 353 | status = dquot_alloc_inode(inode); |
352 | * to be called. */ | 354 | if (status) |
353 | if (sb_any_quota_active(osb->sb) && | ||
354 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
355 | status = -EDQUOT; | ||
356 | goto leave; | 355 | goto leave; |
357 | } | ||
358 | did_quota_inode = 1; | 356 | did_quota_inode = 1; |
359 | 357 | ||
360 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | 358 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, |
@@ -431,7 +429,7 @@ static int ocfs2_mknod(struct inode *dir, | |||
431 | status = 0; | 429 | status = 0; |
432 | leave: | 430 | leave: |
433 | if (status < 0 && did_quota_inode) | 431 | if (status < 0 && did_quota_inode) |
434 | vfs_dq_free_inode(inode); | 432 | dquot_free_inode(inode); |
435 | if (handle) | 433 | if (handle) |
436 | ocfs2_commit_trans(osb, handle); | 434 | ocfs2_commit_trans(osb, handle); |
437 | 435 | ||
@@ -636,6 +634,8 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
636 | if (S_ISDIR(inode->i_mode)) | 634 | if (S_ISDIR(inode->i_mode)) |
637 | return -EPERM; | 635 | return -EPERM; |
638 | 636 | ||
637 | dquot_initialize(dir); | ||
638 | |||
639 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); | 639 | err = ocfs2_inode_lock_nested(dir, &parent_fe_bh, 1, OI_LS_PARENT); |
640 | if (err < 0) { | 640 | if (err < 0) { |
641 | if (err != -ENOENT) | 641 | if (err != -ENOENT) |
@@ -791,6 +791,8 @@ static int ocfs2_unlink(struct inode *dir, | |||
791 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, | 791 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, |
792 | dentry->d_name.len, dentry->d_name.name); | 792 | dentry->d_name.len, dentry->d_name.name); |
793 | 793 | ||
794 | dquot_initialize(dir); | ||
795 | |||
794 | BUG_ON(dentry->d_parent->d_inode != dir); | 796 | BUG_ON(dentry->d_parent->d_inode != dir); |
795 | 797 | ||
796 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); | 798 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); |
@@ -1051,6 +1053,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1051 | old_dentry->d_name.len, old_dentry->d_name.name, | 1053 | old_dentry->d_name.len, old_dentry->d_name.name, |
1052 | new_dentry->d_name.len, new_dentry->d_name.name); | 1054 | new_dentry->d_name.len, new_dentry->d_name.name); |
1053 | 1055 | ||
1056 | dquot_initialize(old_dir); | ||
1057 | dquot_initialize(new_dir); | ||
1058 | |||
1054 | osb = OCFS2_SB(old_dir->i_sb); | 1059 | osb = OCFS2_SB(old_dir->i_sb); |
1055 | 1060 | ||
1056 | if (new_inode) { | 1061 | if (new_inode) { |
@@ -1599,6 +1604,8 @@ static int ocfs2_symlink(struct inode *dir, | |||
1599 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, | 1604 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, |
1600 | dentry, symname, dentry->d_name.len, dentry->d_name.name); | 1605 | dentry, symname, dentry->d_name.len, dentry->d_name.name); |
1601 | 1606 | ||
1607 | dquot_initialize(dir); | ||
1608 | |||
1602 | sb = dir->i_sb; | 1609 | sb = dir->i_sb; |
1603 | osb = OCFS2_SB(sb); | 1610 | osb = OCFS2_SB(sb); |
1604 | 1611 | ||
@@ -1688,13 +1695,9 @@ static int ocfs2_symlink(struct inode *dir, | |||
1688 | goto bail; | 1695 | goto bail; |
1689 | } | 1696 | } |
1690 | 1697 | ||
1691 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 1698 | status = dquot_alloc_inode(inode); |
1692 | * to be called. */ | 1699 | if (status) |
1693 | if (sb_any_quota_active(osb->sb) && | ||
1694 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
1695 | status = -EDQUOT; | ||
1696 | goto bail; | 1700 | goto bail; |
1697 | } | ||
1698 | did_quota_inode = 1; | 1701 | did_quota_inode = 1; |
1699 | 1702 | ||
1700 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, | 1703 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, |
@@ -1716,11 +1719,10 @@ static int ocfs2_symlink(struct inode *dir, | |||
1716 | u32 offset = 0; | 1719 | u32 offset = 0; |
1717 | 1720 | ||
1718 | inode->i_op = &ocfs2_symlink_inode_operations; | 1721 | inode->i_op = &ocfs2_symlink_inode_operations; |
1719 | if (vfs_dq_alloc_space_nodirty(inode, | 1722 | status = dquot_alloc_space_nodirty(inode, |
1720 | ocfs2_clusters_to_bytes(osb->sb, 1))) { | 1723 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
1721 | status = -EDQUOT; | 1724 | if (status) |
1722 | goto bail; | 1725 | goto bail; |
1723 | } | ||
1724 | did_quota = 1; | 1726 | did_quota = 1; |
1725 | status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0, | 1727 | status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0, |
1726 | new_fe_bh, | 1728 | new_fe_bh, |
@@ -1788,10 +1790,10 @@ static int ocfs2_symlink(struct inode *dir, | |||
1788 | d_instantiate(dentry, inode); | 1790 | d_instantiate(dentry, inode); |
1789 | bail: | 1791 | bail: |
1790 | if (status < 0 && did_quota) | 1792 | if (status < 0 && did_quota) |
1791 | vfs_dq_free_space_nodirty(inode, | 1793 | dquot_free_space_nodirty(inode, |
1792 | ocfs2_clusters_to_bytes(osb->sb, 1)); | 1794 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
1793 | if (status < 0 && did_quota_inode) | 1795 | if (status < 0 && did_quota_inode) |
1794 | vfs_dq_free_inode(inode); | 1796 | dquot_free_inode(inode); |
1795 | if (handle) | 1797 | if (handle) |
1796 | ocfs2_commit_trans(osb, handle); | 1798 | ocfs2_commit_trans(osb, handle); |
1797 | 1799 | ||
@@ -2099,13 +2101,9 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2099 | goto leave; | 2101 | goto leave; |
2100 | } | 2102 | } |
2101 | 2103 | ||
2102 | /* We don't use standard VFS wrapper because we don't want vfs_dq_init | 2104 | status = dquot_alloc_inode(inode); |
2103 | * to be called. */ | 2105 | if (status) |
2104 | if (sb_any_quota_active(osb->sb) && | ||
2105 | osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) { | ||
2106 | status = -EDQUOT; | ||
2107 | goto leave; | 2106 | goto leave; |
2108 | } | ||
2109 | did_quota_inode = 1; | 2107 | did_quota_inode = 1; |
2110 | 2108 | ||
2111 | inode->i_nlink = 0; | 2109 | inode->i_nlink = 0; |
@@ -2140,7 +2138,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2140 | insert_inode_hash(inode); | 2138 | insert_inode_hash(inode); |
2141 | leave: | 2139 | leave: |
2142 | if (status < 0 && did_quota_inode) | 2140 | if (status < 0 && did_quota_inode) |
2143 | vfs_dq_free_inode(inode); | 2141 | dquot_free_inode(inode); |
2144 | if (handle) | 2142 | if (handle) |
2145 | ocfs2_commit_trans(osb, handle); | 2143 | ocfs2_commit_trans(osb, handle); |
2146 | 2144 | ||
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index b437dc0c4cad..355f41d1d520 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -851,13 +851,6 @@ static void ocfs2_destroy_dquot(struct dquot *dquot) | |||
851 | } | 851 | } |
852 | 852 | ||
853 | const struct dquot_operations ocfs2_quota_operations = { | 853 | const struct dquot_operations ocfs2_quota_operations = { |
854 | .initialize = dquot_initialize, | ||
855 | .drop = dquot_drop, | ||
856 | .alloc_space = dquot_alloc_space, | ||
857 | .alloc_inode = dquot_alloc_inode, | ||
858 | .free_space = dquot_free_space, | ||
859 | .free_inode = dquot_free_inode, | ||
860 | .transfer = dquot_transfer, | ||
861 | .write_dquot = ocfs2_write_dquot, | 854 | .write_dquot = ocfs2_write_dquot, |
862 | .acquire_dquot = ocfs2_acquire_dquot, | 855 | .acquire_dquot = ocfs2_acquire_dquot, |
863 | .release_dquot = ocfs2_release_dquot, | 856 | .release_dquot = ocfs2_release_dquot, |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index fb6aa7acf54b..9e96921dffda 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -4390,7 +4390,7 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, | |||
4390 | } | 4390 | } |
4391 | 4391 | ||
4392 | mutex_lock(&inode->i_mutex); | 4392 | mutex_lock(&inode->i_mutex); |
4393 | vfs_dq_init(dir); | 4393 | dquot_initialize(dir); |
4394 | error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve); | 4394 | error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve); |
4395 | mutex_unlock(&inode->i_mutex); | 4395 | mutex_unlock(&inode->i_mutex); |
4396 | if (!error) | 4396 | if (!error) |