Rename FIO_TYPE_BD to FIO_TYPE_BLOCK
authorTomohiro Kusumi <tkusumi@tuxera.com>
Wed, 18 Jan 2017 17:38:23 +0000 (02:38 +0900)
committerJens Axboe <axboe@fb.com>
Thu, 19 Jan 2017 23:09:52 +0000 (16:09 -0700)
Since character device is FIO_TYPE_CHAR, BLOCK (or BLK) makes
better sense for block device.

This may break external ioengines on compile-time, but ioengines
usually don't refer to file type which are regfile/blk/chr/pipe
(which I believe makes sense to commit this change as there's
been changes that break not only api but also abi).

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
backend.c
engines/binject.c
engines/mmap.c
engines/sg.c
file.h
filesetup.c
ioengines.c

index a46101ca5aebc04d51523f3e4eb61c01c907c368..4570d8d5e601a450fb54d757c980edb17009cfd3 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2055,7 +2055,7 @@ static bool check_mount_writes(struct thread_data *td)
                return false;
 
        for_each_file(td, f, i) {
                return false;
 
        for_each_file(td, f, i) {
-               if (f->filetype != FIO_TYPE_BD)
+               if (f->filetype != FIO_TYPE_BLOCK)
                        continue;
                if (device_is_mounted(f->file_name))
                        goto mounted;
                        continue;
                if (device_is_mounted(f->file_name))
                        goto mounted;
index 7d20a3fd7b9ce15d52d86f4b28dc494ba7b24e93..932534a03987eb85fbe1241f35944a4fc287dbed 100644 (file)
@@ -351,7 +351,7 @@ static int fio_binject_open_file(struct thread_data *td, struct fio_file *f)
        if (ret)
                return 1;
 
        if (ret)
                return 1;
 
-       if (f->filetype != FIO_TYPE_BD) {
+       if (f->filetype != FIO_TYPE_BLOCK) {
                log_err("fio: binject only works with block devices\n");
                goto err_close;
        }
                log_err("fio: binject only works with block devices\n");
                goto err_close;
        }
index 99e1d6a4b35861ccb8be485cf4831d36c72ce40a..bc038f4febac88d68167f30e09d212942bbce582 100644 (file)
@@ -67,7 +67,7 @@ static int fio_mmap_file(struct thread_data *td, struct fio_file *f,
        }
 
 #ifdef FIO_MADV_FREE
        }
 
 #ifdef FIO_MADV_FREE
-       if (f->filetype == FIO_TYPE_BD)
+       if (f->filetype == FIO_TYPE_BLOCK)
                (void) posix_madvise(fmd->mmap_ptr, fmd->mmap_sz, FIO_MADV_FREE);
 #endif
 
                (void) posix_madvise(fmd->mmap_ptr, fmd->mmap_sz, FIO_MADV_FREE);
 #endif
 
index 3f7d9110e71fdff6740869f9cd956f020dc72fb2..2148e87c190f8c1dfc4f648aecb99796888ca777 100644 (file)
@@ -252,7 +252,7 @@ static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync)
        struct fio_file *f = io_u->file;
        int ret;
 
        struct fio_file *f = io_u->file;
        int ret;
 
-       if (f->filetype == FIO_TYPE_BD) {
+       if (f->filetype == FIO_TYPE_BLOCK) {
                ret = fio_sgio_ioctl_doio(td, f, io_u);
                td->error = io_u->error;
        } else {
                ret = fio_sgio_ioctl_doio(td, f, io_u);
                td->error = io_u->error;
        } else {
@@ -504,7 +504,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
        unsigned int bs = 0;
        unsigned long long max_lba = 0;
 
        unsigned int bs = 0;
        unsigned long long max_lba = 0;
 
-       if (f->filetype == FIO_TYPE_BD) {
+       if (f->filetype == FIO_TYPE_BLOCK) {
                if (ioctl(f->fd, BLKSSZGET, &bs) < 0) {
                        td_verror(td, errno, "ioctl");
                        return 1;
                if (ioctl(f->fd, BLKSSZGET, &bs) < 0) {
                        td_verror(td, errno, "ioctl");
                        return 1;
@@ -537,7 +537,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
                        MAX_10B_LBA, max_lba);
        }
 
                        MAX_10B_LBA, max_lba);
        }
 
-       if (f->filetype == FIO_TYPE_BD) {
+       if (f->filetype == FIO_TYPE_BLOCK) {
                td->io_ops->getevents = NULL;
                td->io_ops->event = NULL;
        }
                td->io_ops->getevents = NULL;
                td->io_ops->event = NULL;
        }
@@ -789,7 +789,7 @@ static int fio_sgio_get_file_size(struct thread_data *td, struct fio_file *f)
        if (fio_file_size_known(f))
                return 0;
 
        if (fio_file_size_known(f))
                return 0;
 
-       if (f->filetype != FIO_TYPE_BD && f->filetype != FIO_TYPE_CHAR) {
+       if (f->filetype != FIO_TYPE_BLOCK && 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;
                td_verror(td, EINVAL, "wrong file type");
                log_err("ioengine sg only works on block or character devices\n");
                return 1;
diff --git a/file.h b/file.h
index 6f34dd5c3d315608778f638e6be45ef7f4726cd1..ac00ff877997531f2879fcc9e4dbe167f2da7634 100644 (file)
--- a/file.h
+++ b/file.h
@@ -15,7 +15,7 @@
  */
 enum fio_filetype {
        FIO_TYPE_FILE = 1,              /* plain file */
  */
 enum fio_filetype {
        FIO_TYPE_FILE = 1,              /* plain file */
-       FIO_TYPE_BD,                    /* block device */
+       FIO_TYPE_BLOCK,                 /* block device */
        FIO_TYPE_CHAR,                  /* character device */
        FIO_TYPE_PIPE,                  /* pipe */
 };
        FIO_TYPE_CHAR,                  /* character device */
        FIO_TYPE_PIPE,                  /* pipe */
 };
index ef94bd285210d5009e6498d233375317971917ad..eb28826698811058a317fa6544b92bd8f388a368 100644 (file)
@@ -370,7 +370,7 @@ static int get_file_size(struct thread_data *td, struct fio_file *f)
 
        if (f->filetype == FIO_TYPE_FILE)
                ret = file_size(td, f);
 
        if (f->filetype == FIO_TYPE_FILE)
                ret = file_size(td, f);
-       else if (f->filetype == FIO_TYPE_BD)
+       else if (f->filetype == FIO_TYPE_BLOCK)
                ret = bdev_size(td, f);
        else if (f->filetype == FIO_TYPE_CHAR)
                ret = char_size(td, f);
                ret = bdev_size(td, f);
        else if (f->filetype == FIO_TYPE_CHAR)
                ret = char_size(td, f);
@@ -420,7 +420,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
                ret = posix_fadvise(f->fd, off, len, POSIX_FADV_DONTNEED);
                if (ret)
                        errval = ret;
                ret = posix_fadvise(f->fd, off, len, POSIX_FADV_DONTNEED);
                if (ret)
                        errval = ret;
-       } else if (f->filetype == FIO_TYPE_BD) {
+       } else if (f->filetype == FIO_TYPE_BLOCK) {
                int retry_count = 0;
 
                ret = blockdev_invalidate_cache(f);
                int retry_count = 0;
 
                ret = blockdev_invalidate_cache(f);
@@ -709,7 +709,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
                struct stat sb;
                char buf[256];
 
                struct stat sb;
                char buf[256];
 
-               if (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_CHAR) {
+               if (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_CHAR) {
                        if (f->real_file_size != -1ULL)
                                ret += f->real_file_size;
                        continue;
                        if (f->real_file_size != -1ULL)
                                ret += f->real_file_size;
                        continue;
@@ -1228,12 +1228,12 @@ static void get_file_type(struct fio_file *f)
        /* \\.\ is the device namespace in Windows, where every file is
         * a block device */
        if (strncmp(f->file_name, "\\\\.\\", 4) == 0)
        /* \\.\ is the device namespace in Windows, where every file is
         * a block device */
        if (strncmp(f->file_name, "\\\\.\\", 4) == 0)
-               f->filetype = FIO_TYPE_BD;
+               f->filetype = FIO_TYPE_BLOCK;
 #endif
 
        if (!stat(f->file_name, &sb)) {
                if (S_ISBLK(sb.st_mode))
 #endif
 
        if (!stat(f->file_name, &sb)) {
                if (S_ISBLK(sb.st_mode))
-                       f->filetype = FIO_TYPE_BD;
+                       f->filetype = FIO_TYPE_BLOCK;
                else if (S_ISCHR(sb.st_mode))
                        f->filetype = FIO_TYPE_CHAR;
                else if (S_ISFIFO(sb.st_mode))
                else if (S_ISCHR(sb.st_mode))
                        f->filetype = FIO_TYPE_CHAR;
                else if (S_ISFIFO(sb.st_mode))
index a1f8756d086ca5d06c5e1de063ec702f8294a228..315432dae468eeee8469f8944229b9fadaad98f5 100644 (file)
@@ -449,7 +449,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
                goto err;
 
        if (td->o.fadvise_hint != F_ADV_NONE &&
                goto err;
 
        if (td->o.fadvise_hint != F_ADV_NONE &&
-           (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+           (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
                int flags;
 
                if (td->o.fadvise_hint == F_ADV_TYPE) {
                int flags;
 
                if (td->o.fadvise_hint == F_ADV_TYPE) {
@@ -474,7 +474,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
        }
 #ifdef FIO_HAVE_STREAMID
        if (td->o.fadvise_stream &&
        }
 #ifdef FIO_HAVE_STREAMID
        if (td->o.fadvise_stream &&
-           (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+           (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
                off_t stream = td->o.fadvise_stream;
 
                if (posix_fadvise(f->fd, stream, f->io_size, POSIX_FADV_STREAMID) < 0) {
                off_t stream = td->o.fadvise_stream;
 
                if (posix_fadvise(f->fd, stream, f->io_size, POSIX_FADV_STREAMID) < 0) {