Skip to content

Commit

Permalink
Merge branch 'taras/clientuid' of https://github.com/tarasglek/fio-1
Browse files Browse the repository at this point in the history
* 'taras/clientuid' of https://github.com/tarasglek/fio-1:
  $clientuid keyword to differentiate clients in client/server mode.
  • Loading branch information
axboe committed Feb 10, 2021
2 parents 2ef3c1b + 8d53c5f commit b02c5ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,8 @@ Target file/device

**$jobname**
The name of the worker thread or process.
**$clientuid**
IP of the fio process when using client/server mode.
**$jobnum**
The incremental number of the worker thread or process.
**$filenum**
Expand Down
3 changes: 3 additions & 0 deletions fio.1
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ string:
.B $jobname
The name of the worker thread or process.
.TP
.B $clientuid
IP of the fio process when using client/server mode.
.TP
.B $jobnum
The incremental number of the worker thread or process.
.TP
Expand Down
19 changes: 18 additions & 1 deletion init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,8 @@ enum {
FPRE_NONE = 0,
FPRE_JOBNAME,
FPRE_JOBNUM,
FPRE_FILENUM
FPRE_FILENUM,
FPRE_CLIENTUID
};

static struct fpre_keyword {
Expand All @@ -1249,6 +1250,7 @@ static struct fpre_keyword {
{ .keyword = "$jobname", .key = FPRE_JOBNAME, },
{ .keyword = "$jobnum", .key = FPRE_JOBNUM, },
{ .keyword = "$filenum", .key = FPRE_FILENUM, },
{ .keyword = "$clientuid", .key = FPRE_CLIENTUID, },
{ .keyword = NULL, },
};

Expand Down Expand Up @@ -1338,6 +1340,21 @@ static char *make_filename(char *buf, size_t buf_size,struct thread_options *o,
}
break;
}
case FPRE_CLIENTUID: {
int ret;
ret = snprintf(dst, dst_left, "%s", client_sockaddr_str);
if (ret < 0)
break;
else if (ret > dst_left) {
log_err("fio: truncated filename\n");
dst += dst_left;
dst_left = 0;
} else {
dst += ret;
dst_left -= ret;
}
break;
}
default:
assert(0);
break;
Expand Down

0 comments on commit b02c5ed

Please sign in to comment.