]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test_filejournal: test lots of small writes too
authorSage Weil <sage.weil@dreamhost.com>
Mon, 23 Jan 2012 20:03:32 +0000 (12:03 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 28 Jan 2012 19:16:52 +0000 (11:16 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/test/test_filejournal.cc

index 222e6de43d75ca2fbe2f7a04209c754c5a334915..c364713894c4c006835af62c56593e0705c17ff3 100644 (file)
@@ -222,3 +222,42 @@ TEST(TestFileJournal, WriteTrim) {
 
   j.close();
 }
+
+TEST(TestFileJournal, WriteTrimSmall) {
+  fsid.generate_random();
+  FileJournal j(fsid, finisher, &sync_cond, path, directio);
+  ASSERT_EQ(0, j.create());
+  j.make_writeable();
+
+  list<C_Sync*> ls;
+  
+  bufferlist bl;
+  char foo[1024*1024];
+  memset(foo, 1, sizeof(foo));
+
+  uint64_t seq = 1, committed = 0;
+
+  for (unsigned i=0; i<size_mb*2; i++) {
+    bl.clear();
+    for (int k=0; k<128; k++)
+      bl.push_back(buffer::copy(foo, sizeof(foo) / 128));
+    bl.zero();
+    ls.push_back(new C_Sync);
+    j.submit_entry(seq++, bl, 0, ls.back()->c);
+
+    while (ls.size() > size_mb/2) {
+      delete ls.front();
+      ls.pop_front();
+      committed++;
+      j.committed_thru(committed);
+    }
+  }
+
+  while (ls.size()) {
+    delete ls.front();
+    ls.pop_front();
+    j.committed_thru(committed);
+  }
+
+  j.close();
+}