Skip to content

RFC Split up struct nameidata (take 3)

Andreas Gruenbacher lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest10 patches 12 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10Split up struct nameidatainclude/linux/namei.h+12 -915 replies
2/10Switch from nd->{mnt,dentry} to nd->lookup.path.{mnt,dentry}drivers/md/dm-table.c drivers/mtd/mtdsuper.c fs/9p/vfs_inode.c +40 more+430 -4300 replies
3/10Pass no unnecessary information to iop->permissionfs/afs/internal.h fs/afs/security.c fs/bad_inode.c +41 more+92 -920 replies
4/10Temporary struct vfs_lookup in file_permissionfs/namei.c+6 -56 replies
5/10Use vfs_permission instead of file_permission in sys_fchdirfs/open.c+6 -91 reply
6/10Use vfs_permission instead of file_permission in do_path_lookupfs/namei.c+5 -71 reply
7/10Pass no unnecessary information to iop->createfs/9p/vfs_inode.c fs/affs/affs.h fs/affs/namei.c +48 more+139 -1320 replies
8/10Pass no NULL vfs_lookup to vfs_createfs/9p/vfs_inode.c fs/cifs/dir.c fs/nfsd/vfs.c +1 more+39 -291 reply
9/10Pass no unnecessary information to dop->d_revalidatefs/afs/dir.c fs/autofs/root.c fs/autofs4/root.c +17 more+79 -740 replies
10/10Pass no unnecessary information to iop->lookupfs/9p/vfs_inode.c fs/adfs/dir.c fs/affs/affs.h +59 more+118 -1120 replies

Reviews trailers per patch

1 of 10 patches has a Reviewed-by or Acked-by.

PatchDavid Howells
1/10A-b A-b
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC 00/10] Split up struct nameidata (take 3)

In several places where no nameidata object is available, we are currently passing NULL instead of constructing a temporary nameidata object. This is because struct nameidata is big, and constructing temporary nameidata objects is not efficient. Here is another shot at splitting up struct nameidata: struct vfs_lookup is similar to struct nameidata but leaves out the fields required only while walking an actual pathname. It fits in 24 bytes as opposed to 80 on x86.

This allows to construct temporary vfs_lookup objects where needed instead of the NULL passing, which gets rid of the associated NULL checking, and ensures that struct vfsmnt and the lookup intent are passed down consistently.

In addition, the dentry and vfsmnt in struct vfs_lookup (before: struct nameidata) are put inside a struct path. This allows to use path{get,put} instead of mnt{get,put} plus d{get,put}, resulting in more consistent code. The path{get,put} functions seemingly were suggested by Erez Zadok / Josef 'Jeff' Sipek; Jan Blunck has been working on this recently as well.

This proposal consists of the following patches:

nameidata-split.diff

Introduce struct vfs_lookup and change struct nameidata to embed a struct vfs_lookup. (Requires the next patch to build.)

nameidata-split-2.diff

Update all nameidata users.

permission-args.diff

Switch from struct nameidata to struct vfs_lookup in the permission inode operation and related functions.

file_permission.diff

Create a temporary vfs_lookup object in file_permission().

sys_fchdir.diff
do_path_lookup.diff

Use vfs_permission() instead of file_permission().

create-args.diff

Switch from struct nameidata to struct vfs_lookup in the create inode operation and related functions.

vfs_create-nameidata.diff

Fix all users of vfs_create() to never pass it a NULL vfs_lookup. Get rid of the NULL checks.

d_revalidate-args.diff

Switch from struct nameidata to struct vfs_lookup in the d_revalidate dentry operation and related functions.

lookup-args.diff

Switch from struct nameidata to struct vfs_lookup in the lookup inode operation and related functions.

Ultimately, it would be nice to get rid of all the NULL nameidata / vfs_lookup passing, particularly to the permission inode operation. At that point, permission() could be replaced entirely by vfs_permission(). Other vfs functions like vfs_create() can be cleaned up in a similar way.

Andreas