diff -uprN ceph-14.2.8/src/common/cohort_lru.h ceph-14.2.8_newfile/src/common/cohort_lru.h --- ceph-14.2.8/src/common/cohort_lru.h 2020-03-02 17:49:20.000000000 +0000 +++ ceph-14.2.8_newfile/src/common/cohort_lru.h 2022-01-29 08:25:39.565717379 +0000 @@ -42,6 +42,8 @@ namespace cohort { typedef bi::link_mode link_mode; + class ObjectFactory; // Forward declaration + class Object { private: @@ -70,7 +72,9 @@ namespace cohort { uint32_t get_refcnt() const { return lru_refcnt; } - virtual bool reclaim() = 0; + virtual bool reclaim(const ObjectFactory* newobj_fac) = 0; + + virtual bool remove() = 0; virtual ~Object() {} @@ -132,20 +136,20 @@ namespace cohort { (!(o->lru_flags & FLAG_EVICTING))); } - Object* evict_block() { + Object* evict_block(const ObjectFactory* newobj_fac) { uint32_t lane_ix = next_evict_lane(); for (int ix = 0; ix < n_lanes; ++ix, lane_ix = next_evict_lane()) { Lane& lane = qlane[lane_ix]; - lane.lock.lock(); + std::unique_lock lane_lock{lane.lock}; /* if object at LRU has refcnt==1, it may be reclaimable */ Object* o = &(lane.q.back()); if (can_reclaim(o)) { ++(o->lru_refcnt); o->lru_flags |= FLAG_EVICTING; - lane.lock.unlock(); - if (o->reclaim()) { - lane.lock.lock(); + lane_lock.unlock(); + if (o->reclaim(newobj_fac)) { + lane_lock.lock(); --(o->lru_refcnt); /* assertions that o state has not changed across * relock */ @@ -154,16 +158,13 @@ namespace cohort { Object::Queue::iterator it = Object::Queue::s_iterator_to(*o); lane.q.erase(it); - lane.lock.unlock(); return o; } else { - // XXX can't make unreachable (means what?) --(o->lru_refcnt); o->lru_flags &= ~FLAG_EVICTING; /* unlock in next block */ } } /* can_reclaim(o) */ - lane.lock.unlock(); } /* each lane */ return nullptr; } /* evict_block */ @@ -208,6 +209,7 @@ namespace cohort { Object::Queue::s_iterator_to(*o); lane.q.erase(it); tdo = o; + tdo->remove(); } lane.lock.unlock(); } else if (unlikely(refcnt == SENTINEL_REFCNT)) { @@ -222,6 +224,7 @@ namespace cohort { /* hiwat check */ if (lane.q.size() > lane_hiwat) { tdo = o; + tdo->remove(); } else { lane.q.push_back(*o); } @@ -236,7 +239,7 @@ namespace cohort { Object* insert(ObjectFactory* fac, Edge edge, uint32_t& flags) { /* use supplied functor to re-use an evicted object, or * allocate a new one of the descendant type */ - Object* o = evict_block(); + Object* o = evict_block(fac); if (o) { fac->recycle(o); /* recycle existing object */ flags |= FLAG_RECYCLE; @@ -425,6 +428,10 @@ namespace cohort { lat.lock->unlock(); return v; } /* find_latch */ + + bool is_same_partition(uint64_t lhs, uint64_t rhs) { + return ((lhs % n_part) == (rhs % n_part)); + } void insert_latched(T* v, Latch& lat, uint32_t flags) { (void) lat.p->tr.insert_unique_commit(*v, lat.commit_data); diff -uprN ceph-14.2.8/src/common/legacy_config_opts.h ceph-14.2.8_newfile/src/common/legacy_config_opts.h --- ceph-14.2.8/src/common/legacy_config_opts.h 2020-03-02 17:49:20.000000000 +0000 +++ ceph-14.2.8_newfile/src/common/legacy_config_opts.h 2022-01-29 08:25:31.177717289 +0000 @@ -1276,6 +1276,7 @@ OPTION(rgw_max_attr_name_len, OPT_SIZE) OPTION(rgw_max_attr_size, OPT_SIZE) OPTION(rgw_max_attrs_num_in_req, OPT_U64) +OPTION(rgw_obj_prefetch_size, OPT_INT) OPTION(rgw_max_chunk_size, OPT_INT) OPTION(rgw_put_obj_min_window_size, OPT_INT) OPTION(rgw_put_obj_max_window_size, OPT_INT) diff -uprN ceph-14.2.8/src/common/options.cc ceph-14.2.8_newfile/src/common/options.cc --- ceph-14.2.8/src/common/options.cc 2020-03-02 17:49:20.000000000 +0000 +++ ceph-14.2.8_newfile/src/common/options.cc 2022-01-29 08:25:31.177717289 +0000 @@ -5616,6 +5616,10 @@ std::vector