[PATCH 2/3] xfs_io: implement preadv for vectored reads

Mark Tinguely tinguely at sgi.com
Thu Aug 9 15:08:49 CDT 2012


On 07/25/12 17:30, Dave Chinner wrote:
> From: Dave Chinner<dchinner at redhat.com>
>
> When looking at KVM based direct IO patterns, I noticed that it was
> using preadv and pwritev, and I could not use xfs_io to simulate
> these IO patterns. Extend the pread command to be able to issue
> vectored read IO to enable use to simulate KVM style direct IO.
>
> Also document the new parameters as well as all the missing pread
> command parameters in the xfs_io(8) man page.
>
> Signed-off-by: Dave Chinner<dchinner at redhat.com>
> ---
  +int	vectors;
> +struct iovec *iov;
> +
> +static int
> +alloc_iovec(
> +	size_t		bsize,
> +	int		uflag,
> +	unsigned int	seed)
> +{
> +	int		i;
> +
> +	iov = calloc(vectors, sizeof(struct iovec));
> +	if (!iov)
> +		return -1;
> +
> +	buffersize = 0;
> +	for (i = 0; i<  vectors; i++) {
> +		iov[i].iov_base = memalign(pagesize, bsize);
                 ^^^^^
Okay, make sense.

> +		buffer = memalign(pagesize, bsize);
> +		if (!buffer) {
	        ^^^^^^

Here I am bit confused. Did you want to allocate to the buffer for the 
iovec case?

Thank-you,

Mark.



More information about the xfs mailing list