]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ec: rename object_size -> stripe_width in get_chunk_size()
authorRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 22 Feb 2024 19:48:55 +0000 (20:48 +0100)
committerRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 22 Feb 2024 19:54:21 +0000 (20:54 +0100)
`object_size` was misleading in my perception; it suggested to me
that the chunking happens on objects, not their stripes.

`stripe_width` corresponds with the naming in the ctor of `ECBackend`.

Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/erasure-code/ErasureCodeInterface.h
src/erasure-code/clay/ErasureCodeClay.cc
src/erasure-code/clay/ErasureCodeClay.h
src/erasure-code/isa/ErasureCodeIsa.cc
src/erasure-code/isa/ErasureCodeIsa.h
src/erasure-code/jerasure/ErasureCodeJerasure.cc
src/erasure-code/jerasure/ErasureCodeJerasure.h
src/erasure-code/lrc/ErasureCodeLrc.cc
src/erasure-code/lrc/ErasureCodeLrc.h
src/erasure-code/shec/ErasureCodeShec.cc
src/erasure-code/shec/ErasureCodeShec.h

index b0c24e1e42a714f7d26d1762cadcd3d9a5ee5dc1..7107f978dd4fbdd5deab9ddc678450db0a64ab23 100644 (file)
@@ -261,21 +261,21 @@ namespace ceph {
     /**
      * Return the size (in bytes) of a single chunk created by a call
      * to the **decode** method. The returned size multiplied by
-     * **get_chunk_count()** is greater or equal to **object_size**.
+     * **get_chunk_count()** is greater or equal to **stripe_width**.
      *
      * If the object size is properly aligned, the chunk size is
-     * **object_size / get_chunk_count()**. However, if
-     * **object_size** is not a multiple of **get_chunk_count** or if
+     * **stripe_width / get_chunk_count()**. However, if
+     * **stripe_width** is not a multiple of **get_chunk_count** or if
      * the implementation imposes additional alignment constraints,
      * the chunk size may be larger.
      *
      * The byte found at offset **B** of the original object is mapped
      * to chunk **B / get_chunk_size()** at offset **B % get_chunk_size()**.
      *
-     * @param [in] object_size the number of bytes of the object to **encode()**
+     * @param [in] stripe_width the number of bytes of the object to **encode()**
      * @return the size (in bytes) of a single chunk created by **encode()**
      */
-    virtual unsigned int get_chunk_size(unsigned int object_size) const = 0;
+    virtual unsigned int get_chunk_size(unsigned int stripe_width) const = 0;
 
     /**
      * Compute the smallest subset of **available** chunks that needs
index 7162cecbd9f9e25b2ddec50aaa64add62076a6a6..ba37b8c721c733a5144a11fb4ab37311427b1a95 100644 (file)
@@ -87,12 +87,12 @@ int ErasureCodeClay::init(ErasureCodeProfile &profile,
 
 }
 
-unsigned int ErasureCodeClay::get_chunk_size(unsigned int object_size) const
+unsigned int ErasureCodeClay::get_chunk_size(unsigned int stripe_width) const
 {
   unsigned int alignment_scalar_code = pft.erasure_code->get_chunk_size(1);
   unsigned int alignment = sub_chunk_no * k * alignment_scalar_code;
   
-  return round_up_to(object_size, alignment) / k;
+  return round_up_to(stripe_width, alignment) / k;
 }
 
 int ErasureCodeClay::minimum_to_decode(const set<int> &want_to_read,
index 9b23b9907c3b613a4b1adf25936d9e2a8e414a0a..3697df721ef355a04bdaaa37b776c0bd143faa9b 100644 (file)
@@ -58,7 +58,7 @@ public:
     return sub_chunk_no;
   }
 
-  unsigned int get_chunk_size(unsigned int object_size) const override;
+  unsigned int get_chunk_size(unsigned int stripe_width) const override;
 
   int minimum_to_decode(const std::set<int> &want_to_read,
                        const std::set<int> &available,
index 58aff4b0e0dd66fa4edb43558d05f70b5540ddcd..1c2eadfdd0fec27f3e3f283ef31402e5ac05b517 100644 (file)
@@ -63,10 +63,10 @@ ErasureCodeIsa::init(ErasureCodeProfile &profile, ostream *ss)
 // -----------------------------------------------------------------------------
 
 unsigned int
-ErasureCodeIsa::get_chunk_size(unsigned int object_size) const
+ErasureCodeIsa::get_chunk_size(unsigned int stripe_width) const
 {
   unsigned alignment = get_alignment();
-  unsigned chunk_size = ( object_size + k - 1 ) / k;
+  unsigned chunk_size = (stripe_width + k - 1) / k;
   dout(20) << "get_chunk_size: chunk_size " << chunk_size
            << " must be modulo " << alignment << dendl;
   unsigned modulo = chunk_size % alignment;
index 705a1723aa65de27cd3c520eab76478300fdd5ac..06c51bbc907b725f488b0ae21f36c8a091889922 100644 (file)
@@ -71,7 +71,7 @@ public:
     return k;
   }
 
-  unsigned int get_chunk_size(unsigned int object_size) const override;
+  unsigned int get_chunk_size(unsigned int stripe_width) const override;
 
   int encode_chunks(const std::set<int> &want_to_encode,
                     std::map<int, ceph::buffer::list> *encoded) override;
index 3a780de811cb7771fa42f5c14ae81068d3be1475..7c4cfa4f8a1fa448afa42808b19feda43c3c2863 100644 (file)
@@ -77,12 +77,12 @@ int ErasureCodeJerasure::parse(ErasureCodeProfile &profile,
   return err;
 }
 
-unsigned int ErasureCodeJerasure::get_chunk_size(unsigned int object_size) const
+unsigned int ErasureCodeJerasure::get_chunk_size(unsigned int stripe_width) const
 {
   unsigned alignment = get_alignment();
   if (per_chunk_alignment) {
-    unsigned chunk_size = object_size / k;
-    if (object_size % k)
+    unsigned chunk_size = stripe_width / k;
+    if (stripe_width % k)
       chunk_size++;
     dout(20) << "get_chunk_size: chunk_size " << chunk_size
             << " must be modulo " << alignment << dendl; 
@@ -95,8 +95,8 @@ unsigned int ErasureCodeJerasure::get_chunk_size(unsigned int object_size) const
     }
     return chunk_size;
   } else {
-    unsigned tail = object_size % alignment;
-    unsigned padded_length = object_size + ( tail ?  ( alignment - tail ) : 0 );
+    unsigned tail = stripe_width % alignment;
+    unsigned padded_length = stripe_width + (tail ? (alignment - tail) : 0);
     ceph_assert(padded_length % k == 0);
     return padded_length / k;
   }
index 2272e0aad637b721cd5b1f5cdc9081a9ff86325b..75d5c3c1a56ccd17cc2a3e3c6162f14988c62241 100644 (file)
@@ -54,7 +54,7 @@ public:
     return k;
   }
 
-  unsigned int get_chunk_size(unsigned int object_size) const override;
+  unsigned int get_chunk_size(unsigned int stripe_width) const override;
 
   int encode_chunks(const std::set<int> &want_to_encode,
                    std::map<int, ceph::buffer::list> *encoded) override;
index bea861f1adee50b18d744ac0c8dfcb2f0b7ba89f..eb8ebd81045694e918516748e1bce68ad4feadf4 100644 (file)
@@ -555,9 +555,9 @@ set<int> ErasureCodeLrc::get_erasures(const set<int> &want,
   return result;
 }
 
-unsigned int ErasureCodeLrc::get_chunk_size(unsigned int object_size) const
+unsigned int ErasureCodeLrc::get_chunk_size(unsigned int stripe_width) const
 {
-  return layers.front().erasure_code->get_chunk_size(object_size);
+  return layers.front().erasure_code->get_chunk_size(stripe_width);
 }
 
 void p(const set<int> &s) { cerr << s; } // for gdb
index e5b0915ba86d2de78e92dd9f71f6672b613e3726..d5e3a07e847a1392fc1b5a579a5d91a0c3b6d3d4 100644 (file)
@@ -103,7 +103,7 @@ public:
     return data_chunk_count;
   }
 
-  unsigned int get_chunk_size(unsigned int object_size) const override;
+  unsigned int get_chunk_size(unsigned int stripe_width) const override;
 
   int encode_chunks(const std::set<int> &want_to_encode,
                    std::map<int, ceph::buffer::list> *encoded) override;
index 3634be2fb3b9d14a00ba5e222d3c1bf9d3699780..70b1372bda40458c91c43eb495ce6ce8430fd153 100644 (file)
@@ -58,11 +58,11 @@ int ErasureCodeShec::init(ErasureCodeProfile &profile,
   return ErasureCode::init(profile, ss);
 }
 
-unsigned int ErasureCodeShec::get_chunk_size(unsigned int object_size) const
+unsigned int ErasureCodeShec::get_chunk_size(unsigned int stripe_width) const
 {
   unsigned alignment = get_alignment();
-  unsigned tail = object_size % alignment;
-  unsigned padded_length = object_size + ( tail ?  ( alignment - tail ) : 0 );
+  unsigned tail = stripe_width % alignment;
+  unsigned padded_length = stripe_width + (tail ? (alignment - tail) : 0);
 
   ceph_assert(padded_length % k == 0);
   return padded_length / k;
index 44a0778854fe6be6b35cb0b2d0c6e7d94a85cfad..51e20359a4184a628cfd2ed9053dce0974cbd46f 100644 (file)
@@ -69,7 +69,7 @@ public:
     return k;
   }
 
-  unsigned int get_chunk_size(unsigned int object_size) const override;
+  unsigned int get_chunk_size(unsigned int stripe_width) const override;
 
   int _minimum_to_decode(const std::set<int> &want_to_read,
                         const std::set<int> &available_chunks,