Commit b972cc58 authored by Wang Nan's avatar Wang Nan Committed by Steven Rostedt
Browse files

ftrace: Do not copy old hash when resetting

Do not waste time copying the old hash if the hash is going to be
reset. Just allocate a new hash and free the old one, as that is
the same result as copying te old one and then resetting it.


Signed-off-by: default avatarWang Nan <>
[ SDR: Removed unused ftrace_filter_reset() function ]
Signed-off-by: default avatarSteven Rostedt <>
parent 6508fa76
......@@ -2949,13 +2949,6 @@ ftrace_enabled_open(struct inode *inode, struct file *file)
return iter ? 0 : -ENOMEM;
static void ftrace_filter_reset(struct ftrace_hash *hash)
* ftrace_regex_open - initialize function tracer filter files
* @ops: The ftrace_ops that hold the hash filters
......@@ -3720,14 +3713,16 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len,
orig_hash = &ops->notrace_hash;
hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
if (reset)
hash = alloc_ftrace_hash(FTRACE_HASH_DEFAULT_BITS);
hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, *orig_hash);
if (!hash) {
ret = -ENOMEM;
goto out_regex_unlock;
if (reset)
if (buf && !ftrace_match_records(hash, buf, len)) {
ret = -EINVAL;
goto out_regex_unlock;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment