kernfs: combine ino/id lookup functions into kernfs_find_and_get_node_by_id()
authorTejun Heo <tj@kernel.org>
Mon, 4 Nov 2019 23:54:30 +0000 (15:54 -0800)
committerTejun Heo <tj@kernel.org>
Tue, 12 Nov 2019 16:18:04 +0000 (08:18 -0800)
commitfe0f726c9fb626b1092a9ea3bf75f57f2eed676e
tree5e0b0f747fee61ed6a9f05558419a029eed59d79
parent67c0496e87d193b8356d2af49ab95e8a1b954b3c
kernfs: combine ino/id lookup functions into kernfs_find_and_get_node_by_id()

kernfs_find_and_get_node_by_ino() looks the kernfs_node matching the
specified ino.  On top of that, kernfs_get_node_by_id() and
kernfs_fh_get_inode() implement full ID matching by testing the rest
of ID.

On surface, confusingly, the two are slightly different in that the
latter uses 0 gen as wildcard while the former doesn't - does it mean
that the latter can't uniquely identify inodes w/ 0 gen?  In practice,
this is a distinction without a difference because generation number
starts at 1.  There are no actual IDs with 0 gen, so it can always
safely used as wildcard.

Let's simplify the code by renaming kernfs_find_and_get_node_by_ino()
to kernfs_find_and_get_node_by_id(), moving all lookup logics into it,
and removing now unnecessary kernfs_get_node_by_id().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/kernfs/dir.c
fs/kernfs/kernfs-internal.h
fs/kernfs/mount.c
include/linux/kernfs.h
kernel/cgroup/cgroup.c