mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
[PATCH] fault-injection: optimize and simplify should_fail()
Trivial optimization and simplification of should_fail(). Do cheaper disqualification tests first (performance gain not quantified). Simplify logic; eliminate goto. Signed-off-by: Don Mullis <dwm@meer.net> Cc: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
a124c28ef8
commit
f1729c28a3
@ -142,9 +142,6 @@ bool should_fail(struct fault_attr *attr, ssize_t size)
|
||||
if (attr->task_filter && !fail_task(attr, current))
|
||||
return false;
|
||||
|
||||
if (!fail_stacktrace(attr))
|
||||
return false;
|
||||
|
||||
if (atomic_read(&attr->times) == 0)
|
||||
return false;
|
||||
|
||||
@ -159,12 +156,12 @@ bool should_fail(struct fault_attr *attr, ssize_t size)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (attr->probability > random32() % 100)
|
||||
goto fail;
|
||||
if (attr->probability <= random32() % 100)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
if (!fail_stacktrace(attr))
|
||||
return false;
|
||||
|
||||
fail:
|
||||
fail_dump(attr);
|
||||
|
||||
if (atomic_read(&attr->times) != -1)
|
||||
|
Loading…
Reference in New Issue
Block a user