]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: fix AGFL extent count calculation in xrep_agfl_fill
authorjiazhenyuan <jiazhenyuan@uniontech.com>
Tue, 23 Jun 2026 02:41:53 +0000 (10:41 +0800)
committerCarlos Maiolino <cem@kernel.org>
Mon, 29 Jun 2026 07:54:22 +0000 (09:54 +0200)
In xrep_agfl_fill(), the call to xagb_bitmap_set() passes
'agbno - 1' as the length argument. However, xagb_bitmap_set()
expects a length (number of blocks), not an end block number.
Passing 'agbno - 1' causes used_extents to record an incorrect
range.

Fix this by calculating the correct length as 'agbno - start',
which represents the actual number of blocks filled into the AGFL.

Signed-off-by: jiazhenyuan <jiazhenyuan@uniontech.com>
Fixes: 014ad53732d2ba ("xfs: use per-AG bitmaps to reap unused AG metadata blocks during repair")
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/agheader_repair.c

index 7114c9a44182c1344d928c4dd593ad0375a3319d..2554494847ff1bdfdd333862742cda29a61818fb 100644 (file)
@@ -652,7 +652,7 @@ xrep_agfl_fill(
        while (agbno < start + len && af->fl_off < af->flcount)
                af->agfl_bno[af->fl_off++] = cpu_to_be32(agbno++);
 
-       error = xagb_bitmap_set(&af->used_extents, start, agbno - 1);
+       error = xagb_bitmap_set(&af->used_extents, start, agbno - start);
        if (error)
                return error;