From 2039ab1d2676015372f17b8ed4ac6bffb10da967 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 27 Aug 2010 09:04:00 +0200 Subject: [PATCH] Fix bug with probing block size Signed-off-by: Jens Axboe --- engines/sg.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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; } -- 2.25.1