projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
27c9aab
)
generate unique pathname for each fio --client log file
author
Ben England
<bengland@redhat.com>
Tue, 6 Sep 2016 16:21:30 +0000
(12:21 -0400)
committer
Ben England
<bengland@redhat.com>
Tue, 6 Sep 2016 16:21:30 +0000
(12:21 -0400)
client.c
patch
|
blob
|
blame
|
history
diff --git
a/client.c
b/client.c
index 3456665009b8fb9fc65ad98c7235431774809820..c29151dfde11583bc9cc9e96c4896e6214153e81 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-1294,6
+1294,7
@@
static int fio_client_handle_iolog(struct fio_client *client,
{
struct cmd_iolog_pdu *pdu;
bool store_direct;
{
struct cmd_iolog_pdu *pdu;
bool store_direct;
+ char * log_pathname;
pdu = convert_iolog(cmd, &store_direct);
if (!pdu) {
pdu = convert_iolog(cmd, &store_direct);
if (!pdu) {
@@
-1301,15
+1302,24
@@
static int fio_client_handle_iolog(struct fio_client *client,
return 1;
}
return 1;
}
+ /* generate a unique pathname for the log file using hostname */
+ log_pathname = malloc(PATH_MAX+10);
+ if (!log_pathname) {
+ log_err("fio: memory allocation of unique pathname failed");
+ return -1;
+ }
+ sprintf(log_pathname, "%s.%s", pdu->name, client->hostname);
+
if (store_direct) {
ssize_t ret;
size_t sz;
int fd;
if (store_direct) {
ssize_t ret;
size_t sz;
int fd;
- fd = open((const char *)
pdu->
name,
+ fd = open((const char *)
log_path
name,
O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- log_err("fio: open log: %s\n", strerror(errno));
+ log_err("fio: open log %s: %s\n",
+ log_pathname, strerror(errno));
return 1;
}
return 1;
}
@@
-1325,10
+1335,10
@@
static int fio_client_handle_iolog(struct fio_client *client,
return 0;
} else {
FILE *f;
return 0;
} else {
FILE *f;
-
- f = fopen((const char *) pdu->name, "w");
+ f = fopen((const char *) log_pathname, "w");
if (!f) {
if (!f) {
- log_err("fio: fopen log: %s\n", strerror(errno));
+ log_err("fio: fopen log %s : %s\n",
+ log_pathname, strerror(errno));
return 1;
}
return 1;
}