untangling ep_call_nested(): get rid of useless arguments

ctx is always equal to current, ncalls - to &poll_loop_ncalls.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2020-08-22 22:05:06 -04:00
parent 364f374f22
commit 8677600d79
1 changed files with 12 additions and 19 deletions

View File

@ -455,21 +455,19 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
* the same nested call (by the meaning of same cookie) is * the same nested call (by the meaning of same cookie) is
* no re-entered. * no re-entered.
* *
* @ncalls: Pointer to the nested_calls structure to be used for this call.
* @nproc: Nested call core function pointer. * @nproc: Nested call core function pointer.
* @priv: Opaque data to be passed to the @nproc callback. * @priv: Opaque data to be passed to the @nproc callback.
* @cookie: Cookie to be used to identify this nested call. * @cookie: Cookie to be used to identify this nested call.
* @ctx: This instance context.
* *
* Returns: Returns the code returned by the @nproc callback, or -1 if * Returns: Returns the code returned by the @nproc callback, or -1 if
* the maximum recursion limit has been exceeded. * the maximum recursion limit has been exceeded.
*/ */
static int ep_call_nested(struct nested_calls *ncalls, static int ep_call_nested(int (*nproc)(void *, void *, int), void *priv,
int (*nproc)(void *, void *, int), void *priv, void *cookie)
void *cookie, void *ctx)
{ {
int error, call_nests = 0; int error, call_nests = 0;
unsigned long flags; unsigned long flags;
struct nested_calls *ncalls = &poll_loop_ncalls;
struct list_head *lsthead = &ncalls->tasks_call_list; struct list_head *lsthead = &ncalls->tasks_call_list;
struct nested_call_node *tncur; struct nested_call_node *tncur;
struct nested_call_node tnode; struct nested_call_node tnode;
@ -482,7 +480,7 @@ static int ep_call_nested(struct nested_calls *ncalls,
* very much limited. * very much limited.
*/ */
list_for_each_entry(tncur, lsthead, llink) { list_for_each_entry(tncur, lsthead, llink) {
if (tncur->ctx == ctx && if (tncur->ctx == current &&
(tncur->cookie == cookie || ++call_nests > EP_MAX_NESTS)) { (tncur->cookie == cookie || ++call_nests > EP_MAX_NESTS)) {
/* /*
* Ops ... loop detected or maximum nest level reached. * Ops ... loop detected or maximum nest level reached.
@ -494,7 +492,7 @@ static int ep_call_nested(struct nested_calls *ncalls,
} }
/* Add the current task and cookie to the list */ /* Add the current task and cookie to the list */
tnode.ctx = ctx; tnode.ctx = current;
tnode.cookie = cookie; tnode.cookie = cookie;
list_add(&tnode.llink, lsthead); list_add(&tnode.llink, lsthead);
@ -1397,10 +1395,8 @@ static int reverse_path_check_proc(void *priv, void *cookie, int call_nests)
break; break;
} }
} else { } else {
error = ep_call_nested(&poll_loop_ncalls, error = ep_call_nested(reverse_path_check_proc,
reverse_path_check_proc, child_file, child_file);
child_file, child_file,
current);
} }
if (error != 0) if (error != 0)
break; break;
@ -1431,9 +1427,8 @@ static int reverse_path_check(void)
/* let's call this for all tfiles */ /* let's call this for all tfiles */
list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) { list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) {
path_count_init(); path_count_init();
error = ep_call_nested(&poll_loop_ncalls, error = ep_call_nested(reverse_path_check_proc, current_file,
reverse_path_check_proc, current_file, current_file);
current_file, current);
if (error) if (error)
break; break;
} }
@ -1970,9 +1965,8 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
ep_tovisit = epi->ffd.file->private_data; ep_tovisit = epi->ffd.file->private_data;
if (ep_tovisit->gen == loop_check_gen) if (ep_tovisit->gen == loop_check_gen)
continue; continue;
error = ep_call_nested(&poll_loop_ncalls, error = ep_call_nested(ep_loop_check_proc, epi->ffd.file,
ep_loop_check_proc, epi->ffd.file, ep_tovisit);
ep_tovisit, current);
if (error != 0) if (error != 0)
break; break;
} else { } else {
@ -2009,8 +2003,7 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
*/ */
static int ep_loop_check(struct eventpoll *ep, struct file *file) static int ep_loop_check(struct eventpoll *ep, struct file *file)
{ {
return ep_call_nested(&poll_loop_ncalls, return ep_call_nested(ep_loop_check_proc, file, ep);
ep_loop_check_proc, file, ep, current);
} }
static void clear_tfile_check_list(void) static void clear_tfile_check_list(void)