[PATCH v5 00/15] md/md-bitmap: introduce CONFIG_MD_BITMAP

Yu Kuai posted 15 patches 3 months ago
drivers/md/Kconfig      |  18 +++++
drivers/md/Makefile     |   3 +-
drivers/md/dm-raid.c    |  18 +++--
drivers/md/md-bitmap.c  |  74 +++++++++---------
drivers/md/md-bitmap.h  |  62 ++++++++++++++-
drivers/md/md-cluster.c |   2 +-
drivers/md/md.c         | 112 +++++++++++++++++++--------
drivers/md/md.h         |   4 +-
drivers/md/raid1-10.c   |   2 +-
drivers/md/raid1.c      | 163 +++++++++++++++++++---------------------
drivers/md/raid1.h      |  22 +-----
drivers/md/raid10.c     |  49 ++++++------
drivers/md/raid5.c      |  30 ++++----
13 files changed, 330 insertions(+), 229 deletions(-)
[PATCH v5 00/15] md/md-bitmap: introduce CONFIG_MD_BITMAP
Posted by Yu Kuai 3 months ago
From: Yu Kuai <yukuai3@huawei.com>

Changes in v5:
 - rebase on the top of md-6.17;
 - fix compile problem if md-mod is build as module;
 - fix two problems for lvm2 dm-raid tests, patch 5,13
 - other cleanups;
Changes in v4:
 - rebase on the top of other patchset;
Changes in v3:
 - update commit message.
Changes in v2:
 - don't export apis, and don't support build md-bitmap as module

Due to known performance issues with md-bitmap and the unreasonable
implementations like following:

 - self-managed pages, bitmap_storage->filemap;
 - self-managed IO submitting like filemap_write_page();
 - global spin_lock
 ...

I have decided not to continue optimizing based on the current bitmap
implementation, and plan to invent a new lock-less bitmap. And a new
kconfig option is a good way for isolation.

However, we still encourage anyone who wants to continue optimizing the
current implementation

Yu Kuai (15):
  md/raid1: change r1conf->r1bio_pool to a pointer type
  md/raid1: remove struct pool_info and related code
  md/md-bitmap: remove the parameter 'init' for bitmap_ops->resize()
  md/md-bitmap: merge md_bitmap_group into bitmap_operations
  md/md-bitmap: add a new parameter 'flush' to bitmap_ops->enabled
  md/md-bitmap: add md_bitmap_registered/enabled() helper
  md/md-bitmap: handle the case bitmap is not enabled before
    start_sync()
  md/md-bitmap: handle the case bitmap is not enabled before end_sync()
  md/raid1: check bitmap before behind write
  md/raid1: check before referencing mddev->bitmap_ops
  md/raid10: check before referencing mddev->bitmap_ops
  md/raid5: check before referencing mddev->bitmap_ops
  md/dm-raid: check before referencing mddev->bitmap_ops
  md: check before referencing mddev->bitmap_ops
  md/md-bitmap: introduce CONFIG_MD_BITMAP

 drivers/md/Kconfig      |  18 +++++
 drivers/md/Makefile     |   3 +-
 drivers/md/dm-raid.c    |  18 +++--
 drivers/md/md-bitmap.c  |  74 +++++++++---------
 drivers/md/md-bitmap.h  |  62 ++++++++++++++-
 drivers/md/md-cluster.c |   2 +-
 drivers/md/md.c         | 112 +++++++++++++++++++--------
 drivers/md/md.h         |   4 +-
 drivers/md/raid1-10.c   |   2 +-
 drivers/md/raid1.c      | 163 +++++++++++++++++++---------------------
 drivers/md/raid1.h      |  22 +-----
 drivers/md/raid10.c     |  49 ++++++------
 drivers/md/raid5.c      |  30 ++++----
 13 files changed, 330 insertions(+), 229 deletions(-)

-- 
2.39.2
Re: [PATCH v5 00/15] md/md-bitmap: introduce CONFIG_MD_BITMAP
Posted by Xiao Ni 2 months, 1 week ago
On Mon, Jul 7, 2025 at 9:36 AM Yu Kuai <yukuai1@huaweicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@huawei.com>
>
> Changes in v5:
>  - rebase on the top of md-6.17;
>  - fix compile problem if md-mod is build as module;
>  - fix two problems for lvm2 dm-raid tests, patch 5,13
>  - other cleanups;
> Changes in v4:
>  - rebase on the top of other patchset;
> Changes in v3:
>  - update commit message.
> Changes in v2:
>  - don't export apis, and don't support build md-bitmap as module
>
> Due to known performance issues with md-bitmap and the unreasonable
> implementations like following:
>
>  - self-managed pages, bitmap_storage->filemap;
>  - self-managed IO submitting like filemap_write_page();
>  - global spin_lock
>  ...
>
> I have decided not to continue optimizing based on the current bitmap
> implementation, and plan to invent a new lock-less bitmap. And a new
> kconfig option is a good way for isolation.
>
> However, we still encourage anyone who wants to continue optimizing the
> current implementation
>
> Yu Kuai (15):
>   md/raid1: change r1conf->r1bio_pool to a pointer type
>   md/raid1: remove struct pool_info and related code
>   md/md-bitmap: remove the parameter 'init' for bitmap_ops->resize()
>   md/md-bitmap: merge md_bitmap_group into bitmap_operations
>   md/md-bitmap: add a new parameter 'flush' to bitmap_ops->enabled
>   md/md-bitmap: add md_bitmap_registered/enabled() helper
>   md/md-bitmap: handle the case bitmap is not enabled before
>     start_sync()
>   md/md-bitmap: handle the case bitmap is not enabled before end_sync()
>   md/raid1: check bitmap before behind write
>   md/raid1: check before referencing mddev->bitmap_ops
>   md/raid10: check before referencing mddev->bitmap_ops
>   md/raid5: check before referencing mddev->bitmap_ops
>   md/dm-raid: check before referencing mddev->bitmap_ops
>   md: check before referencing mddev->bitmap_ops
>   md/md-bitmap: introduce CONFIG_MD_BITMAP
>
>  drivers/md/Kconfig      |  18 +++++
>  drivers/md/Makefile     |   3 +-
>  drivers/md/dm-raid.c    |  18 +++--
>  drivers/md/md-bitmap.c  |  74 +++++++++---------
>  drivers/md/md-bitmap.h  |  62 ++++++++++++++-
>  drivers/md/md-cluster.c |   2 +-
>  drivers/md/md.c         | 112 +++++++++++++++++++--------
>  drivers/md/md.h         |   4 +-
>  drivers/md/raid1-10.c   |   2 +-
>  drivers/md/raid1.c      | 163 +++++++++++++++++++---------------------
>  drivers/md/raid1.h      |  22 +-----
>  drivers/md/raid10.c     |  49 ++++++------
>  drivers/md/raid5.c      |  30 ++++----
>  13 files changed, 330 insertions(+), 229 deletions(-)
>
> --
> 2.39.2
>
>

The patch set looks good to me.
Reviewed-by: Xiao Ni <xni@redhat.com>
Re: [PATCH v5 00/15] md/md-bitmap: introduce CONFIG_MD_BITMAP
Posted by Yu Kuai 2 months, 1 week ago
在 2025/7/7 9:26, Yu Kuai 写道:
> From: Yu Kuai <yukuai3@huawei.com>
>
> Changes in v5:
>   - rebase on the top of md-6.17;
>   - fix compile problem if md-mod is build as module;
>   - fix two problems for lvm2 dm-raid tests, patch 5,13
>   - other cleanups;
> Changes in v4:
>   - rebase on the top of other patchset;
> Changes in v3:
>   - update commit message.
> Changes in v2:
>   - don't export apis, and don't support build md-bitmap as module
>
> Due to known performance issues with md-bitmap and the unreasonable
> implementations like following:
>
>   - self-managed pages, bitmap_storage->filemap;
>   - self-managed IO submitting like filemap_write_page();
>   - global spin_lock
>   ...
>
> I have decided not to continue optimizing based on the current bitmap
> implementation, and plan to invent a new lock-less bitmap. And a new
> kconfig option is a good way for isolation.
>
> However, we still encourage anyone who wants to continue optimizing the
> current implementation
>
> Yu Kuai (15):
>    md/raid1: change r1conf->r1bio_pool to a pointer type
>    md/raid1: remove struct pool_info and related code
>    md/md-bitmap: remove the parameter 'init' for bitmap_ops->resize()
>    md/md-bitmap: merge md_bitmap_group into bitmap_operations
>    md/md-bitmap: add a new parameter 'flush' to bitmap_ops->enabled
>    md/md-bitmap: add md_bitmap_registered/enabled() helper
>    md/md-bitmap: handle the case bitmap is not enabled before
>      start_sync()
>    md/md-bitmap: handle the case bitmap is not enabled before end_sync()
>    md/raid1: check bitmap before behind write
>    md/raid1: check before referencing mddev->bitmap_ops
>    md/raid10: check before referencing mddev->bitmap_ops
>    md/raid5: check before referencing mddev->bitmap_ops
>    md/dm-raid: check before referencing mddev->bitmap_ops
>    md: check before referencing mddev->bitmap_ops
>    md/md-bitmap: introduce CONFIG_MD_BITMAP
>
>   drivers/md/Kconfig      |  18 +++++
>   drivers/md/Makefile     |   3 +-
>   drivers/md/dm-raid.c    |  18 +++--
>   drivers/md/md-bitmap.c  |  74 +++++++++---------
>   drivers/md/md-bitmap.h  |  62 ++++++++++++++-
>   drivers/md/md-cluster.c |   2 +-
>   drivers/md/md.c         | 112 +++++++++++++++++++--------
>   drivers/md/md.h         |   4 +-
>   drivers/md/raid1-10.c   |   2 +-
>   drivers/md/raid1.c      | 163 +++++++++++++++++++---------------------
>   drivers/md/raid1.h      |  22 +-----
>   drivers/md/raid10.c     |  49 ++++++------
>   drivers/md/raid5.c      |  30 ++++----
>   13 files changed, 330 insertions(+), 229 deletions(-)
>
Applied to md-6.17
Thanks