[PATCH, RFC] xfstests: random fallocate calls in fsx

Josef 'Jeff' Sipek jeffpc at josefsipek.net
Wed Jun 3 18:19:39 CDT 2009


Good idea.

On Wed, May 13, 2009 at 04:56:30PM -0500, Eric Sandeen wrote:
> Seems to work for me.  Any comments/suggestions?
> 
> I can probably make it fall back to the xfs ioctl if fallocate
> isn't supported, if strongly desired.

Is the ioctl going away anytime soon? If not, it might be worth having fsx
use _both_ if possible, or just the ioctl if fallocate doesn't seem to be
available.

> @@ -770,6 +788,64 @@ dotruncate(unsigned size)
>  	}
>  }
>  
> +#ifdef FALLOCATE
> +/* fallocate is basically a no-op unless extending, then a lot like a truncate */
> +void
> +dofallocate(unsigned offset, unsigned length)
> +{
> +	unsigned end_offset;
> +	int keep_size;
> +
> +        if (length == 0) {
> +                if (!quiet && testcalls > simulatedopcount)
> +                        prt("skipping zero length fallocate\n");
> +                log4(OP_SKIPPED, OP_FALLOCATE, offset, length);
> +                return;
> +        }
> +
> +	keep_size = random() % 2;
> +
> +	end_offset = keep_size ? 0 : offset + length;

I prefer seeing explicit ( ) in this case.

...
-- 
Reality is merely an illusion, albeit a very persistent one.
		- Albert Einstein




More information about the xfs mailing list