]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: allow io priority to be set for the disk_tp 1998/head
authorSage Weil <sage@redhat.com>
Thu, 19 Jun 2014 19:34:36 +0000 (12:34 -0700)
committerSage Weil <sage@inktank.com>
Mon, 23 Jun 2014 16:03:04 +0000 (09:03 -0700)
The disk_tp covers scrubbing, pg deletion, and snap trimming

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/OSD.cc
src/osd/OSD.h

index 29ff66349ea6aae85a500afd3f5357e23afdf54b..27cfc2cfe9dcf398276614b520ac5e1f8be44ee5 100644 (file)
@@ -464,6 +464,8 @@ OPTION(osd_peering_wq_batch_size, OPT_U64, 20)
 OPTION(osd_op_pq_max_tokens_per_priority, OPT_U64, 4194304)
 OPTION(osd_op_pq_min_cost, OPT_U64, 65536)
 OPTION(osd_disk_threads, OPT_INT, 1)
+OPTION(osd_disk_thread_ioprio_class, OPT_STR, "") // rt realtime be besteffort best effort idle
+OPTION(osd_disk_thread_ioprio_priority, OPT_INT, -1) // 0-7
 OPTION(osd_recovery_threads, OPT_INT, 1)
 OPTION(osd_recover_clone_overlap, OPT_BOOL, true)   // preserve clone_overlap during recovery/migration
 OPTION(osd_op_num_threads_per_shard, OPT_INT, 2)
index ec2b09cf8ff9a7357f8fb8b7a88171b52b29860b..fe85e2daff55bad10dfb32a3460d15e960801b96 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "common/ceph_argparse.h"
 #include "common/version.h"
+#include "common/io_priority.h"
 
 #include "os/ObjectStore.h"
 
@@ -1289,6 +1290,8 @@ int OSD::init()
   disk_tp.start();
   command_tp.start();
 
+  set_disk_tp_priority();
+
   // start the heartbeat
   heartbeat_thread.create();
 
@@ -8244,6 +8247,8 @@ const char** OSD::get_tracked_conf_keys() const
     "osd_map_cache_size",
     "osd_map_max_advance",
     "osd_pg_epoch_persisted_max_stale",
+    "osd_disk_thread_ioprio_class",
+    "osd_disk_thread_ioprio_priority",
     NULL
   };
   return KEYS;
@@ -8266,6 +8271,10 @@ void OSD::handle_conf_change(const struct md_config_t *conf,
     op_tracker.set_history_size_and_duration(cct->_conf->osd_op_history_size,
                                              cct->_conf->osd_op_history_duration);
   }
+  if (changed.count("osd_disk_thread_ioprio_class") ||
+      changed.count("osd_disk_thread_ioprio_priority")) {
+    set_disk_tp_priority();
+  }
 
   check_config();
 }
@@ -8285,6 +8294,17 @@ void OSD::check_config()
   }
 }
 
+void OSD::set_disk_tp_priority()
+{
+  dout(10) << __func__
+          << " class " << cct->_conf->osd_disk_thread_ioprio_class
+          << " priority " << cct->_conf->osd_disk_thread_ioprio_priority
+          << dendl;
+  int cls =
+    ceph_ioprio_string_to_class(cct->_conf->osd_disk_thread_ioprio_class);
+  disk_tp.set_ioprio(cls, cct->_conf->osd_disk_thread_ioprio_priority);
+}
+
 // --------------------------------
 
 int OSD::init_op_flags(OpRequestRef op)
index ac1c2e71291553eaf0f49800d23f892e84c080a8..9734f2e6deca22b9990f3fa107b4e1c6ffb97ebb 100644 (file)
@@ -1095,6 +1095,8 @@ private:
 
   bool paused_recovery;
 
+  void set_disk_tp_priority();
+
   // -- sessions --
 public:
   struct Session : public RefCountedObject {