linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Chuck Lever <cel@kernel.org>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, hughd@google.com,
	akpm@linux-foundation.org, Chuck Lever <chuck.lever@oracle.com>,
	jlayton@redhat.com, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v4 1/3] libfs: Add directory operations for stable offsets
Date: Mon, 26 Jun 2023 23:44:15 -0700	[thread overview]
Message-ID: <ZJqFP8W1JmWZ0FHy@infradead.org> (raw)
In-Reply-To: <168780368739.2142.1909222585425739373.stgit@manet.1015granger.net>

> + * @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.

> +extern void stable_offset_init(struct inode *dir);
> +extern int stable_offset_add(struct inode *dir, struct dentry *dentry);
> +extern void stable_offset_remove(struct inode *dir, struct dentry *dentry);
> +extern void stable_offset_destroy(struct inode *dir);

Please drop all the pointless externs for function prototypes.

  reply	other threads:[~2023-06-27  6:47 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 [this message]
2023-06-27  8:52     ` Christian Brauner
2023-06-27 14:04       ` Chuck Lever III
2023-06-27 14:19         ` Jeff Layton
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=ZJqFP8W1JmWZ0FHy@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=hughd@google.com \
    --cc=jlayton@redhat.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;
as well as URLs for NNTP newsgroup(s).