Remove extra unneeded read_entry-s

This commit is contained in:
Vitaliy Filippov
2025-11-23 19:08:23 +03:00
parent abeb8b73fa
commit e0d60dd49f
3 changed files with 22 additions and 8 deletions
+15 -1
View File
@@ -1373,6 +1373,15 @@ int blockstore_heap_t::post_write(object_id oid, heap_write_t *wr, uint32_t *mod
return update_object(block_num, obj, wr, modified_block);
}
int blockstore_heap_t::post_write(uint32_t & block_num, object_id oid, heap_object_t *obj, heap_write_t *wr)
{
if (!obj)
{
return add_object(oid, wr, &block_num);
}
return update_object(block_num, obj, wr, &block_num);
}
int blockstore_heap_t::post_stabilize(object_id oid, uint64_t version, uint32_t *modified_block, uint64_t *new_lsn, uint64_t *new_to_lsn)
{
uint32_t block_num = 0;
@@ -1523,6 +1532,11 @@ int blockstore_heap_t::post_delete(object_id oid, uint64_t *new_lsn, uint32_t *m
{
*modified_block = block_num;
}
return post_delete(block_num, obj, new_lsn);
}
int blockstore_heap_t::post_delete(uint32_t block_num, heap_object_t *obj, uint64_t *new_lsn)
{
bool tracking_active = mvcc_save_copy(obj);
auto & inf = block_info.at(block_num);
assert(inf.data);
@@ -1531,7 +1545,7 @@ int blockstore_heap_t::post_delete(object_id oid, uint64_t *new_lsn, uint32_t *m
{
*new_lsn = next_lsn;
}
push_inflight_lsn(oid, next_lsn, 0);
push_inflight_lsn((object_id){ .inode = obj->inode, .stripe = obj->stripe }, next_lsn, 0);
erase_object(block_num, obj, next_lsn, tracking_active);
return 0;
}
+2
View File
@@ -227,6 +227,7 @@ public:
// auto-compacts the object, then adds a write entry to it and to the compaction queue
// return 0 if OK, or maybe ENOSPC
int post_write(object_id oid, heap_write_t *wr, uint32_t *modified_block);
int post_write(uint32_t & block_num, object_id oid, heap_object_t *obj, heap_write_t *wr);
// stabilize an unstable object version
// return 0 if OK, ENOENT if not exists
int post_stabilize(object_id oid, uint64_t version, uint32_t *modified_block, uint64_t *new_lsn, uint64_t *new_to_lsn);
@@ -236,6 +237,7 @@ public:
// forget an object
// return error code
int post_delete(object_id oid, uint64_t *new_lsn, uint32_t *modified_block);
int post_delete(uint32_t block_num, heap_object_t *obj, uint64_t *new_lsn);
// get the next object to compact
// guaranteed to return objects in min lsn order
// returns 0 if OK, ENOENT if nothing to compact
+5 -7
View File
@@ -71,7 +71,8 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
return 0;
}
PRIV(op)->is_big = false;
heap_object_t *obj = heap->read_entry(op->oid, NULL);
uint32_t modified_block = 0;
heap_object_t *obj = heap->read_entry(op->oid, &modified_block);
if (op->opcode == BS_OP_DELETE)
{
// Delete
@@ -83,8 +84,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
return 2;
}
BS_SUBMIT_CHECK_SQES(1);
uint32_t modified_block;
int res = heap->post_delete(op->oid, &PRIV(op)->lsn, &modified_block);
int res = heap->post_delete(modified_block, obj, &PRIV(op)->lsn);
assert(res == 0);
prepare_meta_block_write(op, modified_block);
PRIV(op)->op_state = 5;
@@ -174,8 +174,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
if (op->bitmap)
memcpy(wr->get_ext_bitmap(heap), op->bitmap, dsk.clean_entry_bitmap_size);
heap->calc_checksums(wr, (uint8_t*)op->buf, true);
uint32_t modified_block;
int res = heap->post_write(op->oid, wr, &modified_block);
int res = heap->post_write(modified_block, op->oid, obj, wr);
if (res == ENOSPC)
{
if (!heap->get_inflight_queue_size())
@@ -220,8 +219,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
if (op->bitmap)
memcpy(wr->get_ext_bitmap(heap), op->bitmap, dsk.clean_entry_bitmap_size);
heap->calc_checksums(wr, (uint8_t*)op->buf, true);
uint32_t modified_block;
int res = heap->post_write(op->oid, wr, &modified_block);
int res = heap->post_write(modified_block, op->oid, obj, wr);
if (res == ENOSPC)
{
if (!heap->get_inflight_queue_size())