diff options
author | Vyacheslav Dubeyko <slava@dubeyko.com> | 2012-12-20 18:05:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 20:40:19 -0500 |
commit | 1b243fd39bd605cdfc482bba4e56b0cb34b28f27 (patch) | |
tree | a9884f04fc58cf78cd0eb7219b1230b7e7097064 /fs | |
parent | 5daa669c80c121ab75ecdf1c8e2df52f072fd25e (diff) |
hfsplus: rework processing errors in hfsplus_free_extents()
Currently, it doesn't process error codes from the hfsplus_block_free()
call in hfsplus_free_extents() method. Add some error code processing.
Signed-off-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
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/hfsplus/extents.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 5849e3ef35cc..eba76eab6d62 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c | |||
@@ -329,6 +329,7 @@ static int hfsplus_free_extents(struct super_block *sb, | |||
329 | { | 329 | { |
330 | u32 count, start; | 330 | u32 count, start; |
331 | int i; | 331 | int i; |
332 | int err = 0; | ||
332 | 333 | ||
333 | hfsplus_dump_extent(extent); | 334 | hfsplus_dump_extent(extent); |
334 | for (i = 0; i < 8; extent++, i++) { | 335 | for (i = 0; i < 8; extent++, i++) { |
@@ -345,18 +346,33 @@ found: | |||
345 | for (;;) { | 346 | for (;;) { |
346 | start = be32_to_cpu(extent->start_block); | 347 | start = be32_to_cpu(extent->start_block); |
347 | if (count <= block_nr) { | 348 | if (count <= block_nr) { |
348 | hfsplus_block_free(sb, start, count); | 349 | err = hfsplus_block_free(sb, start, count); |
350 | if (err) { | ||
351 | printk(KERN_ERR "hfs: can't free extent\n"); | ||
352 | dprint(DBG_EXTENT, " start: %u count: %u\n", | ||
353 | start, count); | ||
354 | } | ||
349 | extent->block_count = 0; | 355 | extent->block_count = 0; |
350 | extent->start_block = 0; | 356 | extent->start_block = 0; |
351 | block_nr -= count; | 357 | block_nr -= count; |
352 | } else { | 358 | } else { |
353 | count -= block_nr; | 359 | count -= block_nr; |
354 | hfsplus_block_free(sb, start + count, block_nr); | 360 | err = hfsplus_block_free(sb, start + count, block_nr); |
361 | if (err) { | ||
362 | printk(KERN_ERR "hfs: can't free extent\n"); | ||
363 | dprint(DBG_EXTENT, " start: %u count: %u\n", | ||
364 | start, count); | ||
365 | } | ||
355 | extent->block_count = cpu_to_be32(count); | 366 | extent->block_count = cpu_to_be32(count); |
356 | block_nr = 0; | 367 | block_nr = 0; |
357 | } | 368 | } |
358 | if (!block_nr || !i) | 369 | if (!block_nr || !i) { |
359 | return 0; | 370 | /* |
371 | * Try to free all extents and | ||
372 | * return only last error | ||
373 | */ | ||
374 | return err; | ||
375 | } | ||
360 | i--; | 376 | i--; |
361 | extent--; | 377 | extent--; |
362 | count = be32_to_cpu(extent->block_count); | 378 | count = be32_to_cpu(extent->block_count); |