From: Christian Brauner <brauner@kernel.org>
To: Erin Shepherd <erin.shepherd@e43.eu>,
Amir Goldstein <amir73il@gmail.com>,
Jeff Layton <jlayton@kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Chuck Lever <chuck.lever@oracle.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nfs@vger.kernel.org,
Christian Brauner <brauner@kernel.org>
Subject: [PATCH RFC v2 2/3] pidfs: remove 32bit inode number handling
Date: Fri, 29 Nov 2024 14:02:24 +0100 [thread overview]
Message-ID: <20241129-work-pidfs-v2-2-61043d66fbce@kernel.org> (raw)
In-Reply-To: <20241129-work-pidfs-v2-0-61043d66fbce@kernel.org>
Now that we have a unified inode number handling model remove the custom
ida-based allocation for 32bit.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
fs/pidfs.c | 46 +++++-----------------------------------------
1 file changed, 5 insertions(+), 41 deletions(-)
diff --git a/fs/pidfs.c b/fs/pidfs.c
index 0bdd9c525b80895d33f2eae5e8e375788580072f..ff4f25078f3d983bce630e597adbb12262e5d727 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -371,40 +371,6 @@ struct pid *pidfd_pid(const struct file *file)
static struct vfsmount *pidfs_mnt __ro_after_init;
-#if BITS_PER_LONG == 32
-/*
- * Provide a fallback mechanism for 32-bit systems so processes remain
- * reliably comparable by inode number even on those systems.
- */
-static DEFINE_IDA(pidfd_inum_ida);
-
-static int pidfs_inum(struct pid *pid, unsigned long *ino)
-{
- int ret;
-
- ret = ida_alloc_range(&pidfd_inum_ida, RESERVED_PIDS + 1,
- UINT_MAX, GFP_ATOMIC);
- if (ret < 0)
- return -ENOSPC;
-
- *ino = ret;
- return 0;
-}
-
-static inline void pidfs_free_inum(unsigned long ino)
-{
- if (ino > 0)
- ida_free(&pidfd_inum_ida, ino);
-}
-#else
-static inline int pidfs_inum(struct pid *pid, unsigned long *ino)
-{
- *ino = pid->ino;
- return 0;
-}
-#define pidfs_free_inum(ino) ((void)(ino))
-#endif
-
/*
* The vfs falls back to simple_setattr() if i_op->setattr() isn't
* implemented. Let's reject it completely until we have a clean
@@ -456,7 +422,6 @@ static void pidfs_evict_inode(struct inode *inode)
clear_inode(inode);
put_pid(pid);
- pidfs_free_inum(inode->i_ino);
}
static const struct super_operations pidfs_sops = {
@@ -482,17 +447,16 @@ static const struct dentry_operations pidfs_dentry_operations = {
static int pidfs_init_inode(struct inode *inode, void *data)
{
+ struct pid *pid = data;
+
inode->i_private = data;
inode->i_flags |= S_PRIVATE;
inode->i_mode |= S_IRWXU;
inode->i_op = &pidfs_inode_operations;
inode->i_fop = &pidfs_file_operations;
- /*
- * Inode numbering for pidfs start at RESERVED_PIDS + 1. This
- * avoids collisions with the root inode which is 1 for pseudo
- * filesystems.
- */
- return pidfs_inum(data, &inode->i_ino);
+ inode->i_ino = pidfs_ino(pid->ino);
+ inode->i_generation = pidfs_gen(pid->ino);
+ return 0;
}
static void pidfs_put_data(void *data)
--
2.45.2
next prev parent reply other threads:[~2024-11-29 13:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-29 13:02 [PATCH RFC v2 0/3] pidfs: file handle preliminaries Christian Brauner
2024-11-29 13:02 ` [PATCH RFC v2 1/3] pidfs: rework inode number allocation Christian Brauner
2024-12-02 15:15 ` Jan Kara
2024-11-29 13:02 ` Christian Brauner [this message]
2024-12-02 15:18 ` [PATCH RFC v2 2/3] pidfs: remove 32bit inode number handling Jan Kara
2024-11-29 13:02 ` [PATCH RFC v2 3/3] pidfs: support FS_IOC_GETVERSION Christian Brauner
2024-12-02 15:35 ` Jan Kara
2024-11-29 13:37 ` [PATCH RFC 0/6] pidfs: implement file handle support Christian Brauner
2024-11-29 13:38 ` [PATCH RFC 1/6] pseudofs: add support for export_ops Christian Brauner
2024-12-02 15:59 ` Jan Kara
2024-11-29 13:38 ` [PATCH RFC 2/6] fhandle: simplify error handling Christian Brauner
2024-12-02 15:58 ` Jan Kara
2024-11-29 13:38 ` [PATCH RFC 3/6] exportfs: add open method Christian Brauner
2024-12-02 16:05 ` Jan Kara
2024-11-29 13:38 ` [PATCH RFC 4/6] fhandle: pull CAP_DAC_READ_SEARCH check into may_decode_fh() Christian Brauner
2024-12-02 16:01 ` Jan Kara
2024-11-29 13:38 ` [PATCH RFC 5/6] exportfs: add permission method Christian Brauner
2024-12-02 16:04 ` Jan Kara
2024-11-29 13:38 ` [PATCH RFC 6/6] pidfs: implement file handle support Christian Brauner
2024-11-29 14:52 ` Amir Goldstein
2024-11-30 12:22 ` [PATCH RFC 0/6] " Amir Goldstein
2024-12-01 8:43 ` Christian Brauner
2024-12-01 12:09 ` Amir Goldstein
2024-12-01 12:44 ` Christian Brauner
2024-11-29 14:27 ` [PATCH RFC v2 0/3] pidfs: file handle preliminaries Jeff Layton
2024-11-29 14:34 ` Amir Goldstein
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=20241129-work-pidfs-v2-2-61043d66fbce@kernel.org \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=chuck.lever@oracle.com \
--cc=erin.shepherd@e43.eu \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.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