Skip to content

Commit 8943474

Browse files
foxhlchenJonathan Corbet
authored andcommitted
docs: path-lookup: use bare function() rather than literals
As suggested by Matthew Wilcox and Jonathan Corbet, drop ``...`` literals around function names of this patchset. Signed-off-by: Fox Chen <[email protected]> Reviewed-by: NeilBrown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Corbet <[email protected]>
1 parent ef4aa53 commit 8943474

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

Documentation/filesystems/path-lookup.rst

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,13 @@ If that doesn't get a good result, it calls "``lookup_slow()``" which
450450
takes ``i_rwsem``, rechecks the cache, and then asks the filesystem
451451
to find a definitive answer.
452452

453-
As the last step of ``walk_component()``, ``step_into()`` will be called either
453+
As the last step of walk_component(), step_into() will be called either
454454
directly from walk_component() or from handle_dots(). It calls
455-
``handle_mounts()``, to check and handle mount points, in which a new
455+
handle_mounts(), to check and handle mount points, in which a new
456456
``struct path`` is created containing a counted reference to the new dentry and
457457
a reference to the new ``vfsmount`` which is only counted if it is
458458
different from the previous ``vfsmount``. Then if there is
459-
a symbolic link, ``step_into()`` calls ``pick_link()`` to deal with it,
459+
a symbolic link, step_into() calls pick_link() to deal with it,
460460
otherwise it installs the new ``struct path`` in the ``struct nameidata``, and
461461
drops the unneeded references.
462462

@@ -472,8 +472,8 @@ Handling the final component
472472
``nd->last_type`` to refer to the final component of the path. It does
473473
not call ``walk_component()`` that last time. Handling that final
474474
component remains for the caller to sort out. Those callers are
475-
``path_lookupat()``, ``path_parentat()`` and
476-
``path_openat()`` each of which handles the differing requirements of
475+
path_lookupat(), path_parentat() and
476+
path_openat() each of which handles the differing requirements of
477477
different system calls.
478478

479479
``path_parentat()`` is clearly the simplest - it just wraps a little bit
@@ -489,17 +489,17 @@ object is wanted such as by ``stat()`` or ``chmod()``. It essentially just
489489
calls ``walk_component()`` on the final component through a call to
490490
``lookup_last()``. ``path_lookupat()`` returns just the final dentry.
491491
It is worth noting that when flag ``LOOKUP_MOUNTPOINT`` is set,
492-
``path_lookupat()`` will unset LOOKUP_JUMPED in nameidata so that in the
493-
subsequent path traversal ``d_weak_revalidate()`` won't be called.
492+
path_lookupat() will unset LOOKUP_JUMPED in nameidata so that in the
493+
subsequent path traversal d_weak_revalidate() won't be called.
494494
This is important when unmounting a filesystem that is inaccessible, such as
495495
one provided by a dead NFS server.
496496

497497
Finally ``path_openat()`` is used for the ``open()`` system call; it
498-
contains, in support functions starting with "``open_last_lookups()``", all the
498+
contains, in support functions starting with "open_last_lookups()", all the
499499
complexity needed to handle the different subtleties of O_CREAT (with
500500
or without O_EXCL), final "``/``" characters, and trailing symbolic
501501
links. We will revisit this in the final part of this series, which
502-
focuses on those symbolic links. "``open_last_lookups()``" will sometimes, but
502+
focuses on those symbolic links. "open_last_lookups()" will sometimes, but
503503
not always, take ``i_rwsem``, depending on what it finds.
504504

505505
Each of these, or the functions which call them, need to be alert to
@@ -651,9 +651,9 @@ RCU-walk finds it cannot stop gracefully, it simply gives up and
651651
restarts from the top with REF-walk.
652652

653653
This pattern of "try RCU-walk, if that fails try REF-walk" can be
654-
clearly seen in functions like ``filename_lookup()``,
655-
``filename_parentat()``,
656-
``do_filp_open()``, and ``do_file_open_root()``. These four
654+
clearly seen in functions like filename_lookup(),
655+
filename_parentat(),
656+
do_filp_open(), and do_file_open_root(). These four
657657
correspond roughly to the three ``path_*()`` functions we met earlier,
658658
each of which calls ``link_path_walk()``. The ``path_*()`` functions are
659659
called using different mode flags until a mode is found which works.
@@ -1069,8 +1069,8 @@ all the data structures it references are safe to be accessed while
10691069
holding no counted reference, only the RCU lock. A callback
10701070
``struct delayed_called`` will be passed to ``->get_link()``:
10711071
file systems can set their own put_link function and argument through
1072-
``set_delayed_call()``. Later on, when VFS wants to put link, it will call
1073-
``do_delayed_call()`` to invoke that callback function with the argument.
1072+
set_delayed_call(). Later on, when VFS wants to put link, it will call
1073+
do_delayed_call() to invoke that callback function with the argument.
10741074

10751075
In order for the reference to each symlink to be dropped when the walk completes,
10761076
whether in RCU-walk or REF-walk, the symlink stack needs to contain,
@@ -1103,7 +1103,7 @@ doesn't need to notice. Getting this ``name`` variable on and off the
11031103
stack is very straightforward; pushing and popping the references is
11041104
a little more complex.
11051105

1106-
When a symlink is found, ``walk_component()`` calls ``pick_link()`` via ``step_into()``
1106+
When a symlink is found, walk_component() calls pick_link() via step_into()
11071107
which returns the link from the filesystem.
11081108
Providing that operation is successful, the old path ``name`` is placed on the
11091109
stack, and the new value is used as the ``name`` for a while. When the end of
@@ -1136,10 +1136,10 @@ Symlinks with no final component
11361136

11371137
A pair of special-case symlinks deserve a little further explanation.
11381138
Both result in a new ``struct path`` (with mount and dentry) being set
1139-
up in the ``nameidata``, and result in ``pick_link()`` returning ``NULL``.
1139+
up in the ``nameidata``, and result in pick_link() returning ``NULL``.
11401140

11411141
The more obvious case is a symlink to "``/``". All symlinks starting
1142-
with "``/``" are detected in ``pick_link()`` which resets the ``nameidata``
1142+
with "``/``" are detected in pick_link() which resets the ``nameidata``
11431143
to point to the effective filesystem root. If the symlink only
11441144
contains "``/``" then there is nothing more to do, no components at all,
11451145
so ``NULL`` is returned to indicate that the symlink can be released and
@@ -1157,9 +1157,9 @@ target file, not just the name of it. When you ``readlink`` these
11571157
objects you get a name that might refer to the same file - unless it
11581158
has been unlinked or mounted over. When ``walk_component()`` follows
11591159
one of these, the ``->get_link()`` method in "procfs" doesn't return
1160-
a string name, but instead calls ``nd_jump_link()`` which updates the
1160+
a string name, but instead calls nd_jump_link() which updates the
11611161
``nameidata`` in place to point to that target. ``->get_link()`` then
1162-
returns ``NULL``. Again there is no final component and ``pick_link()``
1162+
returns ``NULL``. Again there is no final component and pick_link()
11631163
returns ``NULL``.
11641164

11651165
Following the symlink in the final component
@@ -1177,35 +1177,35 @@ potentially need to call ``link_path_walk()`` again and again on
11771177
successive symlinks until one is found that doesn't point to another
11781178
symlink.
11791179

1180-
This case is handled by relevant callers of ``link_path_walk()``, such as
1181-
``path_lookupat()``, ``path_openat()`` using a loop that calls ``link_path_walk()``,
1182-
and then handles the final component by calling ``open_last_lookups()`` or
1183-
``lookup_last()``. If it is a symlink that needs to be followed,
1184-
``open_last_lookups()`` or ``lookup_last()`` will set things up properly and
1180+
This case is handled by relevant callers of link_path_walk(), such as
1181+
path_lookupat(), path_openat() using a loop that calls link_path_walk(),
1182+
and then handles the final component by calling open_last_lookups() or
1183+
lookup_last(). If it is a symlink that needs to be followed,
1184+
open_last_lookups() or lookup_last() will set things up properly and
11851185
return the path so that the loop repeats, calling
1186-
``link_path_walk()`` again. This could loop as many as 40 times if the last
1186+
link_path_walk() again. This could loop as many as 40 times if the last
11871187
component of each symlink is another symlink.
11881188

11891189
Of the various functions that examine the final component,
1190-
``open_last_lookups()`` is the most interesting as it works in tandem
1191-
with ``do_open()`` for opening a file. Part of ``open_last_lookups()`` runs
1192-
with ``i_rwsem`` held and this part is in a separate function: ``lookup_open()``.
1190+
open_last_lookups() is the most interesting as it works in tandem
1191+
with do_open() for opening a file. Part of open_last_lookups() runs
1192+
with ``i_rwsem`` held and this part is in a separate function: lookup_open().
11931193

1194-
Explaining ``open_last_lookups()`` and ``do_open()`` completely is beyond the scope
1194+
Explaining open_last_lookups() and do_open() completely is beyond the scope
11951195
of this article, but a few highlights should help those interested in exploring
11961196
the code.
11971197

1198-
1. Rather than just finding the target file, ``do_open()`` is used after
1199-
``open_last_lookup()`` to open
1198+
1. Rather than just finding the target file, do_open() is used after
1199+
open_last_lookup() to open
12001200
it. If the file was found in the dcache, then ``vfs_open()`` is used for
12011201
this. If not, then ``lookup_open()`` will either call ``atomic_open()`` (if
12021202
the filesystem provides it) to combine the final lookup with the open, or
12031203
will perform the separate ``i_op->lookup()`` and ``i_op->create()`` steps
12041204
directly. In the later case the actual "open" of this newly found or
1205-
created file will be performed by ``vfs_open()``, just as if the name
1205+
created file will be performed by vfs_open(), just as if the name
12061206
were found in the dcache.
12071207

1208-
2. ``vfs_open()`` can fail with ``-EOPENSTALE`` if the cached information
1208+
2. vfs_open() can fail with ``-EOPENSTALE`` if the cached information
12091209
wasn't quite current enough. If it's in RCU-walk ``-ECHILD`` will be returned
12101210
otherwise ``-ESTALE`` is returned. When ``-ESTALE`` is returned, the caller may
12111211
retry with ``LOOKUP_REVAL`` flag set.
@@ -1218,8 +1218,8 @@ the code.
12181218

12191219
will create a file called ``/tmp/bar``. This is not permitted if
12201220
``O_EXCL`` is set but otherwise is handled for an O_CREAT open much
1221-
like for a non-creating open: ``lookup_last()`` or ``open_last_lookup()``
1222-
returns a non ``NULL`` value, and ``link_path_walk()`` gets called and the
1221+
like for a non-creating open: lookup_last() or open_last_lookup()
1222+
returns a non ``NULL`` value, and link_path_walk() gets called and the
12231223
open process continues on the symlink that was found.
12241224

12251225
Updating the access time

0 commit comments

Comments
 (0)