Re: [PATCH RFC v2 02/14] md/md-bitmap: pass discard information to bitmap_{start, end}write

From: Yu Kuai
Date: Sun Apr 06 2025 - 21:20:08 EST


Hi,

在 2025/04/04 17:29, Christoph Hellwig 写道:
int (*startwrite)(struct mddev *mddev, sector_t offset,
- unsigned long sectors);
+ unsigned long sectors, bool is_discard);
void (*endwrite)(struct mddev *mddev, sector_t offset,
- unsigned long sectors);
+ unsigned long sectors, bool is_discard);

a bool discard is not a very good interface. I'd expect an op enum or a set
of flag to properly describe it.

Will update in the next version.


But is start/end write really the right interface for discard or should it
have it's own set of ops?

Yes, this is historical issue. The old bitmap handle discard the same as
normal write, while new bitmap handle them differently. And I agree that
add a new ops for discard is better in the long term.

Thanks,
Kuai


.