From ca4e99b322ae93430cc8da1ded440b6e8670ea7b Mon Sep 17 00:00:00 2001 From: sage Date: Wed, 29 Jun 2005 20:17:22 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@367 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/client/SyntheticClient.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ceph/client/SyntheticClient.cc b/ceph/client/SyntheticClient.cc index a98c23b360c8d..42e9026cd8057 100644 --- a/ceph/client/SyntheticClient.cc +++ b/ceph/client/SyntheticClient.cc @@ -43,6 +43,8 @@ int SyntheticClient::run() break; case SYNCLIENT_MODE_WRITEFILE: write_file(sarg1, iarg1, iarg2); + dout(1) << "finished write, doing read" << endl; + read_file(sarg1, iarg1, iarg2); break; default: assert(0); @@ -189,6 +191,25 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize) // size is i delete[] buf; } +int SyntheticClient::read_file(string& fn, int size, int rdsize) // size is in MB, wrsize in bytes +{ + char *buf = new char[rdsize]; + memset(buf, 1, rdsize); + __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)rdsize; + + int fd = client->open(fn.c_str(), O_RDONLY); + dout(5) << "reading from " << fn << " fd " << fd << endl; + if (fd < 0) return fd; + + for (int i=0; iread(fd, buf, rdsize, i*rdsize); + } + + client->close(fd); + delete[] buf; +} + int SyntheticClient::random_walk(int num_req) -- 2.39.5