@@ -274,17 +274,16 @@ VolumeManager::NullAsyncResult HomeBlocksImpl::read(const VolumePtr& vol, const
274274 for (uint32_t i = 0 , blk_count = 0 , start_idx = 0 ; i < out_vector.size (); ++i, ++cur_lba) {
275275 auto const & [key, value] = out_vector[i];
276276 // cur_lba is used to keep track of the holes
277- // fill the read buffer with zeroes for the holes
277+ // move the read buffer by the size of the holes
278278 if (cur_lba != key.key ()) {
279279 if (blk_count > 0 ) {
280280 // submit the read for the previous blkids
281281 submit_read_to_backend (read_buf, futs, out_vector[start_idx], blk_count, vol, req->part_of_batch );
282282 start_idx = i;
283283 blk_count = 0 ;
284284 }
285- auto fill_size = (key.key () - cur_lba) * vol->rd ()->get_blk_size ();
286- std::memset (read_buf, 0 , fill_size);
287- read_buf += fill_size;
285+ auto offset = (key.key () - cur_lba) * vol->rd ()->get_blk_size ();
286+ read_buf += offset;
288287 cur_lba = key.key ();
289288 }
290289
@@ -310,10 +309,6 @@ VolumeManager::NullAsyncResult HomeBlocksImpl::read(const VolumePtr& vol, const
310309 submit_read_to_backend (read_buf, futs, out_vector[start_idx], 1 , vol, req->part_of_batch );
311310 }
312311 }
313- // fill the holes at the end of the read buffer
314- if (cur_lba != req->end_lba () + 1 ) {
315- std::memset (read_buf, 0 , (req->end_lba () - cur_lba + 1 ) * vol->rd ()->get_blk_size ());
316- }
317312
318313 return out_vector.empty () ? folly::Unit () :
319314 folly::collectAllUnsafe (futs).thenValue ([out_vector = std::move (out_vector), buf = req->buffer
0 commit comments