Optimize pattern verify
authorSteven Lang <tirea@google.com>
Tue, 7 Feb 2012 08:42:59 +0000 (09:42 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 7 Feb 2012 08:42:59 +0000 (09:42 +0100)
commit9a2a86d0f6f1425a6da666459ccd379e356a30d0
tree28e919ff6837081ddc1e6a32c4d325dc01f58586
parent3f36aa6b73eb5730d7de716391dcf0735e886d10
Optimize pattern verify

Similar to the patch last week, this optimizes the pattern verify
operation to use optimized library calls like memcmp(), and only fall
back to byte-by-byte if there is a miscompare to locate it.

This uses the same premise that the pattern is repeated as many times
as possible to do large compares in a single call.  For single byte
pattern, the setup fills the pattern space, and verify assumes it is
full.

Tested by running a script which created an 8k file with 4k bs and,
one byte at a time, tried corrupting the pattern and running a read
pass and verified it still found miscompares across the whole range of
the pattern.  This was done with a pattern length of 1 and 3 bytes.

In performance tests, this was about 8 times more efficient on
verifies than without this patch.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
options.c
verify.c