linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Chuck Lever III <chuck.lever@oracle.com>,
	Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Chuck Lever <cel@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm <linux-mm@kvack.org>,
	 "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] libfs: Add directory operations for stable offsets
Date: Tue, 27 Jun 2023 10:19:12 -0400	[thread overview]
Message-ID: <90095816f5a57869af322b2be630bb21235e21bb.camel@redhat.com> (raw)
In-Reply-To: <61C84AD6-EB8E-49D5-BDB1-F87D3D5558B7@oracle.com>

On Tue, 2023-06-27 at 14:04 +0000, Chuck Lever III wrote:
> 
> > On Jun 27, 2023, at 4:52 AM, Christian Brauner <brauner@kernel.org> wrote:
> > 
> > On Mon, Jun 26, 2023 at 11:44:15PM -0700, Christoph Hellwig wrote:
> > > > + * @dir: parent directory to be initialized
> > > > + *
> > > > + */
> > > > +void stable_offset_init(struct inode *dir)
> > > > +{
> > > > + xa_init_flags(&dir->i_doff_map, XA_FLAGS_ALLOC1);
> > > > + dir->i_next_offset = 0;
> > > > +}
> > > > +EXPORT_SYMBOL(stable_offset_init);
> > > 
> > > If this is exported I'd much prefer a EXPORT_SYMBOL_GPL.  But the only
> > > user so far is shmfs, which can't be modular anyway, so I think we can
> > > drop the exports.
> > > 
> > > > --- a/include/linux/dcache.h
> > > > +++ b/include/linux/dcache.h
> > > > @@ -96,6 +96,7 @@ struct dentry {
> > > > struct super_block *d_sb; /* The root of the dentry tree */
> > > > unsigned long d_time; /* used by d_revalidate */
> > > > void *d_fsdata; /* fs-specific data */
> > > > + u32 d_offset; /* directory offset in parent */
> > > > 
> > > > union {
> > > > struct list_head d_lru; /* LRU list */
> > > > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > > > index 133f0640fb24..3fc2c04ed8ff 100644
> > > > --- a/include/linux/fs.h
> > > > +++ b/include/linux/fs.h
> > > > @@ -719,6 +719,10 @@ struct inode {
> > > > #endif
> > > > 
> > > > void *i_private; /* fs or device private pointer */
> > > > +
> > > > + /* simplefs stable directory offset tracking */
> > > > + struct xarray i_doff_map;
> > > > + u32 i_next_offset;
> > > 
> > > We can't just increase the size of the dentry and inode for everyone
> > > for something that doesn't make any sense for normal file systems.
> > > This needs to move out into structures allocated by the file system
> > > and embedded into or used as the private dentry/inode data.
> > 
> > I agree. I prefer if this could be done on a per filesystem basis as
> > well. Especially since, this is currently only useful for a single
> > filesystem.
> > 
> > We've tried to be very conservative in increasing inode and dentry size
> > and we should continue with that.
> 
> I had thought we were going to adopt the stable offset mechanism
> in more than just shmemfs. That's why we're putting it in libfs.c
> after all. So this was not going to be "just for shmemfs" in the
> long run.
> 
> That said, I can move the stable-offset-related inode fields back
> into the shmemfs private inode struct, as it was in v2 of this
> series.
> 

I too think that would be best. The libfs helpers will probably need to
take an extra pointer to the relevant fields in the inode and dentry,
but that's not too hard to do.

> For d_offset, I was (ab)using the d_fsdata field by casting the
> offset value as a pointer. That's kind of ugly. Any suggestions?
> 
> 

Absolutely nothing wrong with interpreting that as an integer. It's a
void * which means that anything that wants to dereference it better
know what it is ahead of time anyway.
-- 
Jeff Layton <jlayton@redhat.com>



  reply	other threads:[~2023-06-27 14:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 18:21 [PATCH v4 0/3] shmemfs stable directory offsets Chuck Lever
2023-06-26 18:21 ` [PATCH v4 1/3] libfs: Add directory operations for stable offsets Chuck Lever
2023-06-27  6:44   ` Christoph Hellwig
2023-06-27  8:52     ` Christian Brauner
2023-06-27 14:04       ` Chuck Lever III
2023-06-27 14:19         ` Jeff Layton [this message]
2023-06-26 18:21 ` [PATCH v4 2/3] shmem: Refactor shmem_symlink() Chuck Lever
2023-06-27  6:44   ` Christoph Hellwig
2023-06-26 18:21 ` [PATCH v4 3/3] shmem: stable directory offsets Chuck Lever
2023-06-27 14:06   ` Bernd Schubert
2023-06-27 14:11     ` Chuck Lever III
2023-06-27 14:48       ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90095816f5a57869af322b2be630bb21235e21bb.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=hch@infradead.org \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox