Allow 2 and 4 byte per block chain_info (allow more than 255 snapshots with encryption)

This commit is contained in:
Vitaliy Filippov
2026-07-05 14:58:09 +03:00
parent b2a74de715
commit b2d828ec84
9 changed files with 48 additions and 14 deletions
+3 -2
View File
@@ -96,7 +96,7 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
if (inode_it->second.parent_id == cur_op->req.rw.inode ||
inode_it->second.parent_id == inode_it->second.num ||
chain_size > st_cli->inode_config.size() ||
chain_size > 255)
chain_size > UINT32_MAX)
{
printf("Inode %ju from pool %u has too many parents, returning EINVAL in response to read\n",
INODE_NO_POOL(cur_op->req.rw.inode), INODE_POOL(cur_op->req.rw.inode));
@@ -111,7 +111,7 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
// Add the original inode
chain_size++;
chain_info_len = (cur_op->req.rw.flags & OSD_OP_RETURN_CHAIN
? (cur_op->req.rw.len / bs_bitmap_granularity)
? osd_op_rw_t::chain_info_bytes(chain_size) * (cur_op->req.rw.len / bs_bitmap_granularity)
: 0);
}
}
@@ -138,6 +138,7 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
op_data->oid = oid;
op_data->stripes = (osd_rmw_stripe_t*)data_buf;
op_data->stripe_count = stripe_count;
op_data->chain_info = NULL;
data_buf = (uint8_t*)data_buf + sizeof(osd_rmw_stripe_t) * stripe_count;
cur_op->op_data = op_data;
if (cur_op->req.hdr.opcode != OSD_OP_SCRUB)
+1 -1
View File
@@ -56,7 +56,7 @@ struct osd_primary_op_data_t
int chain_size;
osd_chain_read_t *chain_reads;
int chain_read_count;
uint8_t *chain_info;
void *chain_info;
};
};
};
+9 -1
View File
@@ -597,6 +597,7 @@ void osd_t::send_chained_read_results(pg_t *pg, osd_op_t *cur_op)
int prev = (cur_op->req.rw.offset - op_data->oid.stripe) / bs_bitmap_granularity;
int end = prev + cur_op->req.rw.len/bs_bitmap_granularity;
int cur = prev;
size_t key_index_bytes = osd_op_rw_t::chain_info_bytes(op_data->chain_size);
while (cur <= end)
{
bool has_bit = false;
@@ -608,7 +609,14 @@ void osd_t::send_chained_read_results(pg_t *pg, osd_op_t *cur_op)
if (has_bit)
{
if (op_data->chain_info)
op_data->chain_info[cur] = pos;
{
if (key_index_bytes == 1)
((uint8_t*)op_data->chain_info)[cur] = pos;
else if (key_index_bytes == 2)
((uint16_t*)op_data->chain_info)[cur] = pos;
else
((uint32_t*)op_data->chain_info)[cur] = pos;
}
break;
}
}