[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 26 Feb 2014 07:31:58 +1100
From: Dave Chinner <david@...morbit.com>
To: Lukas Czerner <lczerner@...hat.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
xfs@....sgi.com
Subject: Re: [PATCH 4/6] xfstests: Add fallocate zero range operation to fsx
On Tue, Feb 25, 2014 at 08:15:26PM +0100, Lukas Czerner wrote:
> Signed-off-by: Lukas Czerner <lczerner@...hat.com>
commit message?
> #define OP_CLOSEOPEN 100
> @@ -142,6 +144,7 @@ int seed = 1; /* -S flag */
> int mapped_writes = 1; /* -W flag disables */
> int fallocate_calls = 1; /* -F flag disables */
> int punch_hole_calls = 1; /* -H flag disables */
> +int zero_range_calls = 1; /* -E flag disables */
'-E' doesn't make much sense - '-z' would be better....
> int mapped_reads = 1; /* -R flag disables it */
> int fsxgoodfd = 0;
> int o_direct; /* -Z */
> @@ -320,6 +323,14 @@ logdump(void)
> lp->args[0] + lp->args[1])
> prt("\t******PPPP");
> break;
> + case OP_ZERO_RANGE:
> + prt("ZERO 0x%x thru 0x%x\t(0x%x bytes)",
> + lp->args[0], lp->args[0] + lp->args[1] - 1,
> + lp->args[1]);
> + if (badoff >= lp->args[0] && badoff <
> + lp->args[0] + lp->args[1])
> + prt("\t******ZZZZ");
> + break;
> case OP_SKIPPED:
> prt("SKIPPED (no operation)");
> break;
> @@ -882,6 +893,64 @@ do_punch_hole(unsigned offset, unsigned length)
> }
> #endif
>
> +#ifdef FALLOC_FL_ZERO_RANGE
> +void
> +do_zero_range(unsigned offset, unsigned length)
> +{
> + unsigned end_offset;
> + int max_offset = 0;
> + int max_len = 0;
> + int mode = FALLOC_FL_ZERO_RANGE;
This is just a copy of the hole punch code with a different mode,
OP and s/punch/zero/g. Please factor.
......
> +void
> +test_zero_range()
> +{
> +#ifdef FALLOC_FL_ZERO_RANGE
> + if (!lite && zero_range_calls) {
> + if (fallocate(fd, FALLOC_FL_ZERO_RANGE,
> + 0, 1) && errno == EOPNOTSUPP) {
> + if(!quiet)
> + warn("main: filesystem does not support fallocate zero range, disabling");
> + zero_range_calls = 0;
> + } else
> + ftruncate(fd, 0);
> + }
> +#else /* ! ZERO RANGE */
> + zero_range_calls = 0;
> +#endif
> +}
Third copy of this test code for fallocate. Please factor.
Cheers,
Dave.
--
Dave Chinner
david@...morbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists