Mention sg ioengine requires filename option
authorTomohiro Kusumi <tkusumi@tuxera.com>
Mon, 9 Jan 2017 14:42:02 +0000 (23:42 +0900)
committerJens Axboe <axboe@fb.com>
Mon, 9 Jan 2017 15:39:20 +0000 (08:39 -0700)
similar to the way net ioengine documents filename option.

Also bring in a file type check from fio_sgio_type_check()
to avoid pointless read capacity error against regfiles.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
HOWTO
engines/sg.c

diff --git a/HOWTO b/HOWTO
index 4cc733f60e01c728ecbc3d64b7b32114d060d8fd..33f8718a94d0352f995827f63ed3384f83d9cd63 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -819,7 +819,8 @@ ioengine=str        Defines how the job issues io to the file. The following
                                synchronous using the SG_IO ioctl, or if
                                the target is an sg character device
                                we use read(2) and write(2) for asynchronous
-                               io.
+                               io. Requires filename option to specify either
+                               block or character devices.
 
                        null    Doesn't transfer any data, just pretends
                                to. This is mainly used to exercise fio
index e70803c8445f2892985ea85e7d77b6a192acb392..3f7d9110e71fdff6740869f9cd956f020dc72fb2 100644 (file)
@@ -525,7 +525,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
                }
        } else {
                td_verror(td, EINVAL, "wrong file type");
-               log_err("ioengine sg only works on block devices\n");
+               log_err("ioengine sg only works on block or character devices\n");
                return 1;
        }
 
@@ -789,6 +789,12 @@ static int fio_sgio_get_file_size(struct thread_data *td, struct fio_file *f)
        if (fio_file_size_known(f))
                return 0;
 
+       if (f->filetype != FIO_TYPE_BD && f->filetype != FIO_TYPE_CHAR) {
+               td_verror(td, EINVAL, "wrong file type");
+               log_err("ioengine sg only works on block or character devices\n");
+               return 1;
+       }
+
        ret = fio_sgio_read_capacity(td, &bs, &max_lba);
        if (ret ) {
                td_verror(td, td->error, "fio_sgio_read_capacity");