You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fprintf(stderr, "errinj '%s' skipped: probability (%d) is not matched\n",
errinj_name[err->type], err->probability);
continue;
}
constchar*op_name=fuse_op_name[operation];
if (is_regex_matched(err->path_regexp, path) !=0) {
fprintf(stderr, "errinj '%s' skipped: path_regexp (%s) is not matched\n",
errinj_name[err->type], err->path_regexp);
continue;
}
if (is_regex_matched(err->op_regexp, op_name) !=0) {
fprintf(stderr, "errinj '%s' skipped: op_regexp (%s) is not matched\n",
errinj_name[err->type], err->op_regexp);
continue;
}
fprintf(stdout, "%s triggered on operation '%s', %s\n",
errinj_name[err->type], op_name, path);
switch (err->type) {
caseERRINJ_NOOP:
rc=-ERRNO_NOOP;
break;
caseERRINJ_KILL_CALLER: ;
structfuse_context*cxt=fuse_get_context();
if (cxt) {
intret=kill(cxt->pid, DEFAULT_SIGNAL_NAME);
if (ret==-1) {
perror("kill");
}
fprintf(stdout, "send signal %s to TID %d\n",
strsignal(DEFAULT_SIGNAL_NAME), cxt->pid);
}
break;
caseERRINJ_ERRNO:
rc=op_random_errno(operation);
fprintf(stdout, "errno '%s'\n", strerror(rc));
rc=-rc;
break;
caseERRINJ_SLOWDOWN: ;
structtimespects= {};
ts.tv_nsec=err->duration;
fprintf(stdout, "start of '%s' slowdown for '%d' ns\n", op_name, err->duration);
if (nanosleep(&ts, NULL) !=0) {
perror("nanosleep");
} else {
fprintf(stdout, "end of '%s' slowdown with '%d' ns\n", op_name, err->duration);
}
break;
}
}
On each operation, it traverses a list with error injections, and it is not optimal from performance point of view, algorithmic complexity is O(N). It is better to use hashmap. For example, a static hashmap implemented by gperf1.
unreliablefs uses linked list for error injections, see
unreliablefs/unreliablefs_errinj.c
Lines 183 to 235 in c6a6b1e
On each operation, it traverses a list with error injections, and it is not optimal from performance point of view, algorithmic complexity is O(N). It is better to use hashmap. For example, a static hashmap implemented by gperf1.
Footnotes
https://www.gnu.org/software/gperf/manual/gperf.html ↩
The text was updated successfully, but these errors were encountered: