Re: [Qemu-devel] [PATCH v11 4/7] dm: enable synchronous dax

From: Pankaj Gupta
Date: Tue Jun 11 2019 - 12:09:11 EST




>
> > Hi Mike,
> >
> > Thanks for the review Please find my reply inline.
> >
> > >
> > > dm_table_supports_dax() is called multiple times (from
> > > dm_table_set_restrictions and dm_table_determine_type). It is strange
> > > to have a getter have a side-effect of being a setter too. Overloading
> > > like this could get you in trouble in the future.
> > >
> > > Are you certain this is what you want?
> >
> > I agree with you.
> >
> > >
> > > Or would it be better to refactor dm_table_supports_dax() to take an
> > > iterate_devices_fn arg and have callers pass the appropriate function?
> > > Then have dm_table_set_restrictions() caller do:
> > >
> > > if (dm_table_supports_dax(t, device_synchronous, NULL))
> > > set_dax_synchronous(t->md->dax_dev);
> > >
> > > (NULL arg implies dm_table_supports_dax() refactoring would take a int
> > > *data pointer rather than int type).
> > >
> > > Mike
> > >
> >
> > I am sending below patch as per your suggestion. Does it look
> > near to what you have in mind?
>
> Yes, it does.. just one nit I noticed inlined below.
>
> > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> > index 350cf0451456..8d89acc8b8c2 100644
> > --- a/drivers/md/dm-table.c
> > +++ b/drivers/md/dm-table.c
>
> ...
>
> > @@ -1910,8 +1919,13 @@ void dm_table_set_restrictions(struct dm_table *t,
> > struct request_queue *q,
> > }
> > blk_queue_write_cache(q, wc, fua);
> >
> > - if (dm_table_supports_dax(t, PAGE_SIZE))
> > + if (dm_table_supports_dax(t, device_supports_dax, &page_size)) {
> > +
>
> No need for an empty newline here ^

Sure. Will remove this and send official v12 patchset with the updated patch 4.

Thanks,
Pankaj

>
> > blk_queue_flag_set(QUEUE_FLAG_DAX, q);
> > + if (dm_table_supports_dax(t, device_synchronous, NULL))
> > + set_dax_synchronous(t->md->dax_dev);
> > + }
> > else
> > blk_queue_flag_clear(QUEUE_FLAG_DAX, q);
> >
>
> Thanks,
> Mike
>
>