Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <jaxboe@fusionio.com>
To: Chuck Tuffli <ctuffli@gmail.com>
Cc: fio@vger.kernel.org
Subject: Re: using ioengine=sg
Date: Fri, 27 Aug 2010 09:03:53 +0200	[thread overview]
Message-ID: <4C776359.70403@fusionio.com> (raw)
In-Reply-To: <AANLkTimTvSmj-1L80KAyVf7uv9d+vDENsMj-_bFDqRBR@mail.gmail.com>

On 2010-08-26 21:25, Chuck Tuffli wrote:
> Hi -
> 
> Reading the man page under ioengine, it mentions that sg will do
> asynchronous IO if the target is the sg character device. So I'm
> assuming that means a job file something like
> 
>> cat sgtest.fio
> [global]
> bs=512b
> readwrite=read
> ioengine=sg
> size=1m
> 
> [/dev/sg2]
> 
> but when I run it,
> 
>> uname -srp
> Linux 2.6.34-12-default x86_64
>> ls -l /dev/sg2
> crw-rw---- 1 root disk 21, 2 Aug 26 17:46 /dev/sg2
>> ./fio --version
> fio 1.43.1
>> sudo ./fio sgtest.fio
> /dev/sg2: (g=0): rw=read, bs=512-512/512-512, ioengine=sg, iodepth=1
> Starting 1 process
> fio: pid=3147, got signal=11
> 
> 
> Run status group 0 (all jobs):
> fio: file hash not empty on exit
> 
> Any idea what I'm doing wrong or might be missing on the system? Thanks!

You are not doing anything wrong, it's a bug. This patch will fix
it.

diff --git a/engines/sg.c b/engines/sg.c
index 57c3834..bc82b09 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -274,17 +274,16 @@ static struct io_u *fio_sgio_event(struct thread_data *td, int event)
 static int fio_sgio_get_bs(struct thread_data *td, unsigned int *bs)
 {
 	struct sgio_data *sd = td->io_ops->data;
-	struct io_u *io_u;
+	struct io_u io_u;
 	struct sg_io_hdr *hdr;
 	unsigned char buf[8];
 	int ret;
 
-	io_u = __get_io_u(td);
-	io_u->file = td->files[0];
-	assert(io_u);
+	memset(&io_u, 0, sizeof(io_u));
+	io_u.file = td->files[0];
 
-	hdr = &io_u->hdr;
-	sgio_hdr_init(sd, hdr, io_u, 0);
+	hdr = &io_u.hdr;
+	sgio_hdr_init(sd, hdr, &io_u, 0);
 	memset(buf, 0, sizeof(buf));
 
 	hdr->cmdp[0] = 0x25;
@@ -292,14 +291,11 @@ static int fio_sgio_get_bs(struct thread_data *td, unsigned int *bs)
 	hdr->dxferp = buf;
 	hdr->dxfer_len = sizeof(buf);
 
-	ret = fio_sgio_doio(td, io_u, 1);
-	if (ret) {
-		put_io_u(td, io_u);
+	ret = fio_sgio_doio(td, &io_u, 1);
+	if (ret)
 		return ret;
-	}
 
 	*bs = (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
-	put_io_u(td, io_u);
 	return 0;
 }
 

-- 
Jens Axboe


  reply	other threads:[~2010-08-27  7:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 19:25 using ioengine=sg Chuck Tuffli
2010-08-27  7:03 ` Jens Axboe [this message]
2010-08-27 15:40   ` Chuck Tuffli
2010-08-27 16:56     ` Jens Axboe
2010-08-27 21:37       ` Chuck Tuffli
2010-08-28  6:53         ` Jens Axboe

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=4C776359.70403@fusionio.com \
    --to=jaxboe@fusionio.com \
    --cc=ctuffli@gmail.com \
    --cc=fio@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox