# Re: \[PATCH RFC -next 00/26\] md/md-bitmap: introduce bitmap\_operations

- From: Christoph Hellwig \<hch@infradead.org\>
- Date: 2024-08-13 07:21:30 
- List: linux-raid
- Page: https://ratatoskr.run/linux-raid/2024/08/2705461
- Thread: https://ratatoskr.run/linux-raid/2024/08/2703021/t.md

```text
On Sat, Aug 10, 2024 at 10:08:28AM +0800, Yu Kuai wrote:
> From: Yu Kuai <redacted>
> 
> The background is that currently bitmap is using a global spin_lock,
> cauing lock contention and huge IO performance degration for all raid
> levels.
> 
> However, it's impossible to implement a new lock free bitmap with
> current situation that md-bitmap exposes the internal implementation
> with lots of exported apis. Hence bitmap_operations is invented, to
> describe bitmap core implementation, and a new bitmap can be introduced
> with a new bitmap_operations, we only need to switch to the new one
> during initialization.
> 
> And with this we can build bitmap as kernel module, but that's not
> our concern for now.
> 
> Noted I just compile this patchset, not tested yet.

Refactoring the bitmap code to be modular seems like a good idea.

But I'd just turn this into plain function calls and maybe a hidden
data structure if you feel really fancy.  No need to introduce expensive
indirect calls and a separate module.

```
