From: NeilBrown Date: Tue, 22 Jun 2010 05:36:37 +0000 (+1000) Subject: Allow empty index blocks to be loaded. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=8960cf7916e59fe62ceaabf236e5ad1ea06c6759;p=LaFS.git Allow empty index blocks to be loaded. If physaddr is 0, then just create a clean index block. Signed-off-by: NeilBrown --- diff --git a/io.c b/io.c index d15bec8..b1615a4 100644 --- a/io.c +++ b/io.c @@ -409,7 +409,19 @@ lafs_load_block(struct block *b) LAFS_BUG(test_bit(B_InoIdx, &b->flags), b); if (test_bit(B_Index, &b->flags)) { struct indexblock *ib = iblk(b); - LAFS_BUG(b->physaddr == 0, b); + + if (b->physaddr == 0) { + /* An empty index block. One doesn't + * see many of these as it means we trimmed + * out some blocks, but not all following + * block, and block in the hole is being + * looked for. Just Create a valid clear + * index block. + */ + lafs_clear_index(ib); + lafs_iounlock_block(b); + return 0; + } page = virt_to_page(ib->data); offset = offset_in_page(ib->data);