Flexible I/O Tester development
 help / color / mirror / Atom feed
* [PATCH] fix net engine client read server write bug
@ 2011-12-16 20:40 Yufei Ren
  2011-12-19  7:56 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Yufei Ren @ 2011-12-16 20:40 UTC (permalink / raw)
  To: fio; +Cc: Yufei Ren(Y!)

The net engine was updated with specific 'listen' parameter which used
for identifying whether it is a tcp server, instead of previous
'rw=read' side must be the server. This let fio support bi-direction
net io test. fio_netio_open_file() has to follow this
principle. Otherwise, the following tcp client 'rw=read' and tcp
server 'rw=write' case doesn't work.

[global]
ioengine=net
port=8888
protocol=tcp
bs=4k
size=10g

[server]
listen
rw=write

[client]
hostname=localhost
startdelay=1
rw=read

BTW, examples/netio needs 'listen' and 'hostname' adjusted.

---
 engines/net.c  |    3 ++-
 examples/netio |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/engines/net.c b/engines/net.c
index 3401039..6748a3e 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -496,8 +496,9 @@ static int fio_netio_accept(struct thread_data
*td, struct fio_file *f)
 static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)
 {
 	int ret;
+	struct netio_options *o = td->eo;

-	if (td_read(td))
+	if (o->listen)
 		ret = fio_netio_accept(td, f);
 	else
 		ret = fio_netio_connect(td, f);
diff --git a/examples/netio b/examples/netio
index bd44adb..3b1a7cd 100644
--- a/examples/netio
+++ b/examples/netio
@@ -2,7 +2,6 @@
 [global]
 ioengine=net
 #Use hostname=/tmp.fio.sock for local unix domain sockets
-hostname=localhost
 port=8888
 #Use =udp for UDP, =unix for local unix domain socket
 protocol=tcp
@@ -12,8 +11,10 @@ size=10g
 #verify=md5

 [receiver]
+listen
 rw=read

 [sender]
+hostname=localhost
 startdelay=1
 rw=write
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-19  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 20:40 [PATCH] fix net engine client read server write bug Yufei Ren
2011-12-19  7:56 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox