From: NeilBrown Date: Sun, 17 Oct 2010 23:43:33 +0000 (+1100) Subject: rollforward: finish DescHole handling. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=b14d38382d8f1a14fdae65d6d8045bf4b740c31f;p=LaFS.git rollforward: finish DescHole handling. This should cause DescHole to be handled correctly. But as we don't generate it yet, it is hard to be sure. Signed-off-by: NeilBrown --- diff --git a/roll.c b/roll.c index a314075..16e6d5e 100644 --- a/roll.c +++ b/roll.c @@ -356,6 +356,14 @@ roll_block(struct fs *fs, int fsnum, int inum, int trunc, struct lafs_inode *li; int err = 0; + /* We found this block during roll-forward and need to + * include it in the filesystem. + * If 'bytes' is 0, the this is a 'hole' and we should + * ignore baddr + */ + if (bytes == DescHole) + baddr = 0; + dprintk("Roll Block %d/%d/%lu/%llu\n", fsnum, inum, (unsigned long) bnum, (unsigned long long)baddr); @@ -387,6 +395,8 @@ roll_block(struct fs *fs, int fsnum, int inum, int trunc, * So if this is a depth==0 non-directory inode, * treat the data as a miniblock update. */ + if (bytes != fs->blocksize) + break; err = lafs_load_page(fs, p, baddr, 1); dprintk("inode load page err %d\n", err); if (err) @@ -395,7 +405,6 @@ roll_block(struct fs *fs, int fsnum, int inum, int trunc, mdsize = le16_to_cpu(lai->metadata_size); if (lai->filetype >= TypeBase && lai->filetype != TypeDir && - bytes == fs->blocksize && lai->depth == 0 && mdsize > 1 && mdsize < fs->blocksize) { u64 sz = le64_to_cpu(lai->metadata[0].file.size); @@ -433,7 +442,7 @@ roll_block(struct fs *fs, int fsnum, int inum, int trunc, /* already correctly indexed */ break; - if (li->type >= TypeBase && + if (li->type >= TypeBase && bytes != DescHole && inode->i_size <= ((loff_t)bnum << inode->i_blkbits)) { inode->i_size = ((loff_t)bnum << inode->i_blkbits) + bytes; set_bit(I_Dirty, &LAFSI(inode)->iflags);