Re: [PATCH v2 2/4] fio: enable cross-thread overlap checking with processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/17/18 8:52 AM, vincentfu@xxxxxxxxx wrote:
> -bool io_u_qinit(struct io_u_queue *q, unsigned int nr)
> +bool io_u_qinit(struct io_u_queue *q, unsigned int nr, bool shared)
>  {
> -	q->io_us = calloc(nr, sizeof(struct io_u *));
> +	if (shared) {
> +		q->io_us = smalloc(nr * sizeof(struct io_u *));
> +		memset(q->io_us, 0, nr * sizeof(struct io_u *));
> +	}
> +	else
> +		q->io_us = calloc(nr, sizeof(struct io_u *));
> +

smalloc() returns zeroed memory.

Apart from that, I think this patch looks fine.

-- 
Jens Axboe




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux