]> git.baikalelectronics.ru Git - kernel.git/commit
autofs: simplify get_next_positive_...(), get rid of trylocks
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 25 Jul 2019 03:01:55 +0000 (23:01 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 25 Jul 2019 03:02:21 +0000 (23:02 -0400)
commitc1b9728978bc2b474e401439d3a9b7cdc3e37d5f
tree145157267c90462a14ecaec483657d796a37e5d5
parent8ae2f793d21f67d4ab95029bb6873efffa36907b
autofs: simplify get_next_positive_...(), get rid of trylocks

* new helper: positive_after(parent, child); parent->d_lock is
held by caller, grabs and returns the first thing after child
in the list of children that has simple_positive() true.  NULL
if nothing's found; NULL child == search the entire list.

* get_next_positive_subdir() loses the redundant check for
d_count and switches to use of that helper.  BTW, dput(NULL) is
a no-op for a good reason...

* get_next_positive_dentry() switched to the same helper.  Logics:
look for positive child in prev; if not found, look for the
positive child of prev's parent following prev, etc.  That way
we are guaranteed that we are only moving rootwards through the
ancestors of prev, which is pinned and thus not going anywhere.
Since ->d_parent on autofs never changes, the same goes for
the entire chain of ancestors and we don't need overlapping
->d_lock on them.  Which avoids the trylock loops, in addition
to simplifying the logics in there...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/autofs/expire.c