Only do the root warning once per thread
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/filesetup.c b/filesetup.c
index 7a9a2af..b742f82 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -9,6 +9,8 @@
#include "fio.h"
+static int root_warn;
+
static int extend_file(struct thread_data *td, struct fio_file *f)
{
int r, new_layout = 0, unlink_file = 0, flags;
@@ -178,7 +180,10 @@
else if (f->filetype == FIO_TYPE_BD) {
ret = blockdev_invalidate_cache(f->fd);
if (ret < 0 && errno == EACCES && geteuid()) {
- log_err("fio: only root may flush block devices. Cache flush bypassed!\n");
+ if (!root_warn) {
+ log_err("fio: only root may flush block devices. Cache flush bypassed!\n");
+ root_warn = 1;
+ }
ret = 0;
}
} else if (f->filetype == FIO_TYPE_CHAR || f->filetype == FIO_TYPE_PIPE)