btrfs-progs: lowmem check: Fix false alert about file extent interrupt
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>
Thu, 22 Jun 2017 08:12:56 +0000 (16:12 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Jun 2017 15:10:06 +0000 (17:10 +0200)
As Qu mentioned in this thread
(https://www.spinics.net/lists/linux-btrfs/msg64469.html), compression
can cause regular extent to co-exist with an inlined extent. This
coexistence makes things confusing. Since it is currently allowed and
can appear in a filesystem, fix btrfsck to prevent a bunch of error
reports to appear that will make user feel uneasy.

When checking a file extent, record the extent_end of the regular extent
to check if there is a gap between the regular extents. Normally there
is only one inlined extent, so the extent_end of inlined extent is
useless. However, if a regular extent can co-exist with an inlined
extent, the extent_end of the inlined extent also needs to be recorded.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index a7d3ab3..23adc03 100644 (file)
@@ -4777,6 +4777,7 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_key *fkey,
                                extent_num_bytes, item_inline_len);
                        err |= FILE_EXTENT_ERROR;
                }
+               *end += extent_num_bytes;
                *size += extent_num_bytes;
                return err;
        }