On Mon, Oct 18 2021 at 12:40P -0400, Christoph Hellwig <hch@xxxxxx> wrote: > Replace the dax_host_hash with an xarray indexed by the pointer value > of the gendisk, and require explicitl calls from the block drivers that > want to associate their gendisk with a dax_device. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> ... > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > index 79737aee516b1..a0a4703620650 100644 > --- a/drivers/md/dm.c > +++ b/drivers/md/dm.c > @@ -1683,6 +1683,7 @@ static void cleanup_mapped_device(struct mapped_device *md) > bioset_exit(&md->io_bs); > > if (md->dax_dev) { > + dax_remove_host(md->disk); > kill_dax(md->dax_dev); > put_dax(md->dax_dev); > md->dax_dev = NULL; > @@ -1784,10 +1785,11 @@ static struct mapped_device *alloc_dev(int minor) > sprintf(md->disk->disk_name, "dm-%d", minor); > > if (IS_ENABLED(CONFIG_FS_DAX)) { > - md->dax_dev = alloc_dax(md, md->disk->disk_name, > - &dm_dax_ops, 0); > + md->dax_dev = alloc_dax(md, &dm_dax_ops, 0); > if (IS_ERR(md->dax_dev)) > goto bad; > + if (dax_add_host(md->dax_dev, md->disk)) > + goto bad; > } > > format_dev_t(md->name, MKDEV(_major, minor)); Acked-by: Mike Snitzer <snitzer@xxxxxxxxxx>