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/reiserfs | |
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/reiserfs')
-rw-r--r-- | fs/reiserfs/bitmap.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/stree.c | 20 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 65c872761177..dc014f7def05 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -425,7 +425,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th, | |||
425 | 425 | ||
426 | journal_mark_dirty(th, s, sbh); | 426 | journal_mark_dirty(th, s, sbh); |
427 | if (for_unformatted) | 427 | if (for_unformatted) |
428 | vfs_dq_free_block_nodirty(inode, 1); | 428 | dquot_free_block_nodirty(inode, 1); |
429 | } | 429 | } |
430 | 430 | ||
431 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, | 431 | void reiserfs_free_block(struct reiserfs_transaction_handle *th, |
@@ -1049,7 +1049,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start | |||
1049 | amount_needed, hint->inode->i_uid); | 1049 | amount_needed, hint->inode->i_uid); |
1050 | #endif | 1050 | #endif |
1051 | quota_ret = | 1051 | quota_ret = |
1052 | vfs_dq_alloc_block_nodirty(hint->inode, amount_needed); | 1052 | dquot_alloc_block_nodirty(hint->inode, amount_needed); |
1053 | if (quota_ret) /* Quota exceeded? */ | 1053 | if (quota_ret) /* Quota exceeded? */ |
1054 | return QUOTA_EXCEEDED; | 1054 | return QUOTA_EXCEEDED; |
1055 | if (hint->preallocate && hint->prealloc_size) { | 1055 | if (hint->preallocate && hint->prealloc_size) { |
@@ -1058,7 +1058,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start | |||
1058 | "reiserquota: allocating (prealloc) %d blocks id=%u", | 1058 | "reiserquota: allocating (prealloc) %d blocks id=%u", |
1059 | hint->prealloc_size, hint->inode->i_uid); | 1059 | hint->prealloc_size, hint->inode->i_uid); |
1060 | #endif | 1060 | #endif |
1061 | quota_ret = vfs_dq_prealloc_block_nodirty(hint->inode, | 1061 | quota_ret = dquot_prealloc_block_nodirty(hint->inode, |
1062 | hint->prealloc_size); | 1062 | hint->prealloc_size); |
1063 | if (quota_ret) | 1063 | if (quota_ret) |
1064 | hint->preallocate = hint->prealloc_size = 0; | 1064 | hint->preallocate = hint->prealloc_size = 0; |
@@ -1092,7 +1092,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start | |||
1092 | hint->inode->i_uid); | 1092 | hint->inode->i_uid); |
1093 | #endif | 1093 | #endif |
1094 | /* Free not allocated blocks */ | 1094 | /* Free not allocated blocks */ |
1095 | vfs_dq_free_block_nodirty(hint->inode, | 1095 | dquot_free_block_nodirty(hint->inode, |
1096 | amount_needed + hint->prealloc_size - | 1096 | amount_needed + hint->prealloc_size - |
1097 | nr_allocated); | 1097 | nr_allocated); |
1098 | } | 1098 | } |
@@ -1125,7 +1125,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start | |||
1125 | REISERFS_I(hint->inode)->i_prealloc_count, | 1125 | REISERFS_I(hint->inode)->i_prealloc_count, |
1126 | hint->inode->i_uid); | 1126 | hint->inode->i_uid); |
1127 | #endif | 1127 | #endif |
1128 | vfs_dq_free_block_nodirty(hint->inode, amount_needed + | 1128 | dquot_free_block_nodirty(hint->inode, amount_needed + |
1129 | hint->prealloc_size - nr_allocated - | 1129 | hint->prealloc_size - nr_allocated - |
1130 | REISERFS_I(hint->inode)-> | 1130 | REISERFS_I(hint->inode)-> |
1131 | i_prealloc_count); | 1131 | i_prealloc_count); |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index 5fa7118f04e1..313d39d639eb 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -1299,7 +1299,7 @@ int reiserfs_delete_item(struct reiserfs_transaction_handle *th, | |||
1299 | "reiserquota delete_item(): freeing %u, id=%u type=%c", | 1299 | "reiserquota delete_item(): freeing %u, id=%u type=%c", |
1300 | quota_cut_bytes, inode->i_uid, head2type(&s_ih)); | 1300 | quota_cut_bytes, inode->i_uid, head2type(&s_ih)); |
1301 | #endif | 1301 | #endif |
1302 | vfs_dq_free_space_nodirty(inode, quota_cut_bytes); | 1302 | dquot_free_space_nodirty(inode, quota_cut_bytes); |
1303 | 1303 | ||
1304 | /* Return deleted body length */ | 1304 | /* Return deleted body length */ |
1305 | return ret_value; | 1305 | return ret_value; |
@@ -1383,7 +1383,7 @@ void reiserfs_delete_solid_item(struct reiserfs_transaction_handle *th, | |||
1383 | quota_cut_bytes, inode->i_uid, | 1383 | quota_cut_bytes, inode->i_uid, |
1384 | key2type(key)); | 1384 | key2type(key)); |
1385 | #endif | 1385 | #endif |
1386 | vfs_dq_free_space_nodirty(inode, | 1386 | dquot_free_space_nodirty(inode, |
1387 | quota_cut_bytes); | 1387 | quota_cut_bytes); |
1388 | } | 1388 | } |
1389 | break; | 1389 | break; |
@@ -1733,7 +1733,7 @@ int reiserfs_cut_from_item(struct reiserfs_transaction_handle *th, | |||
1733 | "reiserquota cut_from_item(): freeing %u id=%u type=%c", | 1733 | "reiserquota cut_from_item(): freeing %u id=%u type=%c", |
1734 | quota_cut_bytes, inode->i_uid, '?'); | 1734 | quota_cut_bytes, inode->i_uid, '?'); |
1735 | #endif | 1735 | #endif |
1736 | vfs_dq_free_space_nodirty(inode, quota_cut_bytes); | 1736 | dquot_free_space_nodirty(inode, quota_cut_bytes); |
1737 | return ret_value; | 1737 | return ret_value; |
1738 | } | 1738 | } |
1739 | 1739 | ||
@@ -1968,9 +1968,10 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree | |||
1968 | key2type(&(key->on_disk_key))); | 1968 | key2type(&(key->on_disk_key))); |
1969 | #endif | 1969 | #endif |
1970 | 1970 | ||
1971 | if (vfs_dq_alloc_space_nodirty(inode, pasted_size)) { | 1971 | retval = dquot_alloc_space_nodirty(inode, pasted_size); |
1972 | if (retval) { | ||
1972 | pathrelse(search_path); | 1973 | pathrelse(search_path); |
1973 | return -EDQUOT; | 1974 | return retval; |
1974 | } | 1975 | } |
1975 | init_tb_struct(th, &s_paste_balance, th->t_super, search_path, | 1976 | init_tb_struct(th, &s_paste_balance, th->t_super, search_path, |
1976 | pasted_size); | 1977 | pasted_size); |
@@ -2024,7 +2025,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree | |||
2024 | pasted_size, inode->i_uid, | 2025 | pasted_size, inode->i_uid, |
2025 | key2type(&(key->on_disk_key))); | 2026 | key2type(&(key->on_disk_key))); |
2026 | #endif | 2027 | #endif |
2027 | vfs_dq_free_space_nodirty(inode, pasted_size); | 2028 | dquot_free_space_nodirty(inode, pasted_size); |
2028 | return retval; | 2029 | return retval; |
2029 | } | 2030 | } |
2030 | 2031 | ||
@@ -2062,9 +2063,10 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | |||
2062 | #endif | 2063 | #endif |
2063 | /* We can't dirty inode here. It would be immediately written but | 2064 | /* We can't dirty inode here. It would be immediately written but |
2064 | * appropriate stat item isn't inserted yet... */ | 2065 | * appropriate stat item isn't inserted yet... */ |
2065 | if (vfs_dq_alloc_space_nodirty(inode, quota_bytes)) { | 2066 | retval = dquot_alloc_space_nodirty(inode, quota_bytes); |
2067 | if (retval) { | ||
2066 | pathrelse(path); | 2068 | pathrelse(path); |
2067 | return -EDQUOT; | 2069 | return retval; |
2068 | } | 2070 | } |
2069 | } | 2071 | } |
2070 | init_tb_struct(th, &s_ins_balance, th->t_super, path, | 2072 | init_tb_struct(th, &s_ins_balance, th->t_super, path, |
@@ -2113,6 +2115,6 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, | |||
2113 | quota_bytes, inode->i_uid, head2type(ih)); | 2115 | quota_bytes, inode->i_uid, head2type(ih)); |
2114 | #endif | 2116 | #endif |
2115 | if (inode) | 2117 | if (inode) |
2116 | vfs_dq_free_space_nodirty(inode, quota_bytes); | 2118 | dquot_free_space_nodirty(inode, quota_bytes); |
2117 | return retval; | 2119 | return retval; |
2118 | } | 2120 | } |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index b4a7dd03bdb9..ea4a77e9d7f5 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -618,9 +618,7 @@ static int reiserfs_quota_on(struct super_block *, int, int, char *, int); | |||
618 | static const struct dquot_operations reiserfs_quota_operations = { | 618 | static const struct dquot_operations reiserfs_quota_operations = { |
619 | .initialize = dquot_initialize, | 619 | .initialize = dquot_initialize, |
620 | .drop = dquot_drop, | 620 | .drop = dquot_drop, |
621 | .alloc_space = dquot_alloc_space, | ||
622 | .alloc_inode = dquot_alloc_inode, | 621 | .alloc_inode = dquot_alloc_inode, |
623 | .free_space = dquot_free_space, | ||
624 | .free_inode = dquot_free_inode, | 622 | .free_inode = dquot_free_inode, |
625 | .transfer = dquot_transfer, | 623 | .transfer = dquot_transfer, |
626 | .write_dquot = reiserfs_write_dquot, | 624 | .write_dquot = reiserfs_write_dquot, |