/**
* 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
}
-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,
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,
// -----------------------------------------------------------------------------
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;
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;
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;
}
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;
}
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;
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
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;
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;
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,