mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04: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 <[email protected]> Cc: Akinobu Mita <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
a124c28ef8
commit
f1729c28a3
1 changed files with 4 additions and 7 deletions
|
|
@ -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 a new issue