Re: [PATCH V9 5/8] dax: Add dax_operations for use by fs-dax on fsdev dax
From: John Groves
Date: Fri Mar 27 2026 - 10:11:56 EST
On 26/03/25 02:28PM, Dave Jiang wrote:
>
>
> On 3/23/26 5:39 PM, John Groves wrote:
> > From: John Groves <John@xxxxxxxxxx>
> >
> > fsdev: Add dax_operations for use by famfs.
> >
> > This replicates the functionality from drivers/nvdimm/pmem.c that
> > conventional fs-dax file systems (e.g. xfs) use to support dax
> > read/write/mmap to a daxdev - without which famfs can't sit atop a
> > daxdev.
> >
> > - These methods are based on pmem_dax_ops from drivers/nvdimm/pmem.c
> > - fsdev_dax_direct_access() returns the hpa, pfn and kva. The kva was
> > newly stored as dev_dax->virt_addr by dev_dax_probe().
> > - The hpa/pfn are used for mmap (dax_iomap_fault()), and the kva is used
> > for read/write (dax_iomap_rw())
> > - fsdev_dax_recovery_write() and dev_dax_zero_page_range() have not been
> > tested yet. I'm looking for suggestions as to how to test those.
> > - dax-private.h: add dev_dax->cached_size, which fsdev needs to
> > remember. The dev_dax size cannot change while a driver is bound
> > (dev_dax_resize returns -EBUSY if dev->driver is set). Caching the size
> > at probe time allows fsdev's direct_access path can use it without
> > acquiring dax_dev_rwsem (which isn't exported anyway).
> >
> > Signed-off-by: John Groves <john@xxxxxxxxxx>
> > ---
> > drivers/dax/dax-private.h | 1 +
> > drivers/dax/fsdev.c | 84 +++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 85 insertions(+)
> >
> > diff --git a/drivers/dax/dax-private.h b/drivers/dax/dax-private.h
> > index 7a3727d76a68..ee8f3af8387f 100644
> > --- a/drivers/dax/dax-private.h
> > +++ b/drivers/dax/dax-private.h
> > @@ -85,6 +85,7 @@ struct dev_dax {
> > struct dax_region *region;
> > struct dax_device *dax_dev;
> > void *virt_addr;
> > + u64 cached_size;
>
> Just caught this. Need a kdoc entry.
>
> DJ
Thank you! Added for v10
John