From: NeilBrown Date: Tue, 25 Aug 2009 07:09:54 +0000 (+1000) Subject: IO: support loading of an index block from addr 0. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=79ad835cdfdb202f9c05059a635b2d92f5351dc5;p=LaFS.git IO: support loading of an index block from addr 0. This can happen when adding blocks to a prevously truncated file, or even when continuing with a slow truncate. phys==0 just means the index block is empty, so honour that. --- diff --git a/io.c b/io.c index dcf106a..994c2ab 100644 --- a/io.c +++ b/io.c @@ -406,11 +406,10 @@ lafs_load_block(struct block *b) if (test_bit(B_Index, &b->flags)) { struct indexblock *ib = iblk(b); if (b->physaddr == 0) { - LAFS_BUG(1, b); - /* I think this is really an error FIXME */ - memset(ib->data, 0, b->inode->i_sb->s_blocksize); + lafs_clear_index(ib); + set_bit(B_Valid, &ib->b.flags); lafs_iounlock_block(b); - return -EIO; + return 0; } page = virt_to_page(ib->data); offset = offset_in_page(ib->data);