From 5e81f9c1bf07623daec716dc0607c29e7e76bbab Mon Sep 17 00:00:00 2001 From: Tomohiro Kusumi Date: Mon, 13 Mar 2017 20:14:57 +0200 Subject: [PATCH] Make check_mount_writes() test appropriate device types There are platforms that use chrdev (instead of blkdev) for block devices, thus check_mount_writes() needs to test an appropriate file type(s) for potential mounted devices. fio has had a macro FIO_HAVE_CHARDEV_SIZE basically for those using chrdev for block devices, and this macro can be used here as well. In FreeBSD and several others, blkdev is no longer used as a file type, so it's safe to only test FIO_TYPE_CHAR if FIO_HAVE_CHARDEV_SIZE is defined, but this commit leaves FIO_TYPE_BLOCK test since some platforms may have/use both for block devices (not sure if exist). Signed-off-by: Tomohiro Kusumi Signed-off-by: Jens Axboe --- backend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend.c b/backend.c index 2e8a9946..b61de7c0 100644 --- a/backend.c +++ b/backend.c @@ -2056,8 +2056,16 @@ static bool check_mount_writes(struct thread_data *td) if (!td_write(td) || td->o.allow_mounted_write) return false; + /* + * If FIO_HAVE_CHARDEV_SIZE is defined, it's likely that chrdevs + * are mkfs'd and mounted. + */ for_each_file(td, f, i) { +#ifdef FIO_HAVE_CHARDEV_SIZE + if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) +#else if (f->filetype != FIO_TYPE_BLOCK) +#endif continue; if (device_is_mounted(f->file_name)) goto mounted; -- 2.25.1