iscsi-perf: add NOPs to the perf stream and account for timeouts
Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "iscsi.h"
|
#include "iscsi.h"
|
||||||
#include "scsi-lowlevel.h"
|
#include "scsi-lowlevel.h"
|
||||||
|
|
||||||
@@ -33,7 +34,11 @@
|
|||||||
|
|
||||||
#define VERSION "0.1"
|
#define VERSION "0.1"
|
||||||
|
|
||||||
|
#define NOP_INTERVAL 5
|
||||||
|
#define MAX_NOP_FAILURES 3
|
||||||
|
|
||||||
const char *initiator = "iqn.2010-11.libiscsi:iscsi-perf";
|
const char *initiator = "iqn.2010-11.libiscsi:iscsi-perf";
|
||||||
|
int proc_alarm = 0;
|
||||||
int max_in_flight = 32;
|
int max_in_flight = 32;
|
||||||
int blocks_per_io = 8;
|
int blocks_per_io = 8;
|
||||||
uint64_t runtime = 0;
|
uint64_t runtime = 0;
|
||||||
@@ -202,8 +207,17 @@ void usage(void) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sig_handler (int signum _U_) {
|
void sig_handler (int signum ) {
|
||||||
finished = 1;
|
if (signum == SIGALRM) {
|
||||||
|
if (proc_alarm) {
|
||||||
|
fprintf(stderr, "\n\nABORT: Last alarm was not processed.\n");
|
||||||
|
exit(10);
|
||||||
|
}
|
||||||
|
proc_alarm = 1;
|
||||||
|
alarm(NOP_INTERVAL);
|
||||||
|
} else {
|
||||||
|
finished = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -340,6 +354,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sigaction(SIGTERM, &sa, NULL);
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
|
sigaction(SIGALRM, &sa, NULL);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
@@ -347,10 +362,21 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fill_read_queue(&client);
|
fill_read_queue(&client);
|
||||||
|
|
||||||
|
alarm(NOP_INTERVAL);
|
||||||
|
|
||||||
while (client.in_flight && !client.err_cnt) {
|
while (client.in_flight && !client.err_cnt) {
|
||||||
pfd[0].fd = iscsi_get_fd(client.iscsi);
|
pfd[0].fd = iscsi_get_fd(client.iscsi);
|
||||||
pfd[0].events = iscsi_which_events(client.iscsi);
|
pfd[0].events = iscsi_which_events(client.iscsi);
|
||||||
|
|
||||||
|
if (proc_alarm) {
|
||||||
|
if (iscsi_get_nops_in_flight(client.iscsi) > MAX_NOP_FAILURES) {
|
||||||
|
fprintf(stderr, "\n\nABORT: NOP timeout.\n");
|
||||||
|
exit(10);
|
||||||
|
}
|
||||||
|
iscsi_nop_out_async(client.iscsi, NULL, NULL, 0, NULL);
|
||||||
|
proc_alarm = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (poll(&pfd[0], 1, -1) < 0) {
|
if (poll(&pfd[0], 1, -1) < 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -360,6 +386,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
progress(&client);
|
progress(&client);
|
||||||
|
|
||||||
if (!client.err_cnt) {
|
if (!client.err_cnt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user