On 26/02/19 10:12AM, Dave Jiang wrote:
> 
> 
> On 1/18/26 3:33 PM, John Groves wrote:
> > From: John Groves <[email protected]>
> > 
> > Upon completion of an OPEN, if we're in famfs-mode we do a GET_FMAP to
> > retrieve and cache up the file-to-dax map in the kernel. If this
> > succeeds, read/write/mmap are resolved direct-to-dax with no upcalls.
> > 
> > Signed-off-by: John Groves <[email protected]>
> > ---
> >  MAINTAINERS               |  8 +++++
> >  fs/fuse/Makefile          |  1 +
> >  fs/fuse/famfs.c           | 74 +++++++++++++++++++++++++++++++++++++++
> >  fs/fuse/file.c            | 14 +++++++-
> >  fs/fuse/fuse_i.h          | 70 +++++++++++++++++++++++++++++++++---
> >  fs/fuse/inode.c           |  8 ++++-
> >  fs/fuse/iomode.c          |  2 +-
> >  include/uapi/linux/fuse.h |  7 ++++
> >  8 files changed, 176 insertions(+), 8 deletions(-)
> >  create mode 100644 fs/fuse/famfs.c
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 10aa5120d93f..e3d0aa5eb361 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -10379,6 +10379,14 @@ F: fs/fuse/
> >  F: include/uapi/linux/fuse.h
> >  F: tools/testing/selftests/filesystems/fuse/
> >  
> > +FUSE [FAMFS Fabric-Attached Memory File System]
> > +M: John Groves <[email protected]>
> > +M: John Groves <[email protected]>
> > +L: [email protected]
> > +L: [email protected]
> > +S: Supported
> > +F: fs/fuse/famfs.c
> > +
> >  FUTEX SUBSYSTEM
> >  M: Thomas Gleixner <[email protected]>
> >  M: Ingo Molnar <[email protected]>
> > diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile
> > index 22ad9538dfc4..3f8dcc8cbbd0 100644
> > --- a/fs/fuse/Makefile
> > +++ b/fs/fuse/Makefile
> > @@ -17,5 +17,6 @@ fuse-$(CONFIG_FUSE_DAX) += dax.o
> >  fuse-$(CONFIG_FUSE_PASSTHROUGH) += passthrough.o backing.o
> >  fuse-$(CONFIG_SYSCTL) += sysctl.o
> >  fuse-$(CONFIG_FUSE_IO_URING) += dev_uring.o
> > +fuse-$(CONFIG_FUSE_FAMFS_DAX) += famfs.o
> >  
> >  virtiofs-y := virtio_fs.o
> > diff --git a/fs/fuse/famfs.c b/fs/fuse/famfs.c
> > new file mode 100644
> > index 000000000000..615819cc922d
> > --- /dev/null
> > +++ b/fs/fuse/famfs.c
> > @@ -0,0 +1,74 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * famfs - dax file system for shared fabric-attached memory
> > + *
> > + * Copyright 2023-2026 Micron Technology, Inc.
> > + *
> > + * This file system, originally based on ramfs the dax support from xfs,
> > + * is intended to allow multiple host systems to mount a common file system
> > + * view of dax files that map to shared memory.
> > + */
> > +
> > +#include <linux/cleanup.h>
> > +#include <linux/fs.h>
> > +#include <linux/mm.h>
> > +#include <linux/dax.h>
> > +#include <linux/iomap.h>
> > +#include <linux/path.h>
> > +#include <linux/namei.h>
> > +#include <linux/string.h>
> > +
> > +#include "fuse_i.h"
> > +
> > +
> > +#define FMAP_BUFSIZE PAGE_SIZE
> > +
> > +int
> > +fuse_get_fmap(struct fuse_mount *fm, struct inode *inode)
> 
> keep the return int on the same line?

Done, thanks

> 
> > +{
> > +   void *fmap_buf __free(kfree) = NULL;
> 
> Should do the variable declaration when you do the kzalloc(). That way you 
> can avoid any potential use before check issues.

Done, thanks

> 
> > +   struct fuse_inode *fi = get_fuse_inode(inode);
> > +   size_t fmap_bufsize = FMAP_BUFSIZE;
> > +   u64 nodeid = get_node_id(inode);
> > +   ssize_t fmap_size;
> > +   int rc;
> > +
> > +   FUSE_ARGS(args);
> > +
> > +   /* Don't retrieve if we already have the famfs metadata */
> > +   if (fi->famfs_meta)
> > +           return 0;
> > +
> > +   fmap_buf = kzalloc(FMAP_BUFSIZE, GFP_KERNEL);
> > +   if (!fmap_buf)
> > +           return -EIO;
> 
> -ENOMEM?
> 
> DJ

Done, thanks!

John


Reply via email to