[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4lknmgdq4d6xlmejrddwumpxuwog3l5iwtmoaet7w6swbtc37i@33xmye5u3g5a>
Date: Wed, 23 Apr 2025 15:19:02 -0500
From: John Groves <John@...ves.net>
To: Joanne Koong <joannelkoong@...il.com>
Cc: Dan Williams <dan.j.williams@...el.com>,
Miklos Szeredi <miklos@...redb.hu>, Bernd Schubert <bschubert@....com>,
John Groves <jgroves@...ron.com>, Jonathan Corbet <corbet@....net>,
Vishal Verma <vishal.l.verma@...el.com>, Dave Jiang <dave.jiang@...el.com>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>,
"Darrick J . Wong" <djwong@...nel.org>, Luis Henriques <luis@...lia.com>,
Randy Dunlap <rdunlap@...radead.org>, Jeff Layton <jlayton@...nel.org>,
Kent Overstreet <kent.overstreet@...ux.dev>, Petr Vorel <pvorel@...e.cz>, Brian Foster <bfoster@...hat.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org, nvdimm@...ts.linux.dev,
linux-cxl@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Amir Goldstein <amir73il@...il.com>, Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Stefan Hajnoczi <shajnocz@...hat.com>, Josef Bacik <josef@...icpanda.com>,
Aravind Ramesh <arramesh@...ron.com>, Ajay Joshi <ajayjoshi@...ron.com>
Subject: Re: [RFC PATCH 11/19] famfs_fuse: Basic famfs mount opts
On 25/04/22 06:51PM, Joanne Koong wrote:
> On Sun, Apr 20, 2025 at 6:34 PM John Groves <John@...ves.net> wrote:
> >
> > * -o shadow=<shadowpath>
> > * -o daxdev=<daxdev>
> >
> > Signed-off-by: John Groves <john@...ves.net>
> > ---
> > fs/fuse/fuse_i.h | 8 +++++++-
> > fs/fuse/inode.c | 25 ++++++++++++++++++++++++-
> > 2 files changed, 31 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> > index b2c563b1a1c8..931613102d32 100644
> > --- a/fs/fuse/fuse_i.h
> > +++ b/fs/fuse/fuse_i.h
> > @@ -580,9 +580,11 @@ struct fuse_fs_context {
> > unsigned int blksize;
> > const char *subtype;
> >
> > - /* DAX device, may be NULL */
> > + /* DAX device for virtiofs, may be NULL */
> > struct dax_device *dax_dev;
> >
> > + const char *shadow; /* famfs - null if not famfs */
> > +
> > /* fuse_dev pointer to fill in, should contain NULL on entry */
> > void **fudptr;
> > };
> > @@ -938,6 +940,10 @@ struct fuse_conn {
> > /** uring connection information*/
> > struct fuse_ring *ring;
> > #endif
> > +
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + char *shadow;
> > +#endif
> > };
> >
> > /*
> > diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> > index 5c6947b12503..7f4b73e739cb 100644
> > --- a/fs/fuse/inode.c
> > +++ b/fs/fuse/inode.c
> > @@ -766,6 +766,9 @@ enum {
> > OPT_ALLOW_OTHER,
> > OPT_MAX_READ,
> > OPT_BLKSIZE,
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + OPT_SHADOW,
> > +#endif
> > OPT_ERR
> > };
> >
> > @@ -780,6 +783,9 @@ static const struct fs_parameter_spec fuse_fs_parameters[] = {
> > fsparam_u32 ("max_read", OPT_MAX_READ),
> > fsparam_u32 ("blksize", OPT_BLKSIZE),
> > fsparam_string ("subtype", OPT_SUBTYPE),
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + fsparam_string("shadow", OPT_SHADOW),
> > +#endif
> > {}
> > };
> >
> > @@ -875,6 +881,15 @@ static int fuse_parse_param(struct fs_context *fsc, struct fs_parameter *param)
> > ctx->blksize = result.uint_32;
> > break;
> >
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + case OPT_SHADOW:
> > + if (ctx->shadow)
> > + return invalfc(fsc, "Multiple shadows specified");
> > + ctx->shadow = param->string;
> > + param->string = NULL;
> > + break;
> > +#endif
> > +
> > default:
> > return -EINVAL;
> > }
> > @@ -888,6 +903,7 @@ static void fuse_free_fsc(struct fs_context *fsc)
> >
> > if (ctx) {
> > kfree(ctx->subtype);
> > + kfree(ctx->shadow);
> > kfree(ctx);
> > }
> > }
> > @@ -919,7 +935,10 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root)
> > else if (fc->dax_mode == FUSE_DAX_INODE_USER)
> > seq_puts(m, ",dax=inode");
> > #endif
> > -
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + if (fc->shadow)
> > + seq_printf(m, ",shadow=%s", fc->shadow);
> > +#endif
> > return 0;
> > }
> >
> > @@ -1825,6 +1844,10 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
> > sb->s_root = root_dentry;
> > if (ctx->fudptr)
> > *ctx->fudptr = fud;
> > +
> > +#if IS_ENABLED(CONFIG_FUSE_FAMFS_DAX)
> > + fc->shadow = kstrdup(ctx->shadow, GFP_KERNEL);
> > +#endif
>
> Since this is kstrdup-ed, I think you meant to also kfree this in
> fuse_conn_put() when the last refcount on fc gets dropped?
Good catch Joanne! That's queued in my "-next" branch.
Thanks,
John
Powered by blists - more mailing lists