fix net engine client read server write bug
authorYufei Ren <renyufei83@gmail.com>
Mon, 19 Dec 2011 07:56:29 +0000 (08:56 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 19 Dec 2011 07:57:14 +0000 (08:57 +0100)
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.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/net.c
examples/netio

index 3401039aa3480a0642ca86d50cf1002b94763ada..6748a3e2b65a1185c76260d085c64d99bc11e1b9 100644 (file)
@@ -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);
index bd44adbe2c172dc476c72e53322bf823bcb1b99d..3b1a7cd93183c70e5a480d7ed4e6adc7f9970536 100644 (file)
@@ -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