diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-03-03 09:05:00 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-03-04 18:20:28 -0500 |
commit | 5dd4056db84387975140ff2568eaa0406f07985e (patch) | |
tree | 03c26d7f6e3367b167bfeeb1a01654c6619573f4 /fs/ocfs2/dir.c | |
parent | 49792c806d0bfd53afc789dcdf50dc9bed2c5b83 (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/ocfs2/dir.c')
-rw-r--r-- | fs/ocfs2/dir.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 28c3ec238796..a63ea4d74e67 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); |