Skip to content

Commit 91fb5de

Browse files
committed
crimson/os/seastore: misc renames
Signed-off-by: Yingxin Cheng <[email protected]>
1 parent c6b58b1 commit 91fb5de

File tree

7 files changed

+32
-28
lines changed

7 files changed

+32
-28
lines changed

src/crimson/os/seastore/btree/btree_range_pin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class BtreeNodeMapping : public PhysicalNodeMapping<key_t, val_t> {
182182
assert(extent.is_pending_in_trans(t.get_trans_id()));
183183
return false;
184184
}
185-
auto &pendings = extent.mutation_pendings;
185+
auto &pendings = extent.mutation_pending_extents;
186186
auto trans_id = t.get_trans_id();
187187
bool unviewable = (pendings.find(trans_id, trans_spec_view_t::cmp_t()) !=
188188
pendings.end());

src/crimson/os/seastore/cache.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,14 +919,14 @@ void Cache::invalidate_extent(
919919
CachedExtent& extent)
920920
{
921921
if (!extent.may_conflict()) {
922-
assert(extent.transactions.empty());
922+
assert(extent.read_transactions.empty());
923923
extent.set_invalid(t);
924924
return;
925925
}
926926

927927
LOG_PREFIX(Cache::invalidate_extent);
928928
bool do_conflict_log = true;
929-
for (auto &&i: extent.transactions) {
929+
for (auto &&i: extent.read_transactions) {
930930
if (!i.t->conflicted) {
931931
if (do_conflict_log) {
932932
SUBDEBUGT(seastore_t, "conflict begin -- {}", t, extent);
@@ -1181,7 +1181,7 @@ CachedExtentRef Cache::duplicate_for_write(
11811181
ret->prior_instance = i;
11821182
// duplicate_for_write won't occur after ool write finished
11831183
assert(!i->prior_poffset);
1184-
auto [iter, inserted] = i->mutation_pendings.insert(*ret);
1184+
auto [iter, inserted] = i->mutation_pending_extents.insert(*ret);
11851185
ceph_assert(inserted);
11861186
t.add_mutated_extent(ret);
11871187
if (is_root_type(ret->get_type())) {

src/crimson/os/seastore/cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ class Cache : public ExtentTransViewRetriever {
688688
on_cache(*ret);
689689

690690
// replace placeholder in transactions
691-
while (!cached->transactions.empty()) {
692-
auto t = cached->transactions.begin()->t;
691+
while (!cached->read_transactions.empty()) {
692+
auto t = cached->read_transactions.begin()->t;
693693
t->replace_placeholder(*cached, *ret);
694694
}
695695

src/crimson/os/seastore/cached_extent.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ CachedExtent* CachedExtent::get_transactional_view(Transaction &t) {
8181
}
8282

8383
CachedExtent* CachedExtent::get_transactional_view(transaction_id_t tid) {
84-
auto it = mutation_pendings.find(tid, trans_spec_view_t::cmp_t());
85-
if (it != mutation_pendings.end()) {
84+
auto it = mutation_pending_extents.find(tid, trans_spec_view_t::cmp_t());
85+
if (it != mutation_pending_extents.end()) {
8686
return (CachedExtent*)&(*it);
8787
} else {
8888
return this;

src/crimson/os/seastore/cached_extent.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class read_set_item_t {
7474
&read_set_item_t::trans_hook>;
7575

7676
public:
77-
struct cmp_t {
77+
struct extent_cmp_t {
7878
using is_transparent = paddr_t;
7979
bool operator()(const read_set_item_t<T> &lhs, const read_set_item_t &rhs) const;
8080
bool operator()(const paddr_t &lhs, const read_set_item_t<T> &rhs) const;
@@ -113,10 +113,14 @@ class read_set_item_t {
113113
read_set_item_t(read_set_item_t &&) = default;
114114
~read_set_item_t() = default;
115115
};
116+
116117
template <typename T>
117-
using read_set_t = std::set<
118+
using read_extent_set_t = std::set<
118119
read_set_item_t<T>,
119-
typename read_set_item_t<T>::cmp_t>;
120+
typename read_set_item_t<T>::extent_cmp_t>;
121+
122+
template <typename T>
123+
using read_trans_set_t = typename read_set_item_t<T>::trans_set_t;
120124

121125
struct trans_spec_view_t {
122126
// if the extent is pending, contains the id of the owning transaction;
@@ -874,7 +878,7 @@ class CachedExtent
874878
CachedExtent* get_transactional_view(Transaction &t);
875879
CachedExtent* get_transactional_view(transaction_id_t tid);
876880

877-
read_set_item_t<Transaction>::trans_set_t transactions;
881+
read_trans_set_t<Transaction> read_transactions;
878882

879883
placement_hint_t user_hint = PLACEMENT_HINT_NULL;
880884

@@ -883,7 +887,7 @@ class CachedExtent
883887
rewrite_gen_t rewrite_generation = NULL_GENERATION;
884888

885889
protected:
886-
trans_view_set_t mutation_pendings;
890+
trans_view_set_t mutation_pending_extents;
887891
trans_view_set_t retired_transactions;
888892

889893
CachedExtent(CachedExtent &&other) = delete;
@@ -1169,7 +1173,7 @@ template <typename T, typename C, typename Cmp>
11691173
class addr_extent_set_base_t
11701174
: public std::set<C, Cmp> {};
11711175

1172-
using pextent_set_t = addr_extent_set_base_t<
1176+
using retired_extent_set_t = addr_extent_set_base_t<
11731177
paddr_t,
11741178
trans_retired_extent_link_t,
11751179
ref_paddr_cmp
@@ -1468,17 +1472,17 @@ read_set_item_t<T>::read_set_item_t(T *t, CachedExtentRef ref)
14681472
{}
14691473

14701474
template <typename T>
1471-
inline bool read_set_item_t<T>::cmp_t::operator()(
1475+
inline bool read_set_item_t<T>::extent_cmp_t::operator()(
14721476
const read_set_item_t<T> &lhs, const read_set_item_t<T> &rhs) const {
14731477
return lhs.ref->poffset < rhs.ref->poffset;
14741478
}
14751479
template <typename T>
1476-
inline bool read_set_item_t<T>::cmp_t::operator()(
1480+
inline bool read_set_item_t<T>::extent_cmp_t::operator()(
14771481
const paddr_t &lhs, const read_set_item_t<T> &rhs) const {
14781482
return lhs < rhs.ref->poffset;
14791483
}
14801484
template <typename T>
1481-
inline bool read_set_item_t<T>::cmp_t::operator()(
1485+
inline bool read_set_item_t<T>::extent_cmp_t::operator()(
14821486
const read_set_item_t<T> &lhs, const paddr_t &rhs) const {
14831487
return lhs.ref->poffset < rhs;
14841488
}

src/crimson/os/seastore/linked_tree_node.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ class ParentNode {
302302
TCachedExtentRef<T> find_pending_version(Transaction &t, node_key_t key) {
303303
auto &me = down_cast();
304304
assert(me.is_stable());
305-
auto mut_iter = me.mutation_pendings.find(
305+
auto mut_iter = me.mutation_pending_extents.find(
306306
t.get_trans_id(), trans_spec_view_t::cmp_t());
307-
if (mut_iter != me.mutation_pendings.end()) {
307+
if (mut_iter != me.mutation_pending_extents.end()) {
308308
assert(copy_dests_by_trans.find(t.get_trans_id()) ==
309309
copy_dests_by_trans.end());
310310
return static_cast<T*>(&(*mut_iter));

src/crimson/os/seastore/transaction.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ class Transaction {
171171

172172
assert(ref->is_valid());
173173

174-
auto it = ref->transactions.lower_bound(
174+
auto it = ref->read_transactions.lower_bound(
175175
this, read_set_item_t<Transaction>::trans_cmp_t());
176-
if (it != ref->transactions.end() && it->t == this) {
176+
if (it != ref->read_transactions.end() && it->t == this) {
177177
return false;
178178
}
179179

180180
auto [iter, inserted] = read_set.emplace(this, ref);
181181
ceph_assert(inserted);
182-
ref->transactions.insert_before(
182+
ref->read_transactions.insert_before(
183183
it, const_cast<read_set_item_t<Transaction>&>(*iter));
184184
return true;
185185
}
@@ -191,13 +191,13 @@ class Transaction {
191191

192192
assert(ref->is_valid());
193193

194-
auto it = ref->transactions.lower_bound(
194+
auto it = ref->read_transactions.lower_bound(
195195
this, read_set_item_t<Transaction>::trans_cmp_t());
196-
assert(it == ref->transactions.end() || it->t != this);
196+
assert(it == ref->read_transactions.end() || it->t != this);
197197

198198
auto [iter, inserted] = read_set.emplace(this, ref);
199199
ceph_assert(inserted);
200-
ref->transactions.insert_before(
200+
ref->read_transactions.insert_before(
201201
it, const_cast<read_set_item_t<Transaction>&>(*iter));
202202
}
203203

@@ -306,7 +306,7 @@ class Transaction {
306306
assert(where->ref.get() == &placeholder);
307307
where = read_set.erase(where);
308308
auto it = read_set.emplace_hint(where, this, &extent);
309-
extent.transactions.insert(const_cast<read_set_item_t<Transaction>&>(*it));
309+
extent.read_transactions.insert(const_cast<read_set_item_t<Transaction>&>(*it));
310310
}
311311
{
312312
auto where = retired_set.find(&placeholder);
@@ -610,7 +610,7 @@ class Transaction {
610610
* Submitting a transaction mutating any contained extent/addr will
611611
* invalidate *this.
612612
*/
613-
read_set_t<Transaction> read_set; ///< set of extents read by paddr
613+
read_extent_set_t<Transaction> read_set; ///< set of extents read by paddr
614614

615615
uint64_t fresh_backref_extents = 0; // counter of new backref extents
616616

@@ -663,7 +663,7 @@ class Transaction {
663663
*
664664
* Set of extents retired by *this.
665665
*/
666-
pextent_set_t retired_set;
666+
retired_extent_set_t retired_set;
667667

668668
/// stats to collect when commit or invalidate
669669
tree_stats_t onode_tree_stats;

0 commit comments

Comments
 (0)