Hi,

btrfs-profiler (https://github.com/adam900710/btrfs-profiler) has added
a new tool: inject.py.

The tool is mostly a blend between bcc/tools/inject.py and Josef's
debug-scripts/inject-error.py:
- Variable length callchain (trigger) support
  This feature is mostly from bcc.
  With this tool, we can inject error for certain call stack.
  E.g. to only trigger error for the following call trace in tree block
       write path:
       -C \
       "btree_submit_bio_hook:btree_csum_one_bio:btrfs_check_leaf_full".

- Any target function support
  This feature is mostly from Josef's script.
  Unlike the limited target from bcc/inject, as long as the target
  function is declared by ALLOW_ERROR_INJECTION(), it can be the target.
  E.g. to inject error for btrfs_check_leaf_full():
       "btrfs_check_leaf_full(struct extent_buffer *eb):-EUCLEAN"

- Extra condition to check before triggering error
  This feature is mostly from bcc.
  And this support custom parameters like above tree-checker parameters.
  This allows us to filter certain calls before triggering error:
  E.g. Don't inject error for __GFP_NOFAIL calls:
       -F "!(gfpflags & __GFP_NOFAIL)"

Some misc features:
- Easier to edit C files
  Unlike bcc tool which generate the C file, making the C code
  fragmented and hard to read, this tool replaces placeholder inside
  a complete C file, thus C part is easier to read.

- Easier to understand parameters
  Good examples (although with poor English) for each option.

Limitation:
- No support for recursive callchain support
  If the target get called recursively, callchain check is unreliable
  and skipped.
  Please use -F for such use case to filter out unwanted calls.

- Callchain sequence check for lower level is unreliable
  Thus "func_a():func_b():func_c()" is the same as
  "func_a():func_c():func_b()".
  Normally two level callchain should be good enough(TM).

Thanks,
Qu

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to