@@ -164,7 +164,12 @@ BlkAllocStatus VirtualDev::commit_blk(BlkId const& blkid) {
164164 HS_LOG (ERROR, device, " fail to commit_blk: bid {}" , blkid.to_string ());
165165 return BlkAllocStatus::INVALID_DEV;
166166 }
167- HS_LOG (DEBUG, device, " commit_blk: bid {}" , blkid.to_string ());
167+
168+ for (int i = 0 ; i < blkid.blk_count (); i++) {
169+ auto t = BlkId{blkid.blk_num () + i, 1 /* nblks */ , blkid.chunk_num ()};
170+ HS_LOG (DEBUG, device, " commit_blk: bid {}" , t.to_string ());
171+ }
172+
168173 auto const recovering = homestore::hs ()->is_initializing ();
169174 if (!recovering) {
170175 // in non-recovery mode, if a blk is committed without allocating, it will cause data corruption
@@ -328,9 +333,9 @@ BlkAllocStatus VirtualDev::alloc_blks_from_chunk(blk_count_t nblks, blk_alloc_hi
328333 return status;
329334}
330335
331- void VirtualDev::free_blk (BlkId const & bid, VDevCPContext* vctx) {
332- auto do_free_action = [this ](auto const & b, VDevCPContext* vctx) {
333- if (vctx && (m_allocator_type != blk_allocator_type_t ::append)) {
336+ void VirtualDev::free_blk (BlkId const & bid, VDevCPContext* vctx, bool free_now ) {
337+ auto do_free_action = [this ](auto const & b, VDevCPContext* vctx, bool free_now ) {
338+ if (vctx && (m_allocator_type != blk_allocator_type_t ::append) && !free_now ) {
334339 // We don't want to accumulate here for append blk allocator.
335340 vctx->m_free_blkid_list .push_back (b);
336341 } else {
@@ -348,10 +353,10 @@ void VirtualDev::free_blk(BlkId const& bid, VDevCPContext* vctx) {
348353 MultiBlkId const & mbid = r_cast< MultiBlkId const & >(bid);
349354 auto it = mbid.iterate();
350355 while (auto const b = it.next ()) {
351- do_free_action (*b, vctx);
356+ do_free_action (*b, vctx, free_now );
352357 }
353358 } else {
354- do_free_action (bid, vctx);
359+ do_free_action (bid, vctx, free_now );
355360 }
356361}
357362
0 commit comments