]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client/SyntheticClient.cc: remove unused code
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 3 Feb 2016 12:46:33 +0000 (13:46 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 19 Feb 2016 11:50:35 +0000 (12:50 +0100)
Removed since 2007 unused code and fixed indentation.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/client/SyntheticClient.cc

index 8a84a48b602b0903ce5c5778ea7a271f1eb3b5c4..fe06d22649523836d08930316e8b84991dba811c 100644 (file)
@@ -2401,13 +2401,8 @@ int SyntheticClient::object_rw(int nobj, int osize, int wrpc,
 int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is in MB, wrsize in bytes
 {
   uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)rdsize;
-
   int fd = client->open(fn.c_str(), O_RDWR);
   dout(5) << "reading from " << fn << " fd " << fd << dendl;
-   
- // dout(0) << "READING FROM  " << fn << " fd " << fd << dendl;
-
- // dout(0) << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  dendl;
 
   if (fd < 0) return fd;
   int offset = 0;
@@ -2425,97 +2420,71 @@ int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is
     // use rand instead ??
     double x = drand48();
 
-    //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
-
     // cleanup before call 'new'
     if (buf != NULL) {
        delete[] buf;
        buf = NULL;
     }
-    if ( x < 0.5) 
-    {
-        //dout(0) << "DECIDED TO READ " << x << dendl;
+    if (x < 0.5) {
         buf = new char[rdsize]; 
         memset(buf, 1, rdsize);
         read=true;
-    }
-    else
-    {
-       // dout(0) << "DECIDED TO WRITE " << x << dendl;
+    } else {
         buf = new char[rdsize+100];   // 1 MB
         memset(buf, 7, rdsize);
     }
-
-    //double  y  = drand48() ;
-
-    //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<<  dendl;
     
-    if ( read)
-    {
+    if (read) {
         offset=(rand())%(chunks+1);
         dout(2) << "reading block " << offset << "/" << chunks << dendl;
 
-        int r = client->read(fd, buf, rdsize,
-                        offset*rdsize);
+        int r = client->read(fd, buf, rdsize, offset*rdsize);
         if (r < rdsize) {
-                  dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
-    }
-    }
-    else
-    {
-        dout(2) << "writing block " << offset << "/" << chunks << dendl;
-
-    // fill buf with a 16 byte fingerprint
-    // 64 bits : file offset
-    // 64 bits : client id
-    // = 128 bits (16 bytes)
-
-      //if (true )
-      //{
-      //int count = rand()%10;
+         dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
+       }
+    } else {
+      dout(2) << "writing block " << offset << "/" << chunks << dendl;
 
-      //for ( int j=0;j<count; j++ )
-      //{
+      // fill buf with a 16 byte fingerprint
+      // 64 bits : file offset
+      // 64 bits : client id
+      // = 128 bits (16 bytes)
 
       offset=(rand())%(chunks+1);
-    uint64_t *p = (uint64_t*)buf;
-    while ((char*)p < buf + rdsize) {
-      *p = offset*rdsize + (char*)p - buf;      
-      p++;
-      *p = client->get_nodeid().v;
-      p++;
-    }
+      uint64_t *p = (uint64_t*)buf;
+      while ((char*)p < buf + rdsize) {
+       *p = offset*rdsize + (char*)p - buf;      
+       p++;
+       *p = client->get_nodeid().v;
+       p++;
+      }
 
       client->write(fd, buf, rdsize,
                         offset*rdsize);
-      //}
-      //}
     }
 
     // verify fingerprint
-    if ( read )
-    {
-    int bad = 0;
-    int64_t *p = (int64_t*)buf;
-    int64_t readoff, readclient;
-    while ((char*)p + 32 < buf + rdsize) {
-      readoff = *p;
-      int64_t wantoff = offset*rdsize + (int64_t)((char*)p - buf);
-      p++;
-      readclient = *p;
-      p++;
-      if (readoff != wantoff ||
-         readclient != client->get_nodeid()) {
-        if (!bad)
-          dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
-                 << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
-                 << dendl;
-        bad++;
+    if (read) {
+      int bad = 0;
+      int64_t *p = (int64_t*)buf;
+      int64_t readoff, readclient;
+      while ((char*)p + 32 < buf + rdsize) {
+       readoff = *p;
+       int64_t wantoff = offset*rdsize + (int64_t)((char*)p - buf);
+       p++;
+       readclient = *p;
+       p++;
+       if (readoff != wantoff || readclient != client->get_nodeid()) {
+         if (!bad)
+           dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
+                   << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
+                   << dendl;
+         bad++;
+       }
       }
+      if (bad) 
+       dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
     }
-    if (bad) 
-      dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
-  }
   }
   
   client->close(fd);
@@ -2524,19 +2493,6 @@ int SyntheticClient::read_random(string& fn, int size, int rdsize)   // size is
   return 0;
 }
 
-
-//#include<stdio.h>
-//#include<stdlib.h>
-
-int normdist(int min, int max, int stdev) /* specifies input values */;
-//main()
-//{
- // for ( int i=0; i < 10; i++ )
- //  normdist ( 0 , 10, 1 );
-   
-//}
-
-
 int normdist(int min, int max, int stdev) /* specifies input values */
 {
   /* min: Minimum value; max: Maximum value; stdev: degree of deviation */
@@ -2574,14 +2530,9 @@ int normdist(int min, int max, int stdev) /* specifies input values */
 int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size is in MB, wrsize in bytes
 {
   uint64_t chunks = (uint64_t)size * (uint64_t)(1024*1024) / (uint64_t)rdsize;
-  
   int fd = client->open(fn.c_str(), O_RDWR);
   dout(5) << "reading from " << fn << " fd " << fd << dendl;
   
-  // dout(0) << "READING FROM  " << fn << " fd " << fd << dendl;
-  
-  // dout(0) << "filename " << fn << " size:" << size  << " read size|" << rdsize << "|" <<  "\ chunks: |" << chunks <<"|" <<  dendl;
-  
   if (fd < 0) return fd;
   int offset = 0;
   char * buf = NULL;
@@ -2598,53 +2549,29 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
     // use rand instead ??
     double x = drand48();
     
-    //dout(0) << "RANDOM NUMBER RETURN |" << x << "|" << dendl;
-    
     // cleanup before call 'new'
     if (buf != NULL) {
-       delete[] buf;
-       buf = NULL;
+      delete[] buf;
+      buf = NULL;
+    }
+    if (x < 0.5) {
+      buf = new char[rdsize]; 
+      memset(buf, 1, rdsize);
+      read=true;
+    } else {
+      buf = new char[rdsize+100];   // 1 MB
+      memset(buf, 7, rdsize);
     }
-    if ( x < 0.5) 
-      {
-        //dout(0) << "DECIDED TO READ " << x << dendl;
-        buf = new char[rdsize]; 
-        memset(buf, 1, rdsize);
-        read=true;
-      }
-    else
-      {
-       // dout(0) << "DECIDED TO WRITE " << x << dendl;
-        buf = new char[rdsize+100];   // 1 MB
-        memset(buf, 7, rdsize);
-      }
-    
-    //double  y  = drand48() ;
-    
-    //dout(0) << "OFFSET is |" << offset << "| chunks |" << chunks<<  dendl;
     
-    if ( read)
-      {
-        //offset=(rand())%(chunks+1);
+    if (read) {
+      dout(2) << "reading block " << offset << "/" << chunks << dendl;
        
-       /*    if ( chunks > 10000 ) 
-             offset= normdist( 0 , chunks/1000 , 5  )*1000;
-             else if ( chunks > 1000 )
-             offset= normdist( 0 , chunks/100 , 5  )*100;
-             else if ( chunks > 100 )
-             offset= normdist( 0 , chunks/20 , 5  )*20;*/
-       
-       
-        dout(2) << "reading block " << offset << "/" << chunks << dendl;
-       
-        int r = client->read(fd, buf, rdsize,
+      int r = client->read(fd, buf, rdsize,
                             offset*rdsize);
-        if (r < rdsize) {
-         dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
-       }
+      if (r < rdsize) {
+       dout(1) << "read_file got r = " << r << ", probably end of file" << dendl;
       }
-    else
-      {
+    } else {
         dout(2) << "writing block " << offset << "/" << chunks << dendl;
        
        // fill buf with a 16 byte fingerprint
@@ -2652,52 +2579,44 @@ int SyntheticClient::read_random_ex(string& fn, int size, int rdsize)   // size
        // 64 bits : client id
        // = 128 bits (16 bytes)
        
-       //if (true )
-       //{
        int count = rand()%10;
        
-       for ( int j=0;j<count; j++ )
-         {
-           
-           offset=(rand())%(chunks+1);
-           uint64_t *p = (uint64_t*)buf;
-           while ((char*)p < buf + rdsize) {
-             *p = offset*rdsize + (char*)p - buf;      
-             p++;
-             *p = client->get_nodeid().v;
-             p++;
-           }
-           
-           client->write(fd, buf, rdsize,
-                         offset*rdsize);
+       for ( int j=0;j<count; j++ ) {
+         offset=(rand())%(chunks+1);
+         uint64_t *p = (uint64_t*)buf;
+         while ((char*)p < buf + rdsize) {
+           *p = offset*rdsize + (char*)p - buf;      
+           p++;
+           *p = client->get_nodeid().v;
+           p++;
          }
-       //}
-      }
+           
+         client->write(fd, buf, rdsize, offset*rdsize);
+       }
+    }
     
     // verify fingerprint
-    if ( read )
-      {
-       int bad = 0;
-       int64_t *p = (int64_t*)buf;
-       int64_t readoff, readclient;
-       while ((char*)p + 32 < buf + rdsize) {
-         readoff = *p;
-         int64_t wantoff = offset*rdsize + (int64_t)((char*)p - buf);
-         p++;
-         readclient = *p;
-         p++;
-         if (readoff != wantoff ||
-             readclient != client->get_nodeid()) {
-           if (!bad)
-             dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
-                     << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
-                     << dendl;
-           bad++;
-         }
+    if (read) {
+      int bad = 0;
+      int64_t *p = (int64_t*)buf;
+      int64_t readoff, readclient;
+      while ((char*)p + 32 < buf + rdsize) {
+       readoff = *p;
+       int64_t wantoff = offset*rdsize + (int64_t)((char*)p - buf);
+       p++;
+       readclient = *p;
+       p++;
+       if (readoff != wantoff || readclient != client->get_nodeid()) { 
+         if (!bad)
+           dout(0) << "WARNING: wrong data from OSD, block says fileoffset=" << readoff << " client=" << readclient
+                   << ", should be offset " << wantoff << " clietn " << client->get_nodeid()
+                   << dendl;
+         bad++;
        }
-       if (bad) 
-         dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
       }
+      if (bad) 
+       dout(0) << " + " << (bad-1) << " other bad 16-byte bits in this block" << dendl;
+    }
   }
   
   client->close(fd);