Skip to content

Commit a622de2

Browse files
committed
crimson/os/seastore/cache: minor adjustments to the calling order
Signed-off-by: Yingxin Cheng <[email protected]>
1 parent dfba56d commit a622de2

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/crimson/os/seastore/cache.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ class Cache : public ExtentTransViewRetriever {
212212
t, type, paddr, len);
213213
return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
214214
} else if (result == Transaction::get_extent_ret::PRESENT) {
215+
if (ret->get_length() != len) {
216+
SUBDEBUGT(seastore_cache,
217+
"{} {}~0x{:x} is present on t with inconsistent length 0x{:x} -- {}",
218+
t, type, paddr, len, ret->get_length(), *ret);
219+
return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
220+
}
221+
222+
ceph_assert(ret->get_type() == type);
223+
215224
if (ret->is_stable()) {
216225
if (ret->is_dirty()) {
217226
++access_stats.trans_dirty;
@@ -225,14 +234,6 @@ class Cache : public ExtentTransViewRetriever {
225234
++stats.access.trans_pending;
226235
}
227236

228-
if (ret->get_length() != len) {
229-
SUBDEBUGT(seastore_cache,
230-
"{} {}~0x{:x} is present on t with inconsistent length 0x{:x} -- {}",
231-
t, type, paddr, len, ret->get_length(), *ret);
232-
return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
233-
}
234-
235-
ceph_assert(ret->get_type() == type);
236237
if (!ret->is_fully_loaded()) {
237238
SUBDEBUGT(seastore_cache,
238239
"{} {}~0x{:x} is present on t without fully loaded -- {}",
@@ -267,14 +268,6 @@ class Cache : public ExtentTransViewRetriever {
267268
return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
268269
}
269270

270-
if (ret->is_dirty()) {
271-
++access_stats.cache_dirty;
272-
++stats.access.cache_dirty;
273-
} else {
274-
++access_stats.cache_lru;
275-
++stats.access.cache_lru;
276-
}
277-
278271
if (ret->get_length() != len) {
279272
SUBDEBUGT(seastore_cache,
280273
"{} {}~0x{:x} is present in cache with inconsistent length 0x{:x} -- {}",
@@ -283,6 +276,15 @@ class Cache : public ExtentTransViewRetriever {
283276
}
284277

285278
ceph_assert(ret->get_type() == type);
279+
280+
if (ret->is_dirty()) {
281+
++access_stats.cache_dirty;
282+
++stats.access.cache_dirty;
283+
} else {
284+
++access_stats.cache_lru;
285+
++stats.access.cache_lru;
286+
}
287+
286288
t.add_to_read_set(ret);
287289
touch_extent(*ret, &t_src, t.get_cache_hint());
288290
if (!ret->is_fully_loaded()) {

0 commit comments

Comments
 (0)