]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: remove unused ioprio thread/wq infrastructure 24665/head
authorSage Weil <sage@redhat.com>
Thu, 18 Oct 2018 16:25:26 +0000 (11:25 -0500)
committerSage Weil <sage@redhat.com>
Tue, 23 Oct 2018 13:29:02 +0000 (08:29 -0500)
This is all now obsolete, with no remaining users.

Move ceph_gettid into Thread.{cc,h}

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/CMakeLists.txt
src/common/Thread.cc
src/common/Thread.h
src/common/WorkQueue.cc
src/common/WorkQueue.h
src/common/io_priority.cc [deleted file]
src/common/io_priority.h [deleted file]
src/crimson/CMakeLists.txt
src/os/bluestore/NVMEDevice.cc
src/test/common/CMakeLists.txt
src/test/common/test_io_priority.cc [deleted file]

index 06b251a26e1bbcf70c338c7215e2250b8bd3fb79..39821472fa1f4d05bd5bf123f271d4cac6c5ba06 100644 (file)
@@ -66,7 +66,6 @@ set(common_srcs
   histogram.cc
   hobject.cc
   hostname.cc
-  io_priority.cc
   ipaddr.cc
   iso_8601.cc
   linux_version.c
index b9e13dc93d5f47b28daedaf46e75c69c84088cfa..edbd7d34c8749ac0e929971936167cc6587dc9b5 100644 (file)
  */
 
 #include <signal.h>
+#include <unistd.h>
+#ifdef __linux__
+#include <sys/syscall.h>   /* For SYS_xxx definitions */
+#endif
 
 #include "common/Thread.h"
 #include "common/code_environment.h"
 #include "common/debug.h"
 #include "common/signal.h"
-#include "common/io_priority.h"
 
 #ifdef HAVE_SCHED
 #include <sched.h>
 #endif
 
+
+pid_t ceph_gettid(void)
+{
+#ifdef __linux__
+  return syscall(SYS_gettid);
+#else
+  return -ENOSYS;
+#endif
+}
+
 static int _set_affinity(int id)
 {
 #ifdef HAVE_SCHED
@@ -45,8 +58,6 @@ static int _set_affinity(int id)
 Thread::Thread()
   : thread_id(0),
     pid(0),
-    ioprio_class(-1),
-    ioprio_priority(-1),
     cpuid(-1),
     thread_name(NULL)
 {
@@ -66,13 +77,6 @@ void *Thread::entry_wrapper()
   int p = ceph_gettid(); // may return -ENOSYS on other platforms
   if (p > 0)
     pid = p;
-  if (pid &&
-      ioprio_class >= 0 &&
-      ioprio_priority >= 0) {
-    ceph_ioprio_set(IOPRIO_WHO_PROCESS,
-                   pid,
-                   IOPRIO_PRIO_VALUE(ioprio_class, ioprio_priority));
-  }
   if (pid && cpuid >= 0)
     _set_affinity(cpuid);
 
@@ -179,18 +183,6 @@ int Thread::detach()
   return pthread_detach(thread_id);
 }
 
-int Thread::set_ioprio(int cls, int prio)
-{
-  // fixme, maybe: this can race with create()
-  ioprio_class = cls;
-  ioprio_priority = prio;
-  if (pid && cls >= 0 && prio >= 0)
-    return ceph_ioprio_set(IOPRIO_WHO_PROCESS,
-                          pid,
-                          IOPRIO_PRIO_VALUE(cls, prio));
-  return 0;
-}
-
 int Thread::set_affinity(int id)
 {
   int r = 0;
index 8e7cadd14c3bdab76e1ca9007e6acd1bb6856589..bc32755c30e887d517dd790a90321182214fa6d8 100644 (file)
 
 #include "include/compat.h"
 
+extern pid_t ceph_gettid();
+
 class Thread {
  private:
   pthread_t thread_id;
   pid_t pid;
-  int ioprio_class, ioprio_priority;
   int cpuid;
   const char *thread_name;
 
@@ -57,7 +58,6 @@ class Thread {
   void create(const char *name, size_t stacksize = 0);
   int join(void **prval = 0);
   int detach();
-  int set_ioprio(int cls, int prio);
   int set_affinity(int cpuid);
 };
 
index 094d4e411de5517373d5aa99b338c1b5eb230928..0c64af848fc2b85b762b03953d6614d45604b3b7 100644 (file)
@@ -28,8 +28,6 @@ ThreadPool::ThreadPool(CephContext *cct_, string nm, string tn, int n, const cha
     _stop(false),
     _pause(0),
     _draining(0),
-    ioprio_class(-1),
-    ioprio_priority(-1),
     _num_threads(n),
     processing(0)
 {
@@ -158,11 +156,6 @@ void ThreadPool::start_threads()
     _threads.insert(wt);
 
     wt->create(thread_name.c_str());
-
-    int r = wt->set_ioprio(ioprio_class, ioprio_priority);
-    if (r < 0)
-      lderr(cct) << " set_ioprio got " << cpp_strerror(r) << dendl;
-
   }
 }
 
@@ -261,24 +254,6 @@ void ThreadPool::drain(WorkQueue_* wq)
   _lock.unlock();
 }
 
-void ThreadPool::set_ioprio(int cls, int priority)
-{
-  std::lock_guard<Mutex> l(_lock);
-  ioprio_class = cls;
-  ioprio_priority = priority;
-  for (set<WorkThread*>::iterator p = _threads.begin();
-       p != _threads.end();
-       ++p) {
-    ldout(cct,10) << __func__ 
-                 << " class " << cls << " priority " << priority
-                 << " pid " << (*p)->get_pid()
-                 << dendl;
-    int r = (*p)->set_ioprio(cls, priority);
-    if (r < 0)
-      lderr(cct) << " set_ioprio got " << cpp_strerror(r) << dendl;
-  }
-}
-
 ShardedThreadPool::ShardedThreadPool(CephContext *pcct_, string nm, string tn,
   uint32_t pnum_threads):
   cct(pcct_),
index c30e493be0345d3a3c7aa954b0aefec442838a12..66696d01a8f05c6240f8da522890b872e24bc740 100644 (file)
@@ -36,7 +36,6 @@ class ThreadPool : public md_config_obs_t {
   int _pause;
   int _draining;
   Cond _wait_cond;
-  int ioprio_class, ioprio_priority;
 
 public:
   class TPHandle {
@@ -528,9 +527,6 @@ public:
    * If it is not NULL, blocks until the given work queue does not have
    * any items left to process. */
   void drain(WorkQueue_* wq = 0);
-
-  /// set io priority
-  void set_ioprio(int cls, int priority);
 };
 
 class GenContextWQ :
diff --git a/src/common/io_priority.cc b/src/common/io_priority.cc
deleted file mode 100644 (file)
index 3e97125..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2012 Red Hat
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#include <unistd.h>
-#if defined(__FreeBSD__) || defined(__APPLE__)
-#include <errno.h>
-#endif
-#ifdef __linux__
-#include <sys/syscall.h>   /* For SYS_xxx definitions */
-#endif
-#include <algorithm>
-
-#include "io_priority.h"
-
-pid_t ceph_gettid(void)
-{
-#ifdef __linux__
-  return syscall(SYS_gettid);
-#else
-  return -ENOSYS;
-#endif
-}
-
-int ceph_ioprio_set(int whence, int who, int ioprio)
-{
-#ifdef __linux__
-  return syscall(SYS_ioprio_set, whence, who, ioprio);
-#else
-  return -ENOSYS;
-#endif
-}
-
-int ceph_ioprio_string_to_class(const std::string& s)
-{
-  std::string l = s;
-  std::transform(l.begin(), l.end(), l.begin(), ::tolower);
-
-  if (l == "idle")
-    return IOPRIO_CLASS_IDLE;
-  if (l == "be" || l == "besteffort" || l == "best effort")
-    return IOPRIO_CLASS_BE;
-  if (l == "rt" || l == "realtime" || l == "real time")
-    return IOPRIO_CLASS_RT;
-  return -EINVAL;
-}
diff --git a/src/common/io_priority.h b/src/common/io_priority.h
deleted file mode 100644 (file)
index 91ebf42..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2012 Red Hat
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation.  See file COPYING.
- *
- */
-
-#ifndef CEPH_COMMON_IO_PRIORITY_H
-#define CEPH_COMMON_IO_PRIORITY_H
-
-#include <string>
-
-extern pid_t ceph_gettid();
-
-#ifndef IOPRIO_WHO_PROCESS
-# define IOPRIO_WHO_PROCESS 1
-#endif
-#ifndef IOPRIO_PRIO_VALUE
-# define IOPRIO_CLASS_SHIFT 13
-# define IOPRIO_PRIO_VALUE(class, data) \
-               (((class) << IOPRIO_CLASS_SHIFT) | (data))
-#endif
-#ifndef IOPRIO_CLASS_RT
-# define IOPRIO_CLASS_RT 1
-#endif
-#ifndef IOPRIO_CLASS_BE
-# define IOPRIO_CLASS_BE 2
-#endif
-#ifndef IOPRIO_CLASS_IDLE
-# define IOPRIO_CLASS_IDLE 3
-#endif
-
-extern int ceph_ioprio_set(int whence, int who, int ioprio);
-
-extern int ceph_ioprio_string_to_class(const std::string& s);
-
-#endif
index 609e63465b216c864b24eb9c94dcb85445806858..bc9a89396141cd43310f2f302499f618f881e4f3 100644 (file)
@@ -39,7 +39,6 @@ add_library(crimson-common STATIC
   ${PROJECT_SOURCE_DIR}/src/common/hobject.cc
   ${PROJECT_SOURCE_DIR}/src/common/hostname.cc
   ${PROJECT_SOURCE_DIR}/src/common/ipaddr.cc
-  ${PROJECT_SOURCE_DIR}/src/common/io_priority.cc
   ${PROJECT_SOURCE_DIR}/src/common/lockdep.cc
   ${PROJECT_SOURCE_DIR}/src/common/mutex_debug.cc
   ${PROJECT_SOURCE_DIR}/src/common/mempool.cc
index 19b91f7a6d1935d71ba8006b33876da473b4cd93..104e94046212be880eba8f93fddd116d80ade08c 100644 (file)
@@ -38,7 +38,6 @@
 #include "common/errno.h"
 #include "common/debug.h"
 #include "common/perf_counters.h"
-#include "common/io_priority.h"
 
 #include "NVMEDevice.h"
 
index 21a54aeb677a5d80c89ec0a823122997c80c0464..df314be9489547f567c6b4d6feb29a89c9ca06cb 100644 (file)
@@ -133,13 +133,6 @@ add_executable(unittest_lru
 add_ceph_unittest(unittest_lru)
 target_link_libraries(unittest_lru ceph-common)
 
-# unittest_io_priority
-add_executable(unittest_io_priority
-  test_io_priority.cc
-  )
-add_ceph_unittest(unittest_io_priority)
-target_link_libraries(unittest_io_priority ceph-common)
-
 # unittest_crc32c
 add_executable(unittest_crc32c
   test_crc32c.cc
diff --git a/src/test/common/test_io_priority.cc b/src/test/common/test_io_priority.cc
deleted file mode 100644 (file)
index b2d4e26..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2014 Red Hat <contact@redhat.com>
- *
- * Author: Loic Dachary <loic@dachary.org>
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- */
-
-#include <errno.h>
-#include <gtest/gtest.h>
-
-#include "common/io_priority.h"
-
-TEST(io_priority, ceph_ioprio_string_to_class) {
-  ASSERT_EQ(IOPRIO_CLASS_IDLE, ceph_ioprio_string_to_class("idle"));
-  ASSERT_EQ(IOPRIO_CLASS_IDLE, ceph_ioprio_string_to_class("IDLE"));
-
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("be"));
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("BE"));
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("besteffort"));
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("BESTEFFORT"));
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("best effort"));
-  ASSERT_EQ(IOPRIO_CLASS_BE, ceph_ioprio_string_to_class("BEST EFFORT"));
-
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("rt"));
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("RT"));
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("realtime"));
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("REALTIME"));
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("real time"));
-  ASSERT_EQ(IOPRIO_CLASS_RT, ceph_ioprio_string_to_class("REAL TIME"));
-
-  ASSERT_EQ(-EINVAL, ceph_ioprio_string_to_class("invalid"));
-}
-
-/*
- * Local Variables:
- * compile-command: "cd ../.. ; 
- *   make -j4 unittest_io_priority &&
- *   libtool --mode=execute valgrind --tool=memcheck --leak-check=full \
- *      ./unittest_io_priority
- *   "
- * End:
- */