]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 29 Jun 2005 20:17:22 +0000 (20:17 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 29 Jun 2005 20:17:22 +0000 (20:17 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@367 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/client/SyntheticClient.cc

index a98c23b360c8dfff42414daf4ce1bf642aeaa67b..42e9026cd8057e9c24a02332a5a039598804c09d 100644 (file)
@@ -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; i<chunks; i++) {
+       dout(2) << "reading block " << i << "/" << chunks << endl;
+       client->read(fd, buf, rdsize, i*rdsize);
+  }
+  
+  client->close(fd);
+  delete[] buf;
+}
+
 
 
 int SyntheticClient::random_walk(int num_req)