File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -188,12 +188,11 @@ int32_t Estimator::split_and_compress(
188188 uint32_t size = data_bl.length ();
189189 ceph_assert (size > 0 );
190190 uint32_t blobs = (size + wctx->target_blob_size - 1 ) / wctx->target_blob_size ;
191- uint32_t blob_size = p2roundup (size / blobs, au_size);
192- std::vector<uint32_t > blob_sizes (blobs);
193- for (auto & i: blob_sizes) {
194- i = std::min (size, blob_size);
195- size -= i;
196- }
191+ uint32_t blob_size = p2roundup ((size + blobs - 1 ) / blobs, au_size);
192+ // dividing 'size' to 'blobs'
193+ // blobs[*] = blob_size; blobs[last] = whatever remains from 'size'
194+ std::vector<uint32_t > blob_sizes (blobs, blob_size);
195+ blob_sizes.back () = size - blob_size * (blobs - 1 );
197196 int32_t disk_needed = 0 ;
198197 uint32_t bl_src_off = 0 ;
199198 for (auto & i: blob_sizes) {
You can’t perform that action at this time.
0 commit comments