#include "librbd/ObjectMap.h"
#include "librbd/Operations.h"
#include "librbd/operation/ResizeRequest.h"
+#include "librbd/Types.h"
#include "librbd/Utils.h"
#include "librbd/LibrbdWriteback.h"
#include "librbd/exclusive_lock/AutomaticPolicy.h"
}
void ImageCtx::perf_start(string name) {
+ auto perf_prio = PerfCountersBuilder::PRIO_DEBUGONLY;
+ if (child == nullptr) {
+ // ensure top-level IO stats are exported for librbd daemons
+ perf_prio = PerfCountersBuilder::PRIO_USEFUL;
+ }
+
PerfCountersBuilder plb(cct, name, l_librbd_first, l_librbd_last);
- plb.add_u64_counter(l_librbd_rd, "rd", "Reads");
- plb.add_u64_counter(l_librbd_rd_bytes, "rd_bytes", "Data size in reads");
- plb.add_time_avg(l_librbd_rd_latency, "rd_latency", "Latency of reads");
- plb.add_u64_counter(l_librbd_wr, "wr", "Writes");
- plb.add_u64_counter(l_librbd_wr_bytes, "wr_bytes", "Written data");
- plb.add_time_avg(l_librbd_wr_latency, "wr_latency", "Write latency");
+ plb.add_u64_counter(l_librbd_rd, "rd", "Reads", "r", perf_prio);
+ plb.add_u64_counter(l_librbd_rd_bytes, "rd_bytes", "Data size in reads",
+ "rb", perf_prio);
+ plb.add_time_avg(l_librbd_rd_latency, "rd_latency", "Latency of reads",
+ "rl", perf_prio);
+ plb.add_u64_counter(l_librbd_wr, "wr", "Writes", "w", perf_prio);
+ plb.add_u64_counter(l_librbd_wr_bytes, "wr_bytes", "Written data",
+ "wb", perf_prio);
+ plb.add_time_avg(l_librbd_wr_latency, "wr_latency", "Write latency",
+ "wl", perf_prio);
plb.add_u64_counter(l_librbd_discard, "discard", "Discards");
plb.add_u64_counter(l_librbd_discard_bytes, "discard_bytes", "Discarded data");
plb.add_time_avg(l_librbd_discard_latency, "discard_latency", "Discard latency");
plb.add_u64_counter(l_librbd_readahead_bytes, "readahead_bytes", "Data size in read ahead");
plb.add_u64_counter(l_librbd_invalidate_cache, "invalidate_cache", "Cache invalidates");
+ plb.add_time(l_librbd_opened_time, "opened_time", "Opened time",
+ "ots", perf_prio);
+ plb.add_time(l_librbd_lock_acquired_time, "lock_acquired_time",
+ "Lock acquired time", "lats", perf_prio);
+
perfcounter = plb.create_perf_counters();
cct->get_perfcounters_collection()->add(perfcounter);
+
+ perfcounter->tset(l_librbd_opened_time, ceph_clock_now());
}
void ImageCtx::perf_stop() {
return true;
}
- void ImageCtx::apply_metadata(const std::map<std::string, bufferlist> &meta) {
+ void ImageCtx::apply_metadata(const std::map<std::string, bufferlist> &meta,
+ bool thread_safe) {
ldout(cct, 20) << __func__ << dendl;
std::map<string, bool> configs = boost::assign::map_list_of(
"rbd_non_blocking_aio", false)(
"rbd_localize_snap_reads", false)(
"rbd_balance_parent_reads", false)(
"rbd_localize_parent_reads", false)(
+ "rbd_sparse_read_threshold_bytes", false)(
"rbd_readahead_trigger_requests", false)(
"rbd_readahead_max_bytes", false)(
"rbd_readahead_disable_after_bytes", false)(
ASSIGN_OPTION(localize_snap_reads, bool);
ASSIGN_OPTION(balance_parent_reads, bool);
ASSIGN_OPTION(localize_parent_reads, bool);
+ ASSIGN_OPTION(sparse_read_threshold_bytes, uint64_t);
ASSIGN_OPTION(readahead_trigger_requests, int64_t);
ASSIGN_OPTION(readahead_max_bytes, int64_t);
ASSIGN_OPTION(readahead_disable_after_bytes, int64_t);
ASSIGN_OPTION(journal_object_flush_interval, int64_t);
ASSIGN_OPTION(journal_object_flush_bytes, int64_t);
ASSIGN_OPTION(journal_object_flush_age, double);
- ASSIGN_OPTION(journal_pool, std::string);
ASSIGN_OPTION(journal_max_payload_bytes, uint64_t);
ASSIGN_OPTION(journal_max_concurrent_object_sets, int64_t);
ASSIGN_OPTION(mirroring_resync_after_disconnect, bool);
ASSIGN_OPTION(mirroring_replay_delay, int64_t);
ASSIGN_OPTION(skip_partial_discard, bool);
ASSIGN_OPTION(blkin_trace_all, bool);
+
+ if (thread_safe) {
+ ASSIGN_OPTION(journal_pool, std::string);
+ }
+
+ if (sparse_read_threshold_bytes == 0) {
+ sparse_read_threshold_bytes = get_object_size();
+ }
}
ExclusiveLock<ImageCtx> *ImageCtx::create_exclusive_lock() {