Allocate bitmaps along with stripes to avoid memory fragmentation
This commit is contained in:
+9
-4
@@ -51,9 +51,9 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
|
||||
finish_op(cur_op, -EINVAL);
|
||||
return false;
|
||||
}
|
||||
int stripe_count = (pool_cfg.scheme == POOL_SCHEME_REPLICATED ? 1 : pg_it->second.pg_size);
|
||||
osd_primary_op_data_t *op_data = (osd_primary_op_data_t*)calloc_or_die(
|
||||
1, sizeof(osd_primary_op_data_t) + entry_attr_size +
|
||||
sizeof(osd_rmw_stripe_t) * (pool_cfg.scheme == POOL_SCHEME_REPLICATED ? 1 : pg_it->second.pg_size)
|
||||
1, sizeof(osd_primary_op_data_t) + (entry_attr_size + sizeof(osd_rmw_stripe_t)) * stripe_count
|
||||
);
|
||||
op_data->pg_num = pg_num;
|
||||
op_data->oid = oid;
|
||||
@@ -62,6 +62,11 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
|
||||
op_data->pg_data_size = pg_data_size;
|
||||
cur_op->op_data = op_data;
|
||||
split_stripes(pg_data_size, bs_block_size, (uint32_t)(cur_op->req.rw.offset - oid.stripe), cur_op->req.rw.len, op_data->stripes);
|
||||
// Allocate bitmaps along with stripes to avoid extra allocations and fragmentation
|
||||
for (int i = 0; i < stripe_count; i++)
|
||||
{
|
||||
op_data->stripes[i].bmp_buf = (void*)(op_data->stripes+stripe_count) + entry_attr_size*i;
|
||||
}
|
||||
pg_it->second.inflight++;
|
||||
return true;
|
||||
}
|
||||
@@ -117,7 +122,7 @@ void osd_t::continue_primary_read(osd_op_t *cur_op)
|
||||
if (pg.state == PG_ACTIVE || op_data->scheme == POOL_SCHEME_REPLICATED)
|
||||
{
|
||||
// Fast happy-path
|
||||
cur_op->buf = alloc_read_buffer(op_data->stripes, op_data->pg_data_size, 0, entry_attr_size);
|
||||
cur_op->buf = alloc_read_buffer(op_data->stripes, op_data->pg_data_size, 0);
|
||||
submit_primary_subops(SUBMIT_READ, op_data->target_ver,
|
||||
(op_data->scheme == POOL_SCHEME_REPLICATED ? pg.pg_size : op_data->pg_data_size), pg.cur_set.data(), cur_op);
|
||||
op_data->st = 1;
|
||||
@@ -135,7 +140,7 @@ void osd_t::continue_primary_read(osd_op_t *cur_op)
|
||||
op_data->pg_size = pg.pg_size;
|
||||
op_data->scheme = pg.scheme;
|
||||
op_data->degraded = 1;
|
||||
cur_op->buf = alloc_read_buffer(op_data->stripes, pg.pg_size, 0, entry_attr_size);
|
||||
cur_op->buf = alloc_read_buffer(op_data->stripes, pg.pg_size, 0);
|
||||
submit_primary_subops(SUBMIT_READ, op_data->target_ver, pg.pg_size, cur_set, cur_op);
|
||||
op_data->st = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user