Skip to content

Commit 8b8c88a

Browse files
authored
Merge pull request ceph#66336 from Matan-B/wip-matanb-crimson-snapmapper-osddriver
osd/SnapMapper: fix Crimson logs Reviewed-by: Aishwarya Mathuria <[email protected]>
2 parents f43edd5 + 5d4a47f commit 8b8c88a

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/osd/SnapMapper.cc

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ const char *SnapMapper::PURGED_SNAP_PREFIX = "PSN_";
107107
::crimson::interruptible::interruptor<
108108
::crimson::osd::IOInterruptCondition>;
109109

110-
#define CRIMSON_DEBUG(FMT_MSG, ...) crimson::get_logger(ceph_subsys_).debug(FMT_MSG, ##__VA_ARGS__)
110+
SET_SUBSYS(osd);
111111
int OSDriver::get_keys(
112112
const std::set<std::string> &keys,
113113
std::map<std::string, ceph::buffer::list> *out)
114114
{
115-
CRIMSON_DEBUG("OSDriver::{}", __func__);
115+
LOG_PREFIX("OSDriver::get_keys");
116+
DEBUG("");
116117
using crimson::os::FuturizedStore;
117118
return interruptor::green_get(os->omap_get_values(
118119
ch, hoid, keys
@@ -130,21 +131,22 @@ int OSDriver::get_next(
130131
const std::string &key,
131132
std::pair<std::string, ceph::buffer::list> *next)
132133
{
133-
CRIMSON_DEBUG("OSDriver::{} key {}", __func__, key);
134+
LOG_PREFIX("OSDriver::get_next");
135+
DEBUG("key {}", key);
134136
using crimson::os::FuturizedStore;
135137
ObjectStore::omap_iter_seek_t start_from{
136138
key,
137139
ObjectStore::omap_iter_seek_t::UPPER_BOUND
138140
};
139141
std::function<ObjectStore::omap_iter_ret_t(std::string_view, std::string_view)> callback =
140-
[key, next] (std::string_view _key, std::string_view _value)
142+
[FNAME, key, next] (std::string_view _key, std::string_view _value)
141143
{
142-
CRIMSON_DEBUG("OSDriver::get_next key {} got omap values", key);
144+
DEBUG("key {} got omap values", key);
143145
if (!SnapMapper::is_mapping(std::string(_key))) {
144-
CRIMSON_DEBUG("OSDriver::get_next key {} no more values", key);
146+
DEBUG("key {} no more values", key);
145147
return ObjectStore::omap_iter_ret_t::NEXT;
146148
} else {
147-
CRIMSON_DEBUG("OSDriver::get_next returning next: {}, ", _key);
149+
DEBUG("returning next: {}, ", _key);
148150
ceph_assertf(_key > key,
149151
"Key order violation: input_key='%s' got_key='%s'",
150152
key.c_str(), std::string(_key).c_str());
@@ -156,14 +158,14 @@ int OSDriver::get_next(
156158
};
157159
return interruptor::green_get(
158160
os->omap_iterate(ch, hoid, start_from, callback
159-
).safe_then([key] (auto ret) {
161+
).safe_then([FNAME, key] (auto ret) {
160162
if (ret == ObjectStore::omap_iter_ret_t::NEXT) {
161-
CRIMSON_DEBUG("OSDriver::get_next key {} no more values", key);
163+
DEBUG("key {} no more values", key);
162164
return -ENOENT;
163165
}
164166
return 0; // found and Stopped
165-
}, FuturizedStore::Shard::read_errorator::all_same_way([] {
166-
CRIMSON_DEBUG("OSDriver::get_next saw error returning EINVAL");
167+
}, FuturizedStore::Shard::read_errorator::all_same_way([FNAME] {
168+
DEBUG("saw error returning EINVAL");
167169
return -EINVAL;
168170
})
169171
)
@@ -174,19 +176,20 @@ int OSDriver::get_next_or_current(
174176
const std::string &key,
175177
std::pair<std::string, ceph::buffer::list> *next_or_current)
176178
{
177-
CRIMSON_DEBUG("OSDriver::{} key {}", __func__, key);
179+
LOG_PREFIX("OSDriver::get_next_or_current");
180+
DEBUG("key {}", key);
178181
using crimson::os::FuturizedStore;
179182
// let's try to get current first
180183
return interruptor::green_get(os->omap_get_values(
181184
ch, hoid, FuturizedStore::Shard::omap_keys_t{key}
182-
).safe_then([&key, next_or_current] (FuturizedStore::Shard::omap_values_t&& vals) {
183-
CRIMSON_DEBUG("OSDriver::get_next_or_current returning {}", key);
185+
).safe_then([FNAME, &key, next_or_current] (FuturizedStore::Shard::omap_values_t&& vals) {
186+
DEBUG("returning {}", key);
184187
ceph_assert(vals.size() == 1);
185188
*next_or_current = std::make_pair(key, std::move(vals.begin()->second));
186189
return 0;
187190
}, FuturizedStore::Shard::read_errorator::all_same_way(
188-
[next_or_current, &key, this] {
189-
CRIMSON_DEBUG("OSDriver::get_next_or_current no current, try next {}", key);
191+
[FNAME, next_or_current, &key, this] {
192+
DEBUG("no current, try next {}", key);
190193
// no current, try next
191194
return get_next(key, next_or_current);
192195
}))); // this requires seastar::thread

0 commit comments

Comments
 (0)