Skip to content

Commit 03c212b

Browse files
committed
pidfs: remove 32bit inode number handling
Now that we have a unified inode number handling model remove the custom ida-based allocation for 32bit. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 9698d5a commit 03c212b

File tree

1 file changed

+2
-41
lines changed

1 file changed

+2
-41
lines changed

fs/pidfs.c

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -391,40 +391,6 @@ struct pid *pidfd_pid(const struct file *file)
391391

392392
static struct vfsmount *pidfs_mnt __ro_after_init;
393393

394-
#if BITS_PER_LONG == 32
395-
/*
396-
* Provide a fallback mechanism for 32-bit systems so processes remain
397-
* reliably comparable by inode number even on those systems.
398-
*/
399-
static DEFINE_IDA(pidfd_inum_ida);
400-
401-
static int pidfs_inum(struct pid *pid, unsigned long *ino)
402-
{
403-
int ret;
404-
405-
ret = ida_alloc_range(&pidfd_inum_ida, RESERVED_PIDS + 1,
406-
UINT_MAX, GFP_ATOMIC);
407-
if (ret < 0)
408-
return -ENOSPC;
409-
410-
*ino = ret;
411-
return 0;
412-
}
413-
414-
static inline void pidfs_free_inum(unsigned long ino)
415-
{
416-
if (ino > 0)
417-
ida_free(&pidfd_inum_ida, ino);
418-
}
419-
#else
420-
static inline int pidfs_inum(struct pid *pid, unsigned long *ino)
421-
{
422-
*ino = pidfs_ino(pid->ino);
423-
return 0;
424-
}
425-
#define pidfs_free_inum(ino) ((void)(ino))
426-
#endif
427-
428394
/*
429395
* The vfs falls back to simple_setattr() if i_op->setattr() isn't
430396
* implemented. Let's reject it completely until we have a clean
@@ -476,7 +442,6 @@ static void pidfs_evict_inode(struct inode *inode)
476442

477443
clear_inode(inode);
478444
put_pid(pid);
479-
pidfs_free_inum(inode->i_ino);
480445
}
481446

482447
static const struct super_operations pidfs_sops = {
@@ -509,13 +474,9 @@ static int pidfs_init_inode(struct inode *inode, void *data)
509474
inode->i_mode |= S_IRWXU;
510475
inode->i_op = &pidfs_inode_operations;
511476
inode->i_fop = &pidfs_file_operations;
477+
inode->i_ino = pidfs_ino(pid->ino);
512478
inode->i_generation = pidfs_gen(pid->ino);
513-
/*
514-
* Inode numbering for pidfs start at RESERVED_PIDS + 1. This
515-
* avoids collisions with the root inode which is 1 for pseudo
516-
* filesystems.
517-
*/
518-
return pidfs_inum(data, &inode->i_ino);
479+
return 0;
519480
}
520481

521482
static void pidfs_put_data(void *data)

0 commit comments

Comments
 (0)