Fix bug with probing block size
[fio.git] / engines / sg.c
index 57c3834add235362acdd18ee672c176456ae9e16..bc82b09c5635b487520f70193f9c127355892d24 100644 (file)
@@ -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;
 }