On Fri, Mar 21, 2025 at 08:18:16AM +0100, Christoph Hellwig wrote: > Add support for zoned device by passing through report_zoned to the > underlying read device. > > This is required to make enable xfstests xfs/311 on zoned devices. On suspend, delay_presuspend() stops delaying and it doesn't guarantee that new bios coming in will always be submitted after the delayed bios it is flushing. That can mess things up for zoned devices. I didn't check if that matters for the specific test. Setting ti->emulate_zone_append = true; would enforce write ordering, at the expense of adding a whole other layer of delays to zoned dm-delay devices. Since this isn't really useful outside of testing, I think that could be acceptable if necessary (it would require us to support table reloads of zoned devices with emulated zone append, since tests often want to change the delay). However it would probably be better to see if we can just make dm-delay preserve write ordering during a suspend. -Ben > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/md/dm-delay.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c > index 08f6387620c1..d4cf0ac2a7aa 100644 > --- a/drivers/md/dm-delay.c > +++ b/drivers/md/dm-delay.c > @@ -369,6 +369,21 @@ static int delay_map(struct dm_target *ti, struct bio *bio) > return delay_bio(dc, c, bio); > } > > +#ifdef CONFIG_BLK_DEV_ZONED > +static int delay_report_zones(struct dm_target *ti, > + struct dm_report_zones_args *args, unsigned int nr_zones) > +{ > + struct delay_c *dc = ti->private; > + struct delay_class *c = &dc->read; > + > + return dm_report_zones(c->dev->bdev, c->start, > + c->start + dm_target_offset(ti, args->next_sector), > + args, nr_zones); > +} > +#else > +#define delay_report_zones NULL > +#endif > + > #define DMEMIT_DELAY_CLASS(c) \ > DMEMIT("%s %llu %u", (c)->dev->name, (unsigned long long)(c)->start, (c)->delay) > > @@ -424,11 +439,12 @@ static int delay_iterate_devices(struct dm_target *ti, > static struct target_type delay_target = { > .name = "delay", > .version = {1, 4, 0}, > - .features = DM_TARGET_PASSES_INTEGRITY, > + .features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_ZONED_HM, > .module = THIS_MODULE, > .ctr = delay_ctr, > .dtr = delay_dtr, > .map = delay_map, > + .report_zones = delay_report_zones, > .presuspend = delay_presuspend, > .resume = delay_resume, > .status = delay_status, > -- > 2.45.2 >