X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=engines%2Fsg.c;h=bc82b09c5635b487520f70193f9c127355892d24;hp=57c3834add235362acdd18ee672c176456ae9e16;hb=2039ab1d2676015372f17b8ed4ac6bffb10da967;hpb=2084d7b2369254e2026315caea702089198b754b diff --git a/engines/sg.c b/engines/sg.c index 57c3834a..bc82b09c 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; }