xfstests: fsx fallocate support is b0rked
authorDave Chinner <dchinner@redhat.com>
Thu, 14 Jul 2011 05:27:01 +0000 (15:27 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 14 Jul 2011 05:27:01 +0000 (15:27 +1000)
commit5843147ef12b7f65d5c86c69b53534218c9460c8
tree4336c73b06763432455236b7d4d6f618693242e4
parentc18bf42de9d5d5fa05025754df1ff63f2147bd12
xfstests: fsx fallocate support is b0rked

The recent fallocate/fpunch additions to fsx have not actually be
executing fallocate/fpunch operations. The logic to select what
operation to run is broken in such a way that fsx has been executing
mapped writes and truncates instead of fallocate and fpunch
operations.

Remove all the (b0rken) smarty-pants selection logic from the test()
function. Replace it with a clearly defined set of operations for
each mode and use understandable fallback logic when various
operation types have been disabled. Then use a simple switch
statement to execute each of the different operations, removing the
tortured nesting of if/else statements that only serve to obfuscate
the code.

As a result, fsx uses fallocate/fpunch appropriately during
operations and uses/disableŃ• the operations as defined on the
command line correctly.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
ltp/fsx.c