]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RadosModel: make object write ranges configurable
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 30 Dec 2011 01:55:45 +0000 (17:55 -0800)
committerJosh Durgin <josh.durgin@dreamhost.com>
Tue, 3 Jan 2012 21:10:37 +0000 (13:10 -0800)
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
src/test/osd/Object.h
src/test/osd/TestReadWrite.cc
src/test/osd/TestSnaps.cc

index 61f2d9998dba271025b6bc5b3ecac5b695a2a43a..d18d6030e6a3783429ceae8a1276c828aa593fe8 100644 (file)
@@ -213,8 +213,8 @@ public:
   uint64_t length;
   uint64_t min_stride_size;
   uint64_t max_stride_size;
-  VarLenGenerator(int length) : 
-    length(length), min_stride_size(length/10), max_stride_size(length/5) {}
+  VarLenGenerator(uint64_t length, uint64_t min_stride_size, uint64_t max_stride_size) :
+    length(length), min_stride_size(min_stride_size), max_stride_size(max_stride_size) {}
 };
 
 class ObjectDesc {
index 1056eb8dfb612bf00e6a0e40b61ef97264b62559..36e38420d6eb418e8033b07e75e7bd6d40ad709d 100644 (file)
@@ -77,7 +77,9 @@ int main(int argc, char **argv)
   int objects = 500;
   int read_percent = 50;
   int max_in_flight = 16;
-  int size = 4000000; // 4 MB
+  uint64_t size = 4000000; // 4 MB
+  uint64_t min_stride_size, max_stride_size;
+
   if (argc > 1) {
     ops = atoi(argv[1]);
   }
@@ -98,16 +100,40 @@ int main(int argc, char **argv)
     size = atoi(argv[5]);
   }
 
+  if (argc > 6) {
+    min_stride_size = atoi(argv[6]);
+  } else {
+    min_stride_size = size / 10;
+  }
+
+  if (argc > 7) {
+    max_stride_size = atoi(argv[7]);
+  } else {
+    max_stride_size = size / 5;
+  }
+
+  if (min_stride_size > max_stride_size) {
+    cerr << "Error: min_stride_size cannot be more than max_stride_size"
+        << std::endl;
+    return 1;
+  }
+
+  if (min_stride_size > size || max_stride_size > size) {
+    cerr << "Error: min_stride_size and max_stride_size must be "
+        << "smaller than object size" << std::endl;
+    return 1;
+  }
+
   if (max_in_flight > objects) {
     cerr << "Error: max_in_flight must be less than the number of objects"
         << std::endl;
-    return 0;
+    return 1;
   }
 
   char *id = getenv("CEPH_CLIENT_ID");
   if (id) cerr << "Client id is: " << id << std::endl;
   string pool_name = "data";
-  VarLenGenerator cont_gen(size);
+  VarLenGenerator cont_gen(size, min_stride_size, max_stride_size);
   RadosTestContext context(pool_name, max_in_flight, cont_gen, id);
 
   ReadWriteGenerator gen = ReadWriteGenerator(ops, objects, read_percent);
index 9aa2b612b16049086a21030b8ed54304864db3d3..0c17ed321814f3e51ed3dcff17df1142989479d3 100644 (file)
@@ -90,7 +90,9 @@ int main(int argc, char **argv)
   int ops = 1000;
   int objects = 50;
   int max_in_flight = 16;
-  int size = 400000;
+  uint64_t size = 4000000; // 4 MB
+  uint64_t min_stride_size, max_stride_size;
+
   if (argc > 1) {
     ops = atoi(argv[1]);
   }
@@ -107,17 +109,41 @@ int main(int argc, char **argv)
     size = atoi(argv[4]);
   }
 
+  if (argc > 5) {
+    min_stride_size = atoi(argv[5]);
+  } else {
+    min_stride_size = size / 10;
+  }
+
+  if (argc > 6) {
+    max_stride_size = atoi(argv[6]);
+  } else {
+    max_stride_size = size / 5;
+  }
+
+  if (min_stride_size > max_stride_size) {
+    cerr << "Error: min_stride_size cannot be more than max_stride_size"
+        << std::endl;
+    return 1;
+  }
+
+  if (min_stride_size > size || max_stride_size > size) {
+    cerr << "Error: min_stride_size and max_stride_size must be "
+        << "smaller than object size" << std::endl;
+    return 1;
+  }
+
   if (max_in_flight > objects) {
     cerr << "Error: max_in_flight must be less than the number of objects"
         << std::endl;
-    return 0;
+    return 1;
   }
 
   char *id = getenv("CEPH_CLIENT_ID");
   if (id) cerr << "Client id is: " << id << std::endl;
                
   string pool_name = "data";
-  VarLenGenerator cont_gen(size);
+  VarLenGenerator cont_gen(size, min_stride_size, max_stride_size);
   RadosTestContext context(pool_name, max_in_flight, cont_gen, id);
 
   TestOpStat stats;