Flexible I/O Tester development
 help / color / mirror / Atom feed
* numerical option parsing broken in engine options
@ 2014-02-25  1:51 Castor Fu
  2014-02-25 17:07 ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Castor Fu @ 2014-02-25  1:51 UTC (permalink / raw)
  To: fio

I was debugging some problems with parsing fio jobs, and found
options.c:fio_get_kb_base is broken for external engines... The
parameter
'data' is either 0, td, or td->eo.  If it's td->eo it's not really
going to work.

The cleaner fix is probably to unwind passing 'data' so far down the
stack, but it
touches a lot of functions, so I thought I'd send this out now.

unsigned int fio_get_kb_base(void *data)
{
        struct thread_options *o = data;
        unsigned int kb_base = 0;

        if (o)
                kb_base = o->kb_base;
        if (!kb_base)
                kb_base = 1024;

        return kb_base;
}


If I replace
   if(o)
by
     if (o && (data - (void *) threads) % sizeof(threads[0]) == 0)

then it behaves as I expect when engine options use the 'k', etc.

    -castor

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-02-25 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25  1:51 numerical option parsing broken in engine options Castor Fu
2014-02-25 17:07 ` Jens Axboe
2014-02-25 17:34   ` Castor Fu
2014-02-25 18:52     ` Jens Axboe
2014-02-25 19:18       ` Jens Axboe
2014-02-25 19:37         ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox