Re: using ioengine=sg

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

 



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

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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