On Thu, Apr 27, 2023 at 2:35 AM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> 在 2023/04/27 1:58, Song Liu 写道:
> > Hi Jonathan,
> >
> > On Tue, Apr 25, 2023 at 8:44 PM Song Liu <song@xxxxxxxxxx> wrote:
> >>
> >> On Mon, Apr 24, 2023 at 6:16 PM Jonathan Derrick
> >> <jonathan.derrick@xxxxxxxxx> wrote:
> >>>
> >>> Bitmap offset is allowed to be negative, indicating that bitmap precedes
> >>> metadata. Change the type back from sector_t to loff_t to satisfy
> >>> conditionals and calculations.
> >
> > This actually breaks the following tests from mdadm:
> >
> > 05r1-add-internalbitmap-v1a
>
> After a quick look of this test, I think the root cause is another
> patch:
>
> commit 8745faa95611 ("md: Use optimal I/O size for last bitmap page")
>
> This patch add a new helper bitmap_io_size(), which breaks the condition
> that 'negative value < 0'.
>
> And following patch should fix this problem:
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index adbe95e03852..b1b521837156 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -219,8 +219,9 @@ static unsigned int optimal_io_size(struct
> block_device *bdev,
> }
>
> static unsigned int bitmap_io_size(unsigned int io_size, unsigned int
> opt_size,
> - sector_t start, sector_t boundary)
> + loff_t start, loff_t boundary)
> {
>
> > 05r1-internalbitmap-v1a
> > 05r1-remove-internalbitmap-v1a
> >
>
> The patch is not tested yet, and I don't have time to look other tests
> yet...
Thanks Kuai! This fixed the test.
I will add your Signed-off-by to the patch. Please let me know if you
prefer not to have it.
Song