]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/bl, os/bluestore: drop flush() from page_aligned_appender.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 19 Aug 2020 14:44:43 +0000 (16:44 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Fri, 21 Aug 2020 16:55:59 +0000 (18:55 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/include/buffer.h
src/os/bluestore/BlueFS.cc
src/os/bluestore/BlueFS.h
src/test/bufferlist.cc

index 93ef1b57f8742035f49368e480b464e91e8f79bb..5b6a45214967e8afcd4e64fc73c3b5aa0e760f8b 100644 (file)
@@ -872,14 +872,6 @@ struct error_code;
       friend class list;
 
     public:
-      ~page_aligned_appender() {
-       flush();
-      }
-
-      void flush() {
-       // nop
-      }
-
       void append(const bufferlist& l) {
        bl.append(l);
        bl.obtain_contiguous_space(0);
index eea2e1ac5823505993425d06420f1affbd1d8223..9e16ffdb8ea9ac7762fae622474cc215a38222ad 100644 (file)
@@ -2772,7 +2772,6 @@ ceph::bufferlist BlueFS::FileWriter::flush_buffer(
     // preserve in-memory contiguity and not mess with the alignment.
     // Otherwise a costly rebuild could happen in e.g. `KernelDevice`.
     buffer_appender.append_zero(padding_len);
-    buffer_appender.flush();
     buffer.splice(buffer.length() - padding_len, padding_len, &bl);
     // Deep copy the tail here. This allows to avoid costlier copy on
     // bufferlist rebuild in e.g. `KernelDevice` and minimizes number
@@ -2781,7 +2780,6 @@ ceph::bufferlist BlueFS::FileWriter::flush_buffer(
     // padding on a dedicated, 4 KB long memory chunk. This shouldn't
     // trigger the rebuild while still being less expensive.
     buffer_appender.substr_of(bl, bl.length() - padding_len - tail, tail);
-    buffer_appender.flush();
     buffer.splice(buffer.length() - tail, tail, &tail_block);
   } else {
     tail_block.clear();
@@ -2797,8 +2795,6 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length)
   ceph_assert(!h->file->deleted);
   ceph_assert(h->file->num_readers.load() == 0);
 
-  h->buffer_appender.flush();
-
   bool buffered;
   if (h->file->fnode.ino == 1)
     buffered = false;
@@ -2991,7 +2987,6 @@ int BlueFS::_flush(FileWriter *h, bool force, std::unique_lock<ceph::mutex>& l)
 
 int BlueFS::_flush(FileWriter *h, bool force, bool *flushed)
 {
-  h->buffer_appender.flush();
   uint64_t length = h->get_buffer_length();
   uint64_t offset = h->pos;
   if (flushed) {
@@ -3032,8 +3027,6 @@ int BlueFS::_truncate(FileWriter *h, uint64_t offset)
   // we never truncate internal log files
   ceph_assert(h->file->fnode.ino > 1);
 
-  h->buffer_appender.flush();
-
   // truncate off unflushed data?
   if (h->pos < offset &&
       h->pos + h->get_buffer_length() > offset) {
index 3d95d69fdea47cc9cb4d7fe0455f5fb63d90577c..3ed3f359233b33fe729621faaa6c63f0052957bb 100644 (file)
@@ -202,7 +202,6 @@ public:
     }
 
     uint64_t get_effective_write_pos() {
-      buffer_appender.flush();
       return pos + buffer.length();
     }
   };
@@ -557,7 +556,6 @@ public:
     ceph_assert(r == 0);
   }
   void try_flush(FileWriter *h) {
-    h->buffer_appender.flush();
     if (h->get_buffer_length() >= cct->_conf->bluefs_min_flush_size) {
       flush(h, true);
     }
index c7dfc80c6e38fc352378798f4e144f219b84b29f..37bacee1c61e53293e309ac26c65f167b79e8aa0 100644 (file)
@@ -1609,7 +1609,6 @@ TEST(BufferList, page_aligned_appender) {
   {
     auto a = bl.get_page_aligned_appender(5);
     a.append("asdf", 4);
-    a.flush();
     cout << bl << std::endl;
     ASSERT_EQ(1u, bl.get_num_buffers());
     ASSERT_TRUE(bl.contents_equal("asdf", 4));
@@ -1617,7 +1616,6 @@ TEST(BufferList, page_aligned_appender) {
     for (unsigned n = 0; n < 3 * CEPH_PAGE_SIZE; ++n) {
       a.append("x", 1);
     }
-    a.flush();
     cout << bl << std::endl;
     ASSERT_EQ(1u, bl.get_num_buffers());
     // verify the beginning
@@ -1629,12 +1627,10 @@ TEST(BufferList, page_aligned_appender) {
     for (unsigned n = 0; n < 3 * CEPH_PAGE_SIZE; ++n) {
       a.append("y", 1);
     }
-    a.flush();
     cout << bl << std::endl;
     ASSERT_EQ(2u, bl.get_num_buffers());
 
     a.append_zero(42);
-    a.flush();
     // ensure append_zero didn't introduce a fragmentation
     ASSERT_EQ(2u, bl.get_num_buffers());
     // verify the end is actually zeroed
@@ -1660,7 +1656,6 @@ TEST(BufferList, page_aligned_appender) {
       // moreover, the next C string-taking `append()` had to
       // create anoter `ptr_node` instance but...
       a.append("xyz", 3);
-      a.flush();
       ASSERT_EQ(4u, bl.get_num_buffers());
 
       // ... it should point to the same `buffer::raw` instance
@@ -1675,8 +1670,6 @@ TEST(BufferList, page_aligned_appender) {
     }
   }
 
-  // `flush()` should be called by automatically when destructing
-  // the appender.
   {
     cout << bl << std::endl;
     ASSERT_EQ(6u, bl.get_num_buffers());