]> git.neil.brown.name Git - LaFS.git/commitdiff
rollforward: finish DescHole handling.
authorNeilBrown <neilb@suse.de>
Sun, 17 Oct 2010 23:43:33 +0000 (10:43 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 18 Oct 2010 01:26:45 +0000 (12:26 +1100)
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 <neilb@suse.de>
roll.c

diff --git a/roll.c b/roll.c
index a314075e2ecc8cb1160ed7c71766cd759d84356f..16e6d5e88cc871e5841021f31793608e0e57eb5c 100644 (file)
--- 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);