Replace pgs[id] with pgs.at(id) to prevent accidental auto-vivification

This commit is contained in:
Vitaliy Filippov
2021-02-28 19:36:59 +03:00
parent 7d49706c07
commit 6155b23a7e
4 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ void osd_t::finish_op(osd_op_t *cur_op, int retval)
{
if (cur_op->op_data->pg_num > 0)
{
auto & pg = pgs[{ .pool_id = INODE_POOL(cur_op->op_data->oid.inode), .pg_num = cur_op->op_data->pg_num }];
auto & pg = pgs.at({ .pool_id = INODE_POOL(cur_op->op_data->oid.inode), .pg_num = cur_op->op_data->pg_num });
pg.inflight--;
assert(pg.inflight >= 0);
if ((pg.state & PG_STOPPING) && pg.inflight == 0 && !pg.flush_batch)