Re: [PATCH RFC v2 00/14] md: introduce a new lockless bitmap
From: Yu Kuai
Date: Fri Mar 28 2025 - 21:11:34 EST
Hi,
在 2025/03/28 19:06, Christoph Hellwig 写道:
On Fri, Mar 28, 2025 at 02:08:39PM +0800, Yu Kuai wrote:
A hidden disk, named mdxxx_bitmap, is created for bitmap, see details in
llbitmap_add_disk(). And a file is created as well to manage bitmap IO for
this disk, see details in llbitmap_open_disk(). Read/write bitmap is
converted to buffer IO to this file.
IO fast path will set bits to dirty, and those dirty bits will be cleared
by daemon after IO is done. llbitmap_barrier is used to syncronize between
IO path and daemon;
Why do you need a separate gendisk? I'll try to find some time to read
the code to understand what it does, but it would also be really useful
to explain the need for such an unusual concept here.
The purpose here is to hide the low level bitmap IO implementation to
the API disk->submit_bio(), and the bitmap IO can be converted to buffer
IO to the bdev_file. This is the easiest way that I can think of to
resue the pagecache, with natural ability for dirty page writeback. I do
think about creating a new anon file and implement a new
file_operations, this will be much more complicated.
Meanwhile, bitmap file for the old bitmap will be removed sooner or
later, and this bdev_file implementation will compatible with bitmap
file as well.
Thanks,
Kuai
.