xfs
[Top] [All Lists]

Re: [PATCH 1/4] xfstests: fix fsx fpunch test to actually test for fpunc

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 1/4] xfstests: fix fsx fpunch test to actually test for fpunch
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Mon, 27 Jun 2011 15:45:19 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1309153722-1231-2-git-send-email-david@xxxxxxxxxxxxx>
References: <1309153722-1231-1-git-send-email-david@xxxxxxxxxxxxx> <1309153722-1231-2-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11
On 6/27/11 12:48 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> The operation flags parameter to fallocate is the second parameter,
> not the last. Hence the fpunch test is actually testing for falloc
> support, not fpunch. Somebody needs a brown paper bag.
> 
> Also, add a ftruncate call whenthe fpunch succeeds just in case the
> file was not already zero sized. Failing to ensure we start with a
> zero length file can cause read ops to fail size checks if they
> occur before the file is written to be the main test loop.
> 
> While there, observe the quiet flag the same as the falloc test
> does and have them both emit the warning at the same error level.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  ltp/fsx.c |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/ltp/fsx.c b/ltp/fsx.c
> index 0683853..a37e223 100644
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -1243,7 +1243,7 @@ test_fallocate()
>       if (!lite && fallocate_calls) {
>               if (fallocate(fd, 0, 0, 1) && errno == EOPNOTSUPP) {
>                       if(!quiet)
> -                             prt("fsx: main: filesystem does not support 
> fallocate, disabling\n");
> +                             warn("main: filesystem does not support 
> fallocate, disabling\n");
>                       fallocate_calls = 0;
>               } else {
>                       ftruncate(fd, 0);
> @@ -1260,13 +1260,13 @@ test_punch_hole()
>  {
>  #ifdef FALLOC_FL_PUNCH_HOLE
>       if (!lite && punch_hole_calls) {
> -             if (fallocate(fd, 0, 0,
> -                     FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE) &&
> -                     errno == EOPNOTSUPP) {
> -
> -                     warn("main: filesystem does not support fallocate punch 
> hole, disabling");
> +             if (fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
> +                             0, 1) && errno == EOPNOTSUPP) {
> +                     if(!quiet)
> +                             warn("main: filesystem does not support 
> fallocate punch hole, disabling");
>                       punch_hole_calls = 0;
> -             }
> +             } else
> +                     ftruncate(fd, 0);
>       }
>  #else /* ! PUNCH HOLE */
>       punch_hole_calls = 0;

<Prev in Thread] Current Thread [Next in Thread>