fsx: Add mechanism to replay failed operations
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 11 Jan 2016 03:45:26 +0000 (14:45 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 11 Jan 2016 03:45:26 +0000 (14:45 +1100)
commit2a78c1d1ba2cc1c51898fc83d7f15786667d3aac
tree74dc807e1d9f5b4c58b8542dadc1c5d60a8c0fbd
parented49ff0ebaebf72bcdfef39e90f3f7e0ae1c7c80
fsx: Add mechanism to replay failed operations

Create a $name.fsxops file next to $test.fsxlog.  When a test fails,
dump the operations in the log into that file in a simple, parseable
format like:

  fallocate 0x2e0f2 0xf04a 0x0 keep_size
  truncate 0x0 0x11e00 0x0 *
  write 0x73400 0x6c00 0x11e00
  skip punch_hole 0x71539913 0xdf76 0x7a000 close_open
  mapread 0x56000 0x16d08 0x7a000

Here, each operation is on a separate line. When the first word is
"skip", the operation will be skipped.  The next parameters are offset,
length, and the current file size, followed by optional flags like
keep_size and clode_open.  A trailing asterisk indicates that the
operation overlaps with the operation that has failed.

Add a --replay-ops option that allows to replay the operations recorded
in such a $name.fsxops file.  (The log can be modified to easily narrow
down which operations are causing the failure.)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
ltp/fsx.c