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>
This commit is contained in:
committed by
Linus Torvalds
parent
5daa669c80
commit
1b243fd39b
@@ -329,6 +329,7 @@ static int hfsplus_free_extents(struct super_block *sb,
|
|||||||
{
|
{
|
||||||
u32 count, start;
|
u32 count, start;
|
||||||
int i;
|
int i;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
hfsplus_dump_extent(extent);
|
hfsplus_dump_extent(extent);
|
||||||
for (i = 0; i < 8; extent++, i++) {
|
for (i = 0; i < 8; extent++, i++) {
|
||||||
@@ -345,18 +346,33 @@ found:
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
start = be32_to_cpu(extent->start_block);
|
start = be32_to_cpu(extent->start_block);
|
||||||
if (count <= block_nr) {
|
if (count <= block_nr) {
|
||||||
hfsplus_block_free(sb, start, count);
|
err = hfsplus_block_free(sb, start, count);
|
||||||
|
if (err) {
|
||||||
|
printk(KERN_ERR "hfs: can't free extent\n");
|
||||||
|
dprint(DBG_EXTENT, " start: %u count: %u\n",
|
||||||
|
start, count);
|
||||||
|
}
|
||||||
extent->block_count = 0;
|
extent->block_count = 0;
|
||||||
extent->start_block = 0;
|
extent->start_block = 0;
|
||||||
block_nr -= count;
|
block_nr -= count;
|
||||||
} else {
|
} else {
|
||||||
count -= block_nr;
|
count -= block_nr;
|
||||||
hfsplus_block_free(sb, start + count, block_nr);
|
err = hfsplus_block_free(sb, start + count, block_nr);
|
||||||
|
if (err) {
|
||||||
|
printk(KERN_ERR "hfs: can't free extent\n");
|
||||||
|
dprint(DBG_EXTENT, " start: %u count: %u\n",
|
||||||
|
start, count);
|
||||||
|
}
|
||||||
extent->block_count = cpu_to_be32(count);
|
extent->block_count = cpu_to_be32(count);
|
||||||
block_nr = 0;
|
block_nr = 0;
|
||||||
}
|
}
|
||||||
if (!block_nr || !i)
|
if (!block_nr || !i) {
|
||||||
return 0;
|
/*
|
||||||
|
* Try to free all extents and
|
||||||
|
* return only last error
|
||||||
|
*/
|
||||||
|
return err;
|
||||||
|
}
|
||||||
i--;
|
i--;
|
||||||
extent--;
|
extent--;
|
||||||
count = be32_to_cpu(extent->block_count);
|
count = be32_to_cpu(extent->block_count);
|
||||||
|
Reference in New Issue
Block a user