CephContext *cct,
ErasureCodeInterfaceRef ec_impl,
uint64_t stripe_width,
- ECSwitch *s)
+ ECSwitch *s,
+ ECExtentCache::LRU &ignored)
: parent(pg), cct(cct), switcher(s),
read_pipeline(cct, ec_impl, this->sinfo, get_parent()->get_eclistener()),
rmw_pipeline(cct, ec_impl, this->sinfo, get_parent()->get_eclistener(), *this),
CephContext *cct,
ceph::ErasureCodeInterfaceRef ec_impl,
uint64_t stripe_width,
- ECSwitch *s);
+ ECSwitch *s,
+ ECExtentCache::LRU &ignored);
int objects_get_attrs(
const hobject_t &hoid,
--- /dev/null
+#pragma once
+
+// Temporary stubs
+class ECExtentCache {
+ public:
+ class LRU {
+ public:
+ LRU(uint64_t) {}
+ };
+};
ObjectStore *store,
CephContext *cct,
ceph::ErasureCodeInterfaceRef ec_impl,
- uint64_t stripe_width) :
+ uint64_t stripe_width,
+ ECExtentCache::LRU &lru) :
PGBackend(cct, pg, store, coll, ch),
legacy(pg, cct, ec_impl, stripe_width, this),
- optimized(pg, cct, ec_impl, stripe_width, this),
+ optimized(pg, cct, ec_impl, stripe_width, this, lru),
is_optimized_actual(get_parent()->get_pool().allows_ecoptimizations()) {}
bool is_optimized() const
PG *pg;
if (pi.type == pg_pool_t::TYPE_REPLICATED ||
pi.type == pg_pool_t::TYPE_ERASURE)
- pg = new PrimaryLogPG(&service, createmap, pool, ec_profile, pgid);
+ pg = new PrimaryLogPG(&service, createmap, pool, ec_profile, pgid, lookup_ec_extent_cache_lru(pgid));
else
ceph_abort();
return pg;
return true;
}
+ECExtentCache::LRU &OSD::lookup_ec_extent_cache_lru(spg_t pgid) const
+{
+ uint32_t shard_index = pgid.hash_to_shard(num_shards);
+ auto sdata = shards[shard_index];
+ return sdata->ec_extent_cache_lru;
+}
+
PGRef OSD::_lookup_pg(spg_t pgid)
{
uint32_t shard_index = pgid.hash_to_shard(num_shards);
scheduler(ceph::osd::scheduler::make_scheduler(
cct, osd->whoami, osd->num_shards, id, osd->store->is_rotational(),
osd->store->get_type(), osd_op_queue, osd_op_queue_cut_off, osd->monc)),
- context_queue(sdata_wait_lock, sdata_cond)
+ context_queue(sdata_wait_lock, sdata_cond),
+ ec_extent_cache_lru(cct->_conf.get_val<uint64_t>(
+ "ec_extent_cache_size"))
{
dout(0) << "using op scheduler " << *scheduler << dendl;
}
ContextQueue context_queue;
+ //This is an extent cache for the erasure coding. Specifically, this acts as
+ //a least-recently-used cache invalidator, allowing for cache shards to last
+ //longer than the most recent IO in each object.
+ ECExtentCache::LRU ec_extent_cache_lru;
+
void _attach_pg(OSDShardPGSlot *slot, PG *pg);
void _detach_pg(OSDShardPGSlot *slot);
*/
static CompatSet get_osd_compat_set();
+ /**
+ * lookup_ec_extent_cache_lru()
+ * @param pgid -
+ * @return extent cache for LRU
+ */
+ ECExtentCache::LRU &lookup_ec_extent_cache_lru(spg_t pgid) const;
private:
class C_Tick;
coll_t coll,
ObjectStore::CollectionHandle &ch,
ObjectStore *store,
- CephContext *cct)
+ CephContext *cct,
+ ECExtentCache::LRU &ec_extent_cache_lru)
{
ErasureCodeProfile ec_profile = profile;
switch (pool.type) {
store,
cct,
ec_impl,
- pool.stripe_width);
+ pool.stripe_width,
+ ec_extent_cache_lru);
}
default:
ceph_abort();
#include "ECListener.h"
#include "ECTypes.h"
+#include "ECExtentCache.h"
#include "osd_types.h"
#include "pg_features.h"
#include "common/intrusive_timer.h"
coll_t coll,
ObjectStore::CollectionHandle &ch,
ObjectStore *store,
- CephContext *cct);
+ CephContext *cct,
+ ECExtentCache::LRU &ec_extent_cache_lru);
};
#endif
PrimaryLogPG::PrimaryLogPG(OSDService *o, OSDMapRef curmap,
const PGPool &_pool,
- const map<string,string>& ec_profile, spg_t p) :
+ const map<string,string>& ec_profile, spg_t p,
+ ECExtentCache::LRU &ec_extent_cache_lru) :
PG(o, curmap, _pool, p),
pgbackend(
PGBackend::build_pg_backend(
- _pool.info, ec_profile, this, coll_t(p), ch, o->store, cct)),
+ _pool.info, ec_profile, this, coll_t(p), ch, o->store, cct, ec_extent_cache_lru)),
object_contexts(o->cct, o->cct->_conf->osd_pg_object_context_cache_count),
new_backfill(false),
temp_seq(0),
PrimaryLogPG(OSDService *o, OSDMapRef curmap,
const PGPool &_pool,
const std::map<std::string,std::string>& ec_profile,
- spg_t p);
+ spg_t p,
+ ECExtentCache::LRU &ec_extent_cache_lru);
~PrimaryLogPG() override;
void do_command(