summaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/bitmap.c')
-rw-r--r--fs/reiserfs/bitmap.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 881f8ea2a6ac..dc9a6829f7c6 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -423,8 +423,11 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
423 set_sb_free_blocks(rs, sb_free_blocks(rs) + 1); 423 set_sb_free_blocks(rs, sb_free_blocks(rs) + 1);
424 424
425 journal_mark_dirty(th, s, sbh); 425 journal_mark_dirty(th, s, sbh);
426 if (for_unformatted) 426 if (for_unformatted) {
427 int depth = reiserfs_write_unlock_nested(s);
427 dquot_free_block_nodirty(inode, 1); 428 dquot_free_block_nodirty(inode, 1);
429 reiserfs_write_lock_nested(s, depth);
430 }
428} 431}
429 432
430void reiserfs_free_block(struct reiserfs_transaction_handle *th, 433void reiserfs_free_block(struct reiserfs_transaction_handle *th,
@@ -1128,6 +1131,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
1128 b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1; 1131 b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1;
1129 int passno = 0; 1132 int passno = 0;
1130 int nr_allocated = 0; 1133 int nr_allocated = 0;
1134 int depth;
1131 1135
1132 determine_prealloc_size(hint); 1136 determine_prealloc_size(hint);
1133 if (!hint->formatted_node) { 1137 if (!hint->formatted_node) {
@@ -1137,10 +1141,13 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
1137 "reiserquota: allocating %d blocks id=%u", 1141 "reiserquota: allocating %d blocks id=%u",
1138 amount_needed, hint->inode->i_uid); 1142 amount_needed, hint->inode->i_uid);
1139#endif 1143#endif
1144 depth = reiserfs_write_unlock_nested(s);
1140 quota_ret = 1145 quota_ret =
1141 dquot_alloc_block_nodirty(hint->inode, amount_needed); 1146 dquot_alloc_block_nodirty(hint->inode, amount_needed);
1142 if (quota_ret) /* Quota exceeded? */ 1147 if (quota_ret) { /* Quota exceeded? */
1148 reiserfs_write_lock_nested(s, depth);
1143 return QUOTA_EXCEEDED; 1149 return QUOTA_EXCEEDED;
1150 }
1144 if (hint->preallocate && hint->prealloc_size) { 1151 if (hint->preallocate && hint->prealloc_size) {
1145#ifdef REISERQUOTA_DEBUG 1152#ifdef REISERQUOTA_DEBUG
1146 reiserfs_debug(s, REISERFS_DEBUG_CODE, 1153 reiserfs_debug(s, REISERFS_DEBUG_CODE,
@@ -1153,6 +1160,7 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
1153 hint->preallocate = hint->prealloc_size = 0; 1160 hint->preallocate = hint->prealloc_size = 0;
1154 } 1161 }
1155 /* for unformatted nodes, force large allocations */ 1162 /* for unformatted nodes, force large allocations */
1163 reiserfs_write_lock_nested(s, depth);
1156 } 1164 }
1157 1165
1158 do { 1166 do {
@@ -1181,9 +1189,11 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
1181 hint->inode->i_uid); 1189 hint->inode->i_uid);
1182#endif 1190#endif
1183 /* Free not allocated blocks */ 1191 /* Free not allocated blocks */
1192 depth = reiserfs_write_unlock_nested(s);
1184 dquot_free_block_nodirty(hint->inode, 1193 dquot_free_block_nodirty(hint->inode,
1185 amount_needed + hint->prealloc_size - 1194 amount_needed + hint->prealloc_size -
1186 nr_allocated); 1195 nr_allocated);
1196 reiserfs_write_lock_nested(s, depth);
1187 } 1197 }
1188 while (nr_allocated--) 1198 while (nr_allocated--)
1189 reiserfs_free_block(hint->th, hint->inode, 1199 reiserfs_free_block(hint->th, hint->inode,
@@ -1214,10 +1224,13 @@ static inline int blocknrs_and_prealloc_arrays_from_search_start
1214 REISERFS_I(hint->inode)->i_prealloc_count, 1224 REISERFS_I(hint->inode)->i_prealloc_count,
1215 hint->inode->i_uid); 1225 hint->inode->i_uid);
1216#endif 1226#endif
1227
1228 depth = reiserfs_write_unlock_nested(s);
1217 dquot_free_block_nodirty(hint->inode, amount_needed + 1229 dquot_free_block_nodirty(hint->inode, amount_needed +
1218 hint->prealloc_size - nr_allocated - 1230 hint->prealloc_size - nr_allocated -
1219 REISERFS_I(hint->inode)-> 1231 REISERFS_I(hint->inode)->
1220 i_prealloc_count); 1232 i_prealloc_count);
1233 reiserfs_write_lock_nested(s, depth);
1221 } 1234 }
1222 1235
1223 return CARRY_ON; 1236 return CARRY_ON;