From d6524670e136af9c92f417925b3f8381c57cdff0 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 13 Feb 2021 19:27:25 +0300 Subject: [PATCH] Introduce data distribution locality --- src/blockstore_impl.cpp | 4 ++-- src/cluster_client.cpp | 2 +- src/osd.h | 2 +- src/osd_primary.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/blockstore_impl.cpp b/src/blockstore_impl.cpp index b129a1d5..5a27c306 100644 --- a/src/blockstore_impl.cpp +++ b/src/blockstore_impl.cpp @@ -456,7 +456,7 @@ void blockstore_impl_t::process_list(blockstore_op_t *op) } for (; clean_it != clean_end; clean_it++) { - if (!pg_count || ((clean_it->first.inode + clean_it->first.stripe / pg_stripe_size) % pg_count) == list_pg) + if (!pg_count || ((clean_it->first.stripe / pg_stripe_size) % pg_count) == list_pg) // like map_to_pg() { if (stable_count >= stable_alloc) { @@ -501,7 +501,7 @@ void blockstore_impl_t::process_list(blockstore_op_t *op) } for (; dirty_it != dirty_end; dirty_it++) { - if (!pg_count || ((dirty_it->first.oid.inode + dirty_it->first.oid.stripe / pg_stripe_size) % pg_count) == list_pg) + if (!pg_count || ((dirty_it->first.oid.stripe / pg_stripe_size) % pg_count) == list_pg) // like map_to_pg() { if (IS_DELETE(dirty_it->second.state)) { diff --git a/src/cluster_client.cpp b/src/cluster_client.cpp index bfed1180..dd523166 100644 --- a/src/cluster_client.cpp +++ b/src/cluster_client.cpp @@ -703,7 +703,7 @@ void cluster_client_t::slice_rw(cluster_op_t *op) int i = 0; for (uint64_t stripe = first_stripe; stripe <= last_stripe; stripe += pg_block_size) { - pg_num_t pg_num = (op->cur_inode + stripe/pool_cfg.pg_stripe_size) % pool_cfg.real_pg_count + 1; // like map_to_pg() + pg_num_t pg_num = (stripe/pool_cfg.pg_stripe_size) % pool_cfg.real_pg_count + 1; // like map_to_pg() uint64_t begin = (op->offset < stripe ? stripe : op->offset); uint64_t end = (op->offset + op->len) > (stripe + pg_block_size) ? (stripe + pg_block_size) : (op->offset + op->len); diff --git a/src/osd.h b/src/osd.h index 6d2c5788..817b721e 100644 --- a/src/osd.h +++ b/src/osd.h @@ -229,7 +229,7 @@ class osd_t uint64_t pg_count = pg_counts[INODE_POOL(oid.inode)]; if (!pg_count) pg_count = 1; - return (oid.inode + oid.stripe / pg_stripe_size) % pg_count + 1; + return (oid.stripe / pg_stripe_size) % pg_count + 1; } public: diff --git a/src/osd_primary.cpp b/src/osd_primary.cpp index 923f50b3..52a30ee4 100644 --- a/src/osd_primary.cpp +++ b/src/osd_primary.cpp @@ -35,7 +35,7 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op) // oid.stripe = starting offset of the parity stripe .stripe = (cur_op->req.rw.offset/pg_block_size)*pg_block_size, }; - pg_num_t pg_num = (cur_op->req.rw.inode + oid.stripe/pool_cfg.pg_stripe_size) % pg_counts[pool_id] + 1; + pg_num_t pg_num = (oid.stripe/pool_cfg.pg_stripe_size) % pg_counts[pool_id] + 1; // like map_to_pg() auto pg_it = pgs.find({ .pool_id = pool_id, .pg_num = pg_num }); if (pg_it == pgs.end() || !(pg_it->second.state & PG_ACTIVE)) {