On Mon, May 26, 2025 at 9:14 AM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote: > > Hi, > > 在 2025/05/26 0:32, Xiao Ni 写道: > >> The api will be used by mdadm to set bitmap_ops while creating new array > > Hi Kuai > > > > Maybe you want to say "set bitmap type" here? And can you explain more > > here, why does it need this sys file while creating a new array? The > > reason I ask is that it doesn't use a sys file when creating an array > > with bitmap. > > I do mean mddev->bitmap_ops here, this is the same as mddev->pers and > the md/level api. The mdadm patch will write the new helper before > running array. + if (s->btype == BitmapLockless && + sysfs_set_str(&info, NULL, "bitmap_type", "llbitmap") < 0) + goto abort_locked; The three lines of code are in the Create function. From an intuitive perspective, it's used to set bitmap type to llbitmap rather than bitmap ops. And in this patch, it adds the bitmap_type sysfs api to set mddev->bitmap_id. After adding some debug logs, I understand you. It's better to describe here more. Because the sysfs file api is used to set bitmap type. Then it can be used to choose the bitmap ops when creating array in md_create_bitmap > > > > And if it really needs this, can this be gotten by superblock? > > Theoretically, I can, however, the bitmap superblock is read by > bitmap_ops->create method, and we need to set the bitmap_ops > first. And changing the framwork will be much complex. After adding some debug logs, I understand you. Now the default bitmap is "bitmap", so it can set bitmap ops in md_run->md_bitmap_create. If it wants to use llbitmap, it needs to set bitmap type first. Then it can set bitmap ops in md_run->md_bitmap_create. And it's better to explain why it's a better choice to use bitmap_type sys rather than reading from superblock. So in future, developers can understand the design easily. Regards Xiao > > Thanks, > Kuai > >