engines: don't use printf or stderr directly
authorJens Axboe <axboe@fb.com>
Mon, 13 Oct 2014 18:18:07 +0000 (12:18 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 13 Oct 2014 18:18:07 +0000 (12:18 -0600)
For networked runs, we can't just print to stdout or stderr.
Use the appropriate logging functions.

Signed-off-by: Jens Axboe <axboe@fb.com>
engines/glusterfs_async.c
engines/libhdfs.c

index 599bc5dfbfc0acc1e3efe72a74d606cdf249e3b8..cf6ea709a733f6b1eef4d52719a302d55aee00cd 100644 (file)
@@ -67,7 +67,7 @@ static void fio_gf_io_u_free(struct thread_data *td, struct io_u *io_u)
                io_u->engine_data = NULL;
                free(io);
        }
-       fprintf(stderr, "issued %lu finished %lu\n", issued, cb_count);
+       log_err("issued %lu finished %lu\n", issued, cb_count);
 }
 
 static int fio_gf_io_u_init(struct thread_data *td, struct io_u *io_u)
@@ -145,8 +145,9 @@ int fio_gf_async_setup(struct thread_data *td)
 {
        int r = 0;
        struct gf_data *g = NULL;
+
 #if defined(NOT_YET)
-       fprintf(stderr, "the async interface is still very experimental...\n");
+       log_err("the async interface is still very experimental...\n");
 #endif
        r = fio_gf_setup(td);
        if (r) {
index 773d46b47bfc28bd6dba373b27fed13a8b7c0324..658cd6aed3ed840d507e5bc42e2ee220623948b9 100644 (file)
@@ -87,7 +87,7 @@ static int fio_hdfsio_prep(struct thread_data *td, struct io_u *io_u)
        } else if (io_u->ddir == DDIR_WRITE) {
                open_flags = O_WRONLY;
        } else {
-               printf("Invalid I/O Operation\n");
+               log_err("hdfs: Invalid I/O Operation\n");
        }
 
        hd->curr_file_id = f_id;
@@ -142,7 +142,7 @@ static int fio_hdfsio_queue(struct thread_data *td, struct io_u *io_u)
                    hdfsWrite(hd->fs, hd->fp, io_u->xfer_buf,
                              io_u->xfer_buflen);
        } else {
-               printf("Invalid I/O Operation\n");
+               log_err("hdfs: Invalid I/O Operation\n");
        }
 
        return fio_io_end(td, io_u, ret);
@@ -202,8 +202,7 @@ static int fio_hdfsio_setup(struct thread_data *td)
                        hd->fscount = atol(getenv("FIO_HDFS_FCOUNT"));
                        hd->fsbs = atol(getenv("FIO_HDFS_BS"));
                } else {
-                       fprintf(stderr,
-                               "FIO_HDFS_FCOUNT and/or FIO_HDFS_BS not set.\n");
+                       log_err("FIO_HDFS_FCOUNT and/or FIO_HDFS_BS not set.\n");
                        return 1;
                }
 #endif