summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-12-28 16:48:05 -0800
committerSage Weil <sage@inktank.com>2013-01-02 13:39:05 -0800
commitc461e7fc1e34fdddd8ff8833693d067451df906b (patch)
tree09838f2956e0143eee0f25e65d27a7272dc9e59a
parentdda7b651895ab392db08e98bf621768fd77540f0 (diff)
downloadceph-c461e7fc1e34fdddd8ff8833693d067451df906b.tar.gz
test_filejournal: test journaling bl with >IOV_MAX segments
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/test/test_filejournal.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/test_filejournal.cc b/src/test/test_filejournal.cc
index c3af26bc3e4..975233fd22a 100644
--- a/src/test/test_filejournal.cc
+++ b/src/test/test_filejournal.cc
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>
#include <stdlib.h>
+#include <limits.h>
#include "common/ceph_argparse.h"
#include "common/common_init.h"
@@ -160,6 +161,43 @@ TEST(TestFileJournal, WriteMany) {
j.close();
}
+TEST(TestFileJournal, WriteManyVecs) {
+ fsid.generate_random();
+ FileJournal j(fsid, finisher, &sync_cond, path, directio, aio);
+ ASSERT_EQ(0, j.create());
+ j.make_writeable();
+
+ C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&lock, &cond, &done));
+
+ bufferlist first;
+ first.append("small");
+ j.submit_entry(1, first, 0, gb.new_sub());
+
+ bufferlist bl;
+ for (int i=0; i<IOV_MAX * 2; i++) {
+ bufferptr bp = buffer::create_page_aligned(4096);
+ memset(bp.c_str(), (char)i, 4096);
+ bl.append(bp);
+ }
+ bufferlist origbl = bl;
+ j.submit_entry(2, bl, 0, gb.new_sub());
+ gb.activate();
+ wait();
+
+ j.close();
+
+ j.open(1);
+ bufferlist inbl;
+ string v;
+ uint64_t seq = 0;
+ ASSERT_EQ(true, j.read_entry(inbl, seq));
+ ASSERT_EQ(seq, 2ull);
+ ASSERT_TRUE(inbl.contents_equal(origbl));
+ j.make_writeable();
+ j.close();
+
+}
+
TEST(TestFileJournal, ReplaySmall) {
fsid.generate_random();
FileJournal j(fsid, finisher, &sync_cond, path, directio, aio);