]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
unittest_bluefs: use append(const char*, size_t)
authorSage Weil <sage@redhat.com>
Tue, 27 Sep 2016 19:20:43 +0000 (15:20 -0400)
committerSage Weil <sage@redhat.com>
Sun, 16 Oct 2016 14:32:50 +0000 (10:32 -0400)
The bufferlist one is for internal use only.

Signed-off-by: Sage Weil <sage@redhat.com>
src/test/objectstore/test_bluefs.cc

index 2cad598f654ac93c86322b9aadbe2d4810587ae7..d189eeac712195240e4bb815cd54bb574fa19a78 100644 (file)
@@ -82,13 +82,9 @@ TEST(BlueFS, write_read) {
     BlueFS::FileWriter *h;
     ASSERT_EQ(0, fs.mkdir("dir"));
     ASSERT_EQ(0, fs.open_for_write("dir", "file", &h, false));
-    bufferlist bl;
-    bl.append("foo");
-    h->append(bl);
-    bl.append("bar");
-    h->append(bl);
-    bl.append("baz");
-    h->append(bl);
+    h->append("foo", 3);
+    h->append("bar", 3);
+    h->append("baz", 3);
     fs.fsync(h);
     fs.close_writer(h);
   }
@@ -119,9 +115,7 @@ TEST(BlueFS, small_appends) {
     ASSERT_EQ(0, fs.mkdir("dir"));
     ASSERT_EQ(0, fs.open_for_write("dir", "file", &h, false));
     for (unsigned i = 0; i < 10000; ++i) {
-      bufferlist bl;
-      bl.append("fddjdjdjdjdjdjdjdjdjdjjddjoo");
-      h->append(bl);
+      h->append("abcdeabcdeabcdeabcdeabcdeabc", 23);
     }
     fs.fsync(h);
     fs.close_writer(h);
@@ -130,9 +124,7 @@ TEST(BlueFS, small_appends) {
     BlueFS::FileWriter *h;
     ASSERT_EQ(0, fs.open_for_write("dir", "file_sync", &h, false));
     for (unsigned i = 0; i < 1000; ++i) {
-      bufferlist bl;
-      bl.append("fddjdjdjdjdjdjdjdjdjdjjddjoo");
-      h->append(bl);
+      h->append("abcdeabcdeabcdeabcdeabcdeabc", 23);
       fs.fsync(h);
     }
     fs.close_writer(h);
@@ -164,7 +156,7 @@ void write_data(BlueFS &fs, uint64_t rationed_bytes)
       char *buf = gen_buffer(ALLOC_SIZE);
       bufferptr bp = buffer::claim_char(ALLOC_SIZE, buf);
       bl.push_back(bp);
-      h->append(bl);
+      h->append(bl.c_str(), bl.length());
       r = fs.fsync(h);
       if (r < 0) {
          fs.close_writer(h);
@@ -191,7 +183,7 @@ void create_single_file(BlueFS &fs)
     char *buf = gen_buffer(ALLOC_SIZE);
     bufferptr bp = buffer::claim_char(ALLOC_SIZE, buf);
     bl.push_back(bp);
-    h->append(bl);
+    h->append(bl.c_str(), bl.length());
     fs.fsync(h);
     fs.close_writer(h);
 }
@@ -211,7 +203,7 @@ void write_single_file(BlueFS &fs, uint64_t rationed_bytes)
       char *buf = gen_buffer(ALLOC_SIZE);
       bufferptr bp = buffer::claim_char(ALLOC_SIZE, buf);
       bl.push_back(bp);
-      h->append(bl);
+      h->append(bl.c_str(), bl.length());
       r = fs.fsync(h);
       if (r < 0) {
          fs.close_writer(h);
@@ -380,7 +372,7 @@ TEST(BlueFS, test_simple_compaction_sync) {
           char *buf = gen_buffer(4096);
          bufferptr bp = buffer::claim_char(4096, buf);
          bl.push_back(bp);
-          h->append(bl);
+          h->append(bl.c_str(), bl.length());
           fs.fsync(h);
           fs.close_writer(h);
        }
@@ -433,7 +425,7 @@ TEST(BlueFS, test_simple_compaction_async) {
           char *buf = gen_buffer(4096);
          bufferptr bp = buffer::claim_char(4096, buf);
          bl.push_back(bp);
-          h->append(bl);
+          h->append(bl.c_str(), bl.length());
           fs.fsync(h);
           fs.close_writer(h);
        }