request->set_connection(nullptr);
}
-bool OpRequest::check_rmw(int flag) {
+bool OpRequest::check_rmw(int flag) const {
assert(rmw_flags != 0);
return rmw_flags & flag;
}
-bool OpRequest::may_read() {
+bool OpRequest::may_read() const {
return need_read_cap() || check_rmw(CEPH_OSD_RMW_FLAG_CLASS_READ);
}
-bool OpRequest::may_write() {
+bool OpRequest::may_write() const {
return need_write_cap() || check_rmw(CEPH_OSD_RMW_FLAG_CLASS_WRITE);
}
-bool OpRequest::may_cache() { return check_rmw(CEPH_OSD_RMW_FLAG_CACHE); }
-bool OpRequest::rwordered_forced() {
+bool OpRequest::may_cache() const { return check_rmw(CEPH_OSD_RMW_FLAG_CACHE); }
+bool OpRequest::rwordered_forced() const {
return check_rmw(CEPH_OSD_RMW_FLAG_RWORDERED);
}
-bool OpRequest::rwordered() {
+bool OpRequest::rwordered() const {
return may_write() || may_cache() || rwordered_forced();
}
bool OpRequest::includes_pg_op() { return check_rmw(CEPH_OSD_RMW_FLAG_PGOP); }
-bool OpRequest::need_read_cap() {
+bool OpRequest::need_read_cap() const {
return check_rmw(CEPH_OSD_RMW_FLAG_READ);
}
-bool OpRequest::need_write_cap() {
+bool OpRequest::need_write_cap() const {
return check_rmw(CEPH_OSD_RMW_FLAG_WRITE);
}
bool OpRequest::need_promote() {
// rmw flags
int rmw_flags;
- bool check_rmw(int flag);
- bool may_read();
- bool may_write();
- bool may_cache();
- bool rwordered_forced();
- bool rwordered();
+ bool check_rmw(int flag) const ;
+ bool may_read() const;
+ bool may_write() const;
+ bool may_cache() const;
+ bool rwordered_forced() const;
+ bool rwordered() const;
bool includes_pg_op();
- bool need_read_cap();
- bool need_write_cap();
+ bool need_read_cap() const;
+ bool need_write_cap() const;
bool need_promote();
bool need_skip_handle_cache();
bool need_skip_promote();
ctx->register_on_commit(
[m, ctx, this](){
if (ctx->op)
- log_op_stats(
- ctx);
+ log_op_stats(ctx->op, ctx->bytes_written, ctx->bytes_read);
if (m && !ctx->sent_reply) {
MOSDOpReply *reply = ctx->reply;
close_op_ctx(ctx);
}
-void PrimaryLogPG::log_op_stats(OpContext *ctx)
+void PrimaryLogPG::log_op_stats(const OpRequestRef op,
+ const uint64_t inb,
+ const uint64_t outb)
{
- OpRequestRef op = ctx->op;
- const MOSDOp *m = static_cast<const MOSDOp*>(op->get_req());
-
- utime_t now = ceph_clock_now();
- utime_t latency = now;
- latency -= ctx->op->get_req()->get_recv_stamp();
- utime_t process_latency = now;
- process_latency -= ctx->op->get_dequeued_time();
+ const MOSDOp* const m = static_cast<const MOSDOp*>(op->get_req());
+ const utime_t now = ceph_clock_now();
- uint64_t inb = ctx->bytes_written;
- uint64_t outb = ctx->bytes_read;
+ const utime_t latency = now - m->get_recv_stamp();
+ const utime_t process_latency = now - op->get_dequeued_time();
osd->logger->inc(l_osd_op);
osd->logger->tinc(l_osd_op_w_lat, latency);
osd->logger->hinc(l_osd_op_w_lat_inb_hist, latency.to_nsec(), inb);
osd->logger->tinc(l_osd_op_w_process_lat, process_latency);
- } else
+ } else {
ceph_abort();
+ }
dout(15) << "log_op_stats " << *m
<< " inb " << inb
if (result >= 0) {
if (!ctx->ignore_log_op_stats) {
- log_op_stats(ctx);
+ log_op_stats(ctx->op, ctx->bytes_written, ctx->bytes_read);
+
publish_stats_to_osd();
}
void reply_ctx(OpContext *ctx, int err);
void reply_ctx(OpContext *ctx, int err, eversion_t v, version_t uv);
void make_writeable(OpContext *ctx);
- void log_op_stats(OpContext *ctx);
+ void log_op_stats(const OpRequestRef op, uint64_t inb, uint64_t outb);
void write_update_size_and_usage(object_stat_sum_t& stats, object_info_t& oi,
interval_set<uint64_t>& modified, uint64_t offset,