btrfs-progs: calibrate extent_end when found a gap
diff mbox series

Message ID 20180904124201.3287-1-lufq.fnst@cn.fujitsu.com
State New
Headers show
Series
  • btrfs-progs: calibrate extent_end when found a gap
Related show

Commit Message

Lu Fengqi Sept. 4, 2018, 12:42 p.m. UTC
The extent_end will be used to check whether there is gap between this
extent and next extent. If it is not calibrated, check_file_extent will
mistake that there are gaps between the remaining extents.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 check/mode-lowmem.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Sterba Sept. 11, 2018, 2:41 p.m. UTC | #1
On Tue, Sep 04, 2018 at 08:42:01PM +0800, Lu Fengqi wrote:
> The extent_end will be used to check whether there is gap between this
> extent and next extent. If it is not calibrated, check_file_extent will

Do you mean 'synchronized' or 'matching'.

> mistake that there are gaps between the remaining extents.

If this is a bugfix, do you have a testcase? Thanks.
Lu Fengqi Sept. 13, 2018, 8:30 a.m. UTC | #2
On Tue, Sep 11, 2018 at 04:41:21PM +0200, David Sterba wrote:
>On Tue, Sep 04, 2018 at 08:42:01PM +0800, Lu Fengqi wrote:
>> The extent_end will be used to check whether there is gap between this
>> extent and next extent. If it is not calibrated, check_file_extent will
>
>Do you mean 'synchronized' or 'matching'.

I apologize for this incomprehensible commit message, and I have updated
the commit message.

[PATCH] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent

>
>> mistake that there are gaps between the remaining extents.
>
>If this is a bugfix, do you have a testcase? Thanks.
>

The testcase requires some check repair's fixes (including originl and lowmem)
that my colleagues are working on. After they get it, I will send the
testcase.

The attached is the image which can trigger the false alert.

Without the patch mentioned before, lowmem check will false alert that expect
the hole extent [257 EXTENT_DATA 8192].

ERROR: root 5 EXTENT_DATA[257 12288] gap exists, expected: EXTENT_DATA[257 8192]
Lu Fengqi Sept. 13, 2018, 8:32 a.m. UTC | #3
On Thu, Sep 13, 2018 at 04:30:28PM +0800, Lu Fengqi wrote:
>On Tue, Sep 11, 2018 at 04:41:21PM +0200, David Sterba wrote:
>>On Tue, Sep 04, 2018 at 08:42:01PM +0800, Lu Fengqi wrote:
>>> The extent_end will be used to check whether there is gap between this
>>> extent and next extent. If it is not calibrated, check_file_extent will
>>
>>Do you mean 'synchronized' or 'matching'.
>
>I apologize for this incomprehensible commit message, and I have updated
>the commit message.
>
>[PATCH] btrfs-progs: lowmem: fix false alert about the existence of gaps in the check_file_extent
>
>>
>>> mistake that there are gaps between the remaining extents.
>>
>>If this is a bugfix, do you have a testcase? Thanks.
>>
>
>The testcase requires some check repair's fixes (including originl and lowmem)
>that my colleagues are working on. After they get it, I will send the
>testcase.
>
>The attached is the image which can trigger the false alert.

Sorry, I miss the attached.

Patch
diff mbox series

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 1bce44f5658a..0f14a4968e84 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -1972,6 +1972,7 @@  static int check_file_extent(struct btrfs_root *root, struct btrfs_path *path,
 				root->objectid, fkey.objectid, fkey.offset,
 				fkey.objectid, *end);
 		}
+		*end = fkey.offset;
 	}
 
 	*end += extent_num_bytes;