All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Grant Grundler <grundler@chromium.org>
Cc: FIO List <fio@vger.kernel.org>,
	Puthikorn Voravootivat <puthik@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>
Subject: Re: [PATCH] fio: consolidate rand_seed to uint64_t
Date: Tue, 28 Jan 2014 15:17:48 -0700	[thread overview]
Message-ID: <20140128221748.GE25989@kernel.dk> (raw)
In-Reply-To: <CANEJEGurTpsgV5gUv1758dvE7UtP2zqNP6aLe4S69Ezo4i5yVA@mail.gmail.com>

On Tue, Jan 28 2014, Grant Grundler wrote:
> On Tue, Jan 28, 2014 at 2:03 PM, Jens Axboe <axboe@kernel.dk> wrote:
> ...
> >> -       o->rand_seed = le32_to_cpu(top->rand_seed);
> >> +       o->rand_seed = le64_to_cpu(top->rand_seed);
> >>
> >> I saw this when reviewing the code but didn't realize "top" was the
> >> packed version that got changed.
> >
> > Yeah, and vice versa for top -> o.
> 
> Oh! :(
> 
> (And I assume you mean line 288 as shown below)
> 
> If I add this:
> 
> diff --git a/cconv.c b/cconv.c
> index c4941ba..57996fb 100644
> --- a/cconv.c
> +++ b/cconv.c
> @@ -285,7 +285,7 @@ void convert_thread_options_to_net(struct thread_options_pac
>         top->do_disk_util = cpu_to_le32(o->do_disk_util);
>         top->override_sync = cpu_to_le32(o->override_sync);
>         top->rand_repeatable = cpu_to_le32(o->rand_repeatable);
> -       top->rand_seed = cpu_to_le32(o->rand_seed);
> +       top->rand_seed = cpu_to_le64(o->rand_seed);
>         top->use_os_rand = cpu_to_le32(o->use_os_rand);
>         top->log_avg_msec = cpu_to_le32(o->log_avg_msec);
>         top->norandommap = cpu_to_le32(o->norandommap);
> 
> I get this warning:
> 
> grundler <2090>make V=1
> gcc -o cconv.o -std=gnu99 -Wwrite-strings -Wall
> -Wdeclaration-after-statement -O3 -g -ffast-math  -D_GNU_SOURCE
> -include config-host.h -DBITS_PER_LONG=64
> -DFIO_VERSION='"fio-2.1.4-26-g3a2a"' -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG -c cconv.c
> 
>     CC cconv.o
> cconv.c: In function ‘convert_thread_options_to_net’:
> cconv.c:288:19: warning: initialization from incompatible pointer type
> [enabled by default]
>     LINK fio
> 
> grundler <2091>file cconv.o
> cconv.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
> 
> 286         top->override_sync = cpu_to_le32(o->override_sync);
> 287         top->rand_repeatable = cpu_to_le32(o->rand_repeatable);
> 288         top->rand_seed = cpu_to_le64(o->rand_seed);
> 289         top->use_os_rand = cpu_to_le32(o->use_os_rand);
> 290         top->log_avg_msec = cpu_to_le32(o->log_avg_msec);
> 
> Now I'm just confused.

It's because the parser is using non uintxx_t types, so you can't really
please it here. There's __cpu_to_le64() to avoid this crap. But ideally,
the parser just needs changing so that anything that is now unsigned int
is uint32_t and unsigned long long needs to be uint64_t.

If you look at your committed patch, I made those changes for you.

-- 
Jens Axboe


  reply	other threads:[~2014-01-28 22:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28 21:02 [PATCH] fio: consolidate rand_seed to uint64_t Grant Grundler
2014-01-28 21:30 ` Jens Axboe
2014-01-28 21:52   ` Grant Grundler
2014-01-28 22:03     ` Jens Axboe
2014-01-28 22:14       ` Grant Grundler
2014-01-28 22:17         ` Jens Axboe [this message]
2014-01-28 22:23           ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140128221748.GE25989@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=grundler@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=puthik@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.