Re: [PATCH 10/26] dm: Use the block layer zone append emulation

Mike Snitzer
2024-02-05T20:33:32Z

On Mon, Feb 05 2024 at 12:38P -0500,
Damien Le Moal <dlemoal@kernel.org> wrote:

> On 2/4/24 02:58, Mike Snitzer wrote:
> > Love the overall improvement to the DM core code and the broader block
> > layer by switching to this bio-based ZWP approach.
> >
> > Reviewed-by: Mike Snitzer <snitzer@kernel.org>
>
> Thanks Mike !
>
> > But one incremental suggestion inlined below.
>
> I made this change, but in a lightly different form as I noticed that I was
> getting compile errors when CONFIG_BLK_DEV_ZONED is disabled.
> The change look like this now:
>
> static void dm_split_and_process_bio(struct mapped_device *md,
> struct dm_table *map, struct bio *bio)
> {
> ...
> need_split = is_abnormal = is_abnormal_io(bio);
> if (static_branch_unlikely(&zoned_enabled))
> need_split = is_abnormal || dm_zone_bio_needs_split(md, bio);
>
> ...
>
> /*
> * Use the block layer zone write plugging for mapped devices that
> * need zone append emulation (e.g. dm-crypt).
> */
> if (static_branch_unlikely(&zoned_enabled) &&
> dm_zone_write_plug_bio(md, bio))
> return;
>
> ...
>
> with these added to dm-core.h:
>
> static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
> struct bio *bio)
> {
> return md->emulate_zone_append && bio_straddle_zones(bio);
> }
> static inline bool dm_zone_write_plug_bio(struct mapped_device *md,
> struct bio *bio)
> {
> return md->emulate_zone_append && blk_zone_write_plug_bio(bio, 0);
> }
>
> These 2 helpers define to "return false" for !CONFIG_BLK_DEV_ZONED.
> I hope this works for you. Otherwise, I will drop your review tag when posting V2.

Why expose them in dm-core.h ?

Just have what you point in dm-core.h above dm_split_and_process_bio in dm.c ?

And yes, you can retain my Reviewed-by.

Thanks,
Mike