]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: mark out empty transactions
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 19 Nov 2021 05:30:06 +0000 (13:30 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 9 Dec 2021 01:37:05 +0000 (09:37 +0800)
TODO: avoid write if the transaction is empty.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/seastore_types.cc
src/crimson/os/seastore/seastore_types.h

index c24a157727775c915b2515b3d8eea03dd6841a86..57a3c8cf795eca2ada314dee6650f8718b5ff4f0 100644 (file)
@@ -1095,6 +1095,11 @@ record_t Cache::prepare_record(Transaction &t)
   record_header_fullness.inline_stats.filled_bytes += record_size.get_raw_mdlength();
   record_header_fullness.inline_stats.total_bytes += record_size.get_mdlength();
 
+  // FIXME: prevent submitting empty records
+  if (record.is_empty()) {
+    ERRORT("record is empty!", t);
+  }
+
   return record;
 }
 
index 839b2cc1c3cf31a352270a85b99f0845b32e12e8..2901ab1a6f6a75104092ae8d0583cb96b9c43c78 100644 (file)
@@ -158,6 +158,8 @@ void record_group_size_t::account(
     const record_size_t& rsize,
     extent_len_t _block_size)
 {
+  // FIXME: prevent submitting empty records
+  // assert(!rsize.is_empty());
   assert(_block_size > 0);
   assert(rsize.dlength % _block_size == 0);
   assert(block_size == 0 || block_size == _block_size);
index bd05d2271592526cb929f3f5899d8523760b599d..63582ce3d3121b4557d26348c79e037097b9960c 100644 (file)
@@ -1196,6 +1196,11 @@ struct record_size_t {
   extent_len_t plain_mdlength = 0; // mdlength without the record header
   extent_len_t dlength = 0;
 
+  bool is_empty() const {
+    return plain_mdlength == 0 &&
+           dlength == 0;
+  }
+
   void account_extent(extent_len_t extent_len);
 
   void account(const extent_t& extent) {
@@ -1235,6 +1240,11 @@ struct record_t {
     }
   }
 
+  bool is_empty() const {
+    return extents.size() == 0 &&
+           deltas.size() == 0;
+  }
+
   // the size of extents and delta buffers
   std::size_t get_raw_data_size() const {
     auto delta_size = std::accumulate(