Add request size validation

This commit is contained in:
Vitaliy Filippov
2026-06-15 01:56:54 +03:00
parent 22d094ccc6
commit ca606570f7
6 changed files with 91 additions and 7 deletions
+3
View File
@@ -192,6 +192,9 @@ void osd_t::parse_config(bool init)
if (!bs_bitmap_granularity)
bs_bitmap_granularity = DEFAULT_BITMAP_GRANULARITY;
clean_entry_bitmap_size = bs_block_size / bs_bitmap_granularity / 8;
msgr.bs_block_size = bs_block_size;
msgr.clean_entry_bitmap_size = clean_entry_bitmap_size;
msgr.max_write_request_size = MAX_DATA_BLOCK_SIZE; // will be changed after pool config
// immediate_commit
if (config["immediate_commit"] == "all")
immediate_commit = IMMEDIATE_ALL;
+15
View File
@@ -427,6 +427,21 @@ void osd_t::on_change_pool_config_hook()
{
apply_pg_locks_localize_only();
}
msgr.max_write_request_size = 0;
for (auto & pc: st_cli->pool_config)
{
auto & pool_cfg = pc.second;
uint32_t pg_data_size = (pool_cfg.scheme == POOL_SCHEME_REPLICATED ? 1 : pool_cfg.pg_size-pool_cfg.parity_chunks);
uint32_t pg_block_size = pool_cfg.data_block_size * pg_data_size;
if (msgr.max_write_request_size < pg_block_size)
{
msgr.max_write_request_size = pg_block_size;
}
}
if (!msgr.max_write_request_size)
{
msgr.max_write_request_size = MAX_DATA_BLOCK_SIZE;
}
}
void osd_t::apply_pg_locks_localize_only()
+2
View File
@@ -6,6 +6,8 @@
#define FLUSH_BATCH 512
#define SELF_CLIENT 0
static_assert(FLUSH_BATCH <= MAX_SIMPLE_PAYLOAD_SIZE / sizeof(obj_ver_id));
void osd_t::submit_pg_flush_ops(pg_t & pg)
{
pg_flush_batch_t *fb = new pg_flush_batch_t();