Re: [PATCH v2 2/2] dax: add a sysfs knob to control memmap_on_memory behavior

From: Verma, Vishal L
Date: Fri Dec 08 2023 - 16:27:00 EST


On Fri, 2023-12-08 at 11:13 +0800, Huang, Ying wrote:
> Vishal Verma <vishal.l.verma@xxxxxxxxx> writes:
>
[..]
> >
> > +
> > +static ssize_t memmap_on_memory_store(struct device *dev,
> > +                                     struct device_attribute *attr,
> > +                                     const char *buf, size_t len)
> > +{
> > +       struct dev_dax *dev_dax = to_dev_dax(dev);
> > +       struct dax_region *dax_region = dev_dax->region;
> > +       ssize_t rc;
> > +       bool val;
> > +
> > +       rc = kstrtobool(buf, &val);
> > +       if (rc)
> > +               return rc;
> > +
> > +       if (dev_dax->memmap_on_memory == val)
> > +               return len;
> > +
> > +       device_lock(dax_region->dev);
> > +       if (!dax_region->dev->driver) {
>
> This still doesn't look right.  Can we check whether the current driver
> is kmem?  And only allow change if it's not kmem?

Ah yes I lost track of this todo between revisions when I split this
out. Let me fix that for the next revision.