From 7172cfe8e0e918cc279eb501986f6ec78cc7aad9 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 23 Jul 2007 14:36:00 +0200 Subject: [PATCH] Only do the root warning once per thread Signed-off-by: Jens Axboe --- filesetup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/filesetup.c b/filesetup.c index 7a9a2afe..b742f825 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 @@ int file_invalidate_cache(struct thread_data *td, struct fio_file *f) 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) -- 2.25.1