aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMarcin Slusarz <marcin.slusarz@gmail.com>2008-02-08 07:20:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:35 -0500
commit4daa1b87992ff210c19a6347cabde22335667004 (patch)
tree0c470a4724dace34b3471fcd4c92a6a81a923619 /fs
parent742ba02a51c8d0bf5446b154531179760c1ed0a2 (diff)
udf: replace loops coded with goto to real loops
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/balloc.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index c3db91b790fd..989259655b40 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -183,46 +183,46 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
183 block = bloc.logicalBlockNum + offset + 183 block = bloc.logicalBlockNum + offset +
184 (sizeof(struct spaceBitmapDesc) << 3); 184 (sizeof(struct spaceBitmapDesc) << 3);
185 185
186do_more: 186 do {
187 overflow = 0; 187 overflow = 0;
188 block_group = block >> (sb->s_blocksize_bits + 3); 188 block_group = block >> (sb->s_blocksize_bits + 3);
189 bit = block % (sb->s_blocksize << 3); 189 bit = block % (sb->s_blocksize << 3);
190 190
191 /* 191 /*
192 * Check to see if we are freeing blocks across a group boundary. 192 * Check to see if we are freeing blocks across a group boundary.
193 */ 193 */
194 if (bit + count > (sb->s_blocksize << 3)) { 194 if (bit + count > (sb->s_blocksize << 3)) {
195 overflow = bit + count - (sb->s_blocksize << 3); 195 overflow = bit + count - (sb->s_blocksize << 3);
196 count -= overflow; 196 count -= overflow;
197 } 197 }
198 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); 198 bitmap_nr = load_block_bitmap(sb, bitmap, block_group);
199 if (bitmap_nr < 0) 199 if (bitmap_nr < 0)
200 goto error_return; 200 goto error_return;
201 201
202 bh = bitmap->s_block_bitmap[bitmap_nr]; 202 bh = bitmap->s_block_bitmap[bitmap_nr];
203 for (i = 0; i < count; i++) { 203 for (i = 0; i < count; i++) {
204 if (udf_set_bit(bit + i, bh->b_data)) { 204 if (udf_set_bit(bit + i, bh->b_data)) {
205 udf_debug("bit %ld already set\n", bit + i); 205 udf_debug("bit %ld already set\n", bit + i);
206 udf_debug("byte=%2x\n", 206 udf_debug("byte=%2x\n",
207 ((char *)bh->b_data)[(bit + i) >> 3]); 207 ((char *)bh->b_data)[(bit + i) >> 3]);
208 } else { 208 } else {
209 if (inode) 209 if (inode)
210 DQUOT_FREE_BLOCK(inode, 1); 210 DQUOT_FREE_BLOCK(inode, 1);
211 udf_add_free_space(sbi, sbi->s_partition, 1); 211 udf_add_free_space(sbi, sbi->s_partition, 1);
212 }
212 } 213 }
213 } 214 mark_buffer_dirty(bh);
214 mark_buffer_dirty(bh); 215 if (overflow) {
215 if (overflow) { 216 block += count;
216 block += count; 217 count = overflow;
217 count = overflow; 218 }
218 goto do_more; 219 } while (overflow);
219 } 220
220error_return: 221error_return:
221 sb->s_dirt = 1; 222 sb->s_dirt = 1;
222 if (sbi->s_lvid_bh) 223 if (sbi->s_lvid_bh)
223 mark_buffer_dirty(sbi->s_lvid_bh); 224 mark_buffer_dirty(sbi->s_lvid_bh);
224 mutex_unlock(&sbi->s_alloc_mutex); 225 mutex_unlock(&sbi->s_alloc_mutex);
225 return;
226} 226}
227 227
228static int udf_bitmap_prealloc_blocks(struct super_block *sb, 228static int udf_bitmap_prealloc_blocks(struct super_block *sb,
@@ -246,37 +246,37 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
246 if (first_block + block_count > part_len) 246 if (first_block + block_count > part_len)
247 block_count = part_len - first_block; 247 block_count = part_len - first_block;
248 248
249repeat: 249 do {
250 nr_groups = udf_compute_nr_groups(sb, partition); 250 nr_groups = udf_compute_nr_groups(sb, partition);
251 block = first_block + (sizeof(struct spaceBitmapDesc) << 3); 251 block = first_block + (sizeof(struct spaceBitmapDesc) << 3);
252 block_group = block >> (sb->s_blocksize_bits + 3); 252 block_group = block >> (sb->s_blocksize_bits + 3);
253 group_start = block_group ? 0 : sizeof(struct spaceBitmapDesc); 253 group_start = block_group ? 0 : sizeof(struct spaceBitmapDesc);
254 254
255 bitmap_nr = load_block_bitmap(sb, bitmap, block_group); 255 bitmap_nr = load_block_bitmap(sb, bitmap, block_group);
256 if (bitmap_nr < 0) 256 if (bitmap_nr < 0)
257 goto out; 257 goto out;
258 bh = bitmap->s_block_bitmap[bitmap_nr]; 258 bh = bitmap->s_block_bitmap[bitmap_nr];
259 259
260 bit = block % (sb->s_blocksize << 3); 260 bit = block % (sb->s_blocksize << 3);
261 261
262 while (bit < (sb->s_blocksize << 3) && block_count > 0) { 262 while (bit < (sb->s_blocksize << 3) && block_count > 0) {
263 if (!udf_test_bit(bit, bh->b_data)) { 263 if (!udf_test_bit(bit, bh->b_data))
264 goto out; 264 goto out;
265 } else if (DQUOT_PREALLOC_BLOCK(inode, 1)) { 265 else if (DQUOT_PREALLOC_BLOCK(inode, 1))
266 goto out; 266 goto out;
267 } else if (!udf_clear_bit(bit, bh->b_data)) { 267 else if (!udf_clear_bit(bit, bh->b_data)) {
268 udf_debug("bit already cleared for block %d\n", bit); 268 udf_debug("bit already cleared for block %d\n", bit);
269 DQUOT_FREE_BLOCK(inode, 1); 269 DQUOT_FREE_BLOCK(inode, 1);
270 goto out; 270 goto out;
271 }
272 block_count--;
273 alloc_count++;
274 bit++;
275 block++;
271 } 276 }
272 block_count--; 277 mark_buffer_dirty(bh);
273 alloc_count++; 278 } while (block_count > 0);
274 bit++; 279
275 block++;
276 }
277 mark_buffer_dirty(bh);
278 if (block_count > 0)
279 goto repeat;
280out: 280out:
281 if (udf_add_free_space(sbi, partition, -alloc_count)) 281 if (udf_add_free_space(sbi, partition, -alloc_count))
282 mark_buffer_dirty(sbi->s_lvid_bh); 282 mark_buffer_dirty(sbi->s_lvid_bh);