Re: about get_rand_file_size()

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Fri, 27 Jul 2007 15:39:50 +0200

On Fri, Jul 27 2007, ljzhang,Yaxin Hu,Jianchao Tang wrote:
> Jens:
> When I was test my previous fix for 'offset', I encounter another
> problem. The files created with a random size by get_rand_file_size()
> doesn't in accordance with option 'filesize'.
> So I wonder if the function should be fixed like this:
> -------------------------------------------
> diff -Nraup fio-7.27/filesetup.c fio-7.27-randsize/filesetup.c
> --- fio-7.27/filesetup.c 2007-07-27 19:25:06.000000000 +0800
> +++ fio-7.27-randsize/filesetup.c 2007-07-27 21:05:51.000000000 +0800
> @@ -104,7 +104,7 @@ static unsigned long long get_rand_file_
> long r;
>
> r = os_random_long(&td->file_size_state);
> - ret = td->o.file_size_low + (unsigned long long) ((double)
> td->o.file_size_high * (r / (RAND_MAX + 1.0)));
> + ret = td->o.file_size_low + (unsigned long long) ((double)
> (td->o.file_size_high - td->o.file_size_low) * (r / (RAND_MAX + 1.0)));
> ret -= (ret % td->o.rw_min_bs);
> return ret;
> }
> -------------------------------------------

Hmm, what does this fix? The options are meant to indicate the smallest
file we will generate (file_size_low), and the largest (file_size_high).

-- 
Jens Axboe
Received on Fri Jul 27 2007 - 15:39:50 CEST

This archive was generated by hypermail 2.2.0 : Fri Jul 27 2007 - 16:00:01 CEST