mirror of
https://github.com/ceph/ceph
synced 2025-03-29 23:09:47 +00:00
crimson/osd: rename crimson_error and introduce namespace.
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
parent
2407f576ef
commit
ed8eee05cd
@ -6,9 +6,10 @@
|
||||
#include <exception>
|
||||
#include <system_error>
|
||||
|
||||
class crimson_error : private std::system_error {
|
||||
namespace ceph::osd {
|
||||
class error : private std::system_error {
|
||||
public:
|
||||
crimson_error(const std::errc ec)
|
||||
error(const std::errc ec)
|
||||
: system_error(std::make_error_code(ec)) {
|
||||
}
|
||||
|
||||
@ -16,21 +17,22 @@ public:
|
||||
using system_error::what;
|
||||
|
||||
private:
|
||||
crimson_error(const int ret) noexcept
|
||||
error(const int ret) noexcept
|
||||
: system_error(ret, std::system_category()) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct object_not_found : public crimson_error {
|
||||
object_not_found() : crimson_error(std::errc::no_such_file_or_directory) {}
|
||||
struct object_not_found : public error {
|
||||
object_not_found() : error(std::errc::no_such_file_or_directory) {}
|
||||
};
|
||||
|
||||
struct object_corrupted : public crimson_error {
|
||||
object_corrupted() : crimson_error(std::errc::illegal_byte_sequence) {}
|
||||
struct object_corrupted : public error {
|
||||
object_corrupted() : error(std::errc::illegal_byte_sequence) {}
|
||||
};
|
||||
|
||||
struct invalid_argument : public crimson_error {
|
||||
invalid_argument() : crimson_error(std::errc::invalid_argument) {}
|
||||
struct invalid_argument : public error {
|
||||
invalid_argument() : error(std::errc::invalid_argument) {}
|
||||
};
|
||||
|
||||
} // namespace ceph::osd
|
||||
|
@ -463,13 +463,13 @@ seastar::future<Ref<MOSDOpReply>> PG::do_osd_ops(Ref<MOSDOp> m)
|
||||
0, false);
|
||||
reply->add_flags(CEPH_OSD_FLAG_ACK | CEPH_OSD_FLAG_ONDISK);
|
||||
return seastar::make_ready_future<Ref<MOSDOpReply>>(std::move(reply));
|
||||
}).handle_exception_type([=](const crimson_error& ce) {
|
||||
logger().debug("got crimson_error while handling object {}: {} ({})",
|
||||
oid, ce.code(), ce.what());
|
||||
}).handle_exception_type([=](const ceph::osd::error& e) {
|
||||
logger().debug("got ceph::osd::error while handling object {}: {} ({})",
|
||||
oid, e.code(), e.what());
|
||||
|
||||
backend->evict_object_state(oid);
|
||||
auto reply = make_message<MOSDOpReply>(
|
||||
m.get(), -ce.code().value(), get_osdmap_epoch(), 0, false);
|
||||
m.get(), -e.code().value(), get_osdmap_epoch(), 0, false);
|
||||
reply->set_enoent_reply_versions(peering_state.get_info().last_update,
|
||||
peering_state.get_info().last_user_version);
|
||||
return seastar::make_ready_future<Ref<MOSDOpReply>>(std::move(reply));
|
||||
|
@ -73,7 +73,7 @@ PGBackend::get_object_state(const hobject_t& oid)
|
||||
oid.snap);
|
||||
if (clone == end(ss->clones)) {
|
||||
return seastar::make_exception_future<PGBackend::cached_os_t>(
|
||||
object_not_found{});
|
||||
ceph::osd::object_not_found{});
|
||||
}
|
||||
// clone
|
||||
auto soid = oid;
|
||||
@ -84,7 +84,7 @@ PGBackend::get_object_state(const hobject_t& oid)
|
||||
if (clone_snap->second.empty()) {
|
||||
logger().trace("find_object: {}@[] -- DNE", soid);
|
||||
return seastar::make_exception_future<PGBackend::cached_os_t>(
|
||||
object_not_found{});
|
||||
ceph::osd::object_not_found{});
|
||||
}
|
||||
auto first = clone_snap->second.back();
|
||||
auto last = clone_snap->second.front();
|
||||
@ -92,7 +92,7 @@ PGBackend::get_object_state(const hobject_t& oid)
|
||||
logger().trace("find_object: {}@[{},{}] -- DNE",
|
||||
soid, first, last);
|
||||
return seastar::make_exception_future<PGBackend::cached_os_t>(
|
||||
object_not_found{});
|
||||
ceph::osd::object_not_found{});
|
||||
}
|
||||
logger().trace("find_object: {}@[{},{}] -- HIT",
|
||||
soid, first, last);
|
||||
@ -237,7 +237,7 @@ seastar::future<bufferlist> PGBackend::read(const object_info_t& oi,
|
||||
logger().error("full-object read crc {} != expected {} on {}",
|
||||
crc, *maybe_crc, soid);
|
||||
// todo: mark soid missing, perform recovery, and retry
|
||||
throw object_corrupted{};
|
||||
throw ceph::osd::object_corrupted{};
|
||||
}
|
||||
}
|
||||
return seastar::make_ready_future<bufferlist>(std::move(bl));
|
||||
@ -316,7 +316,7 @@ seastar::future<> PGBackend::writefull(
|
||||
{
|
||||
const ceph_osd_op& op = osd_op.op;
|
||||
if (op.extent.length != osd_op.indata.length()) {
|
||||
throw ::invalid_argument();
|
||||
throw ceph::osd::invalid_argument();
|
||||
}
|
||||
|
||||
const bool existing = maybe_create_new_object(os, txn);
|
||||
|
Loading…
Reference in New Issue
Block a user