]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: kill ager 4274/head
authorSage Weil <sage@redhat.com>
Wed, 1 Apr 2015 04:12:11 +0000 (21:12 -0700)
committerSage Weil <sage@redhat.com>
Sun, 5 Apr 2015 17:56:04 +0000 (10:56 -0700)
This is more or less dead.  Definitely unused.

Signed-off-by: Sage Weil <sage@redhat.com>
src/CMakeLists.txt
src/common/config_opts.h
src/osd/Ager.cc [deleted file]
src/osd/Ager.h [deleted file]
src/osd/Makefile.am
src/osd/OSD.cc

index d523ff1ce2db99c7554aafbe9c8fe0f38b3bed62..4637b1e97f8968216ac29a201a9bf48a1fdbcbc7 100644 (file)
@@ -451,7 +451,6 @@ set(osd_srcs
   osd/ECBackend.cc
   osd/ECTransaction.cc
   osd/PGBackend.cc
-  osd/Ager.cc
   osd/OSD.cc
   osd/OSDCap.cc
   osd/Watch.cc
index 74e8e4aedc2bb756f8281353cb6d48314f2ebd78..2527d20e3e3f8197a5cd6f43b7826b76b9f6bb58 100644 (file)
@@ -586,8 +586,6 @@ OPTION(osd_scrub_finalize_thread_timeout, OPT_INT, 60*10)
 OPTION(osd_scrub_invalid_stats, OPT_BOOL, true)
 OPTION(osd_remove_thread_timeout, OPT_INT, 60*60)
 OPTION(osd_command_thread_timeout, OPT_INT, 10*60)
-OPTION(osd_age, OPT_FLOAT, .8)
-OPTION(osd_age_time, OPT_INT, 0)
 OPTION(osd_heartbeat_addr, OPT_ADDR, entity_addr_t())
 OPTION(osd_heartbeat_interval, OPT_INT, 6)       // (seconds) how often we ping peers
 OPTION(osd_heartbeat_grace, OPT_INT, 20)         // (seconds) how long before we decide a peer has failed
diff --git a/src/osd/Ager.cc b/src/osd/Ager.cc
deleted file mode 100644 (file)
index 3e1100e..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-
-#include "include/types.h"
-
-#include "Ager.h"
-
-#include "common/Clock.h"
-#include "common/debug.h"
-
-// ick
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#if defined(DARWIN) || defined(__FreeBSD__)
-#include <sys/param.h>
-#include <sys/mount.h>
-#endif // DARWIN || __FreeBSD__
-
-
-int myrand() 
-{
-  if (0) 
-    return rand();
-  else {
-    static int n = 0;
-    srand(n++);
-    return rand();
-  }
-}
-
-
-file_object_t Ager::age_get_oid() {
-  if (!age_free_oids.empty()) {
-    file_object_t o = age_free_oids.front();
-    age_free_oids.pop_front();
-    return o;
-  }
-  file_object_t last = age_cur_oid;
-  ++age_cur_oid.bno;
-  return last;
-}
-
-ssize_t Ager::age_pick_size() {
-  ssize_t max = file_size_distn.sample() * 1024;
-  return max/2 + (myrand() % 100) * max/200 + 1;
-}
-
-bool start_debug = false;
-
-uint64_t Ager::age_fill(float pc, utime_t until) {
-  int max = 1024*1024;
-  bufferptr bp(max);
-  bp.zero();
-  bufferlist bl;
-  bl.push_back(bp);
-  uint64_t wrote = 0;
-  while (1) {
-    if (ceph_clock_now(cct) > until) break;
-    
-    struct statfs st;
-    store->statfs(&st);
-    float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
-    float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);  // to write to
-    //float a = (float)(st.f_bfree) / (float)st.f_blocks;
-    //dout(10) << "age_fill at " << a << " / " << pc << " .. " << st.f_blocks << " " << st.f_bavail << dendl;
-    if (free >= pc) {
-      generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << dendl;
-      break;
-    }
-
-    // make sure we can write to it..
-    if (avail > .98 ||
-        avail - free > .02) 
-      store->sync();
-
-    file_object_t poid = age_get_oid();
-    
-    int b = myrand() % 10;
-    age_objects[b].push_back(poid);
-    
-    ssize_t s = age_pick_size();
-    wrote += (s + 4095) / 4096;
-
-
-
-
-    generic_dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << poid << dec << " sz " << s << dendl;
-    
-
-    if (false && start_debug && wrote > 1000000ULL) { 
-      /*
-
-
-      1005700
-?
-1005000
-1005700
-      1005710
-      1005725ULL
-      1005750ULL
-      1005800
-      1006000
-
-//  99  1000500 ? 1000750 1006000
-*/
-    }
-
-    off_t off = 0;
-    while (s) {
-      ssize_t t = MIN(s, max);
-      bufferlist sbl;
-      sbl.substr_of(bl, 0, t);
-      ObjectStore::Transaction tr;
-      hobject_t oid(sobject_t(poid, 0));
-      tr.write(coll_t(), oid, off, t, sbl);
-      store->apply_transaction(tr);
-      off += t;
-      s -= t;
-    }
-    poid.bno++;
-  }
-
-  return wrote*4; // KB
-}
-
-void Ager::age_empty(float pc) {
-  int nper = 20;
-  int n = nper;
-
-  while (1) {
-    struct statfs st;
-    store->statfs(&st);
-    float free = 1.0 - ((float)(st.f_bfree) / (float)st.f_blocks);
-    float avail = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);  // to write to
-    generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << dendl;//" stopping" << dendl;
-    if (free <= pc) {
-      generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << dendl;
-      break;
-    }
-    
-    int b = myrand() % 10;
-    n--;
-    if (n == 0 || age_objects[b].empty()) {
-      generic_dout(2) << "age_empty sync" << dendl;
-      //sync();
-      //sync();
-      n = nper;
-      continue;
-    }
-    file_object_t poid = age_objects[b].front();
-    age_objects[b].pop_front();
-    
-    generic_dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << poid << dec << dendl;
-    
-    ObjectStore::Transaction t;
-    hobject_t oid(sobject_t(poid, 0));
-    t.remove(coll_t(), oid);
-    store->apply_transaction(t);
-    age_free_oids.push_back(poid);
-  }
-}
-
-
-
-
-void Ager::age(int time,
-               float high_water,    // fill to this %
-               float low_water,     // then empty to this %
-               int count,         // this many times
-               float final_water,   // and end here ( <= low_water)
-               int fake_size_mb) { 
-
-  srand(0);
-
-  utime_t start = ceph_clock_now(cct);
-  utime_t until = start;
-  until.sec_ref() += time;
-  
-  //int elapsed = 0;
-  int freelist_inc = 60;
-  utime_t nextfl = start;
-  nextfl.sec_ref() += freelist_inc;
-
-  while (age_objects.size() < 10) age_objects.push_back( list<file_object_t>() );
-  
-  if (fake_size_mb) {
-    int fake_bl = fake_size_mb * 256;
-    struct statfs st;
-    store->statfs(&st);
-    float f = (float)fake_bl / (float)st.f_blocks;
-    high_water = (float)high_water * f;
-    low_water = (float)low_water * f;
-    final_water = (float)final_water * f;
-    generic_dout(2) << "fake " << fake_bl << " / " << st.f_blocks << " is " << f << ", high " << high_water << " low " << low_water << " final " << final_water << dendl;
-  }
-  
-  // init size distn (once)
-  if (!did_distn) {
-    did_distn = true;
-    age_cur_oid = file_object_t(888, 0);
-    file_size_distn.add(1, 19.0758125+0.65434375);
-    file_size_distn.add(512, 35.6566);
-    file_size_distn.add(1024, 27.7271875);
-    file_size_distn.add(2*1024, 16.63503125);
-    //file_size_distn.add(4*1024, 106.82384375);
-    //file_size_distn.add(8*1024, 81.493375);
-    //file_size_distn.add(16*1024, 14.13553125);
-    //file_size_distn.add(32*1024, 2.176);
-    //file_size_distn.add(256*1024, 0.655938);
-    //file_size_distn.add(512*1024, 0.1480625);
-    //file_size_distn.add(1*1024*1024, 0.020125); // actually 2, but 32bit
-    file_size_distn.normalize();
-  }
-  
-  // clear
-  for (int i=0; i<10; i++)
-    age_objects[i].clear();
-  
-  uint64_t wrote = 0;
-
-  for (int c=1; c<=count; c++) {
-    if (ceph_clock_now(cct) > until) break;
-    
-    //if (c == 7) start_debug = true;
-    
-    generic_dout(1) << "#age " << c << "/" << count << " filling to " << high_water << dendl;
-    uint64_t w = age_fill(high_water, until);
-    //dout(1) << "age wrote " << w << dendl;
-    wrote += w;
-    //store->sync();
-    //store->_get_frag_stat(st);
-    //pfrag(st);
-
-
-    if (c == count) {
-      generic_dout(1) << "#age final empty to " << final_water << dendl;
-      age_empty(final_water);    
-    } else {
-      generic_dout(1) << "#age " << c << "/" << count << " emptying to " << low_water << dendl;
-      age_empty(low_water);
-    }
-    //store->sync();
-    //store->sync();
-
-    // show frag state
-    /*store->_get_frag_stat(st);
-    pfrag(wrote / (1024ULL*1024ULL) ,  // GB
-    st);*/
-
-    // dump freelist?
-    /*
-    if (ceph_clock_now(cct) > nextfl) {
-      elapsed += freelist_inc;
-      save_freelist(elapsed);
-      nextfl.sec_ref() += freelist_inc;
-    }
-    */
-  }
-
-  // dump the freelist
-  //save_freelist(0);
-  exit(0);   // hack
-
-  // ok!
-  store->sync();
-  store->sync();
-  generic_dout(1) << "age finished" << dendl;
-}  
diff --git a/src/osd/Ager.h b/src/osd/Ager.h
deleted file mode 100644 (file)
index face0a6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-#ifndef CEPH_AGER_H
-#define CEPH_AGER_H
-
-#include "include/types.h"
-#include "include/Distribution.h"
-#include "os/ObjectStore.h"
-#include "common/Clock.h"
-#include "common/ceph_context.h"
-
-#include <list>
-#include <vector>
-using namespace std;
-
-class Ager {
-  CephContext *cct;
-  ObjectStore *store;
-
- private:
-  list<file_object_t>           age_free_oids;
-  file_object_t                 age_cur_oid;
-  vector< list<file_object_t> > age_objects;
-  Distribution file_size_distn; //kb
-  bool         did_distn;
-
-  void age_empty(float pc);
-  uint64_t age_fill(float pc, utime_t until);
-  ssize_t age_pick_size();
-  file_object_t age_get_oid();
-
- public:
-  Ager(CephContext *cct_, ObjectStore *s) : cct(cct_), store(s), did_distn(false) {}
-
-  void age(int time,
-           float high_water,    // fill to this %
-          float low_water,     // then empty to this %
-          int count,         // this many times
-          float final_water,   // and end here ( <= low_water)
-          int fake_size_mb=0);
-};
-
-#endif
index 7998d4d4ea3b32f36245f0afbaefc6b5125c573e..002f1e1903dadbc71195b64db9745761431976cd 100644 (file)
@@ -16,7 +16,6 @@ libosd_la_SOURCES = \
        osd/ECMsgTypes.cc \
        osd/ECTransaction.cc \
        osd/PGBackend.cc \
-       osd/Ager.cc \
        osd/HitSet.cc \
        osd/OSD.cc \
        osd/OSDCap.cc \
@@ -38,7 +37,6 @@ endif
 noinst_LTLIBRARIES += libosd.la
 
 noinst_HEADERS += \
-       osd/Ager.h \
        osd/ClassHandler.h \
        osd/HitSet.h \
        osd/OSD.h \
index 3d22a7ab8686ae58a61eedb19ce15daf6694af2c..66c1c100fe3bd625ece539999c99bffb5a34f044 100644 (file)
@@ -48,8 +48,6 @@
 
 #include "ReplicatedPG.h"
 
-#include "Ager.h"
-
 
 #include "msg/Messenger.h"
 #include "msg/Message.h"
@@ -1309,19 +1307,6 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
       goto free_store;
     }
 
-    // age?
-    if (cct->_conf->osd_age_time != 0) {
-      if (cct->_conf->osd_age_time >= 0) {
-        dout(0) << "aging..." << dendl;
-        Ager ager(cct, store);
-        ager.age(cct->_conf->osd_age_time,
-          cct->_conf->osd_age,
-          cct->_conf->osd_age - .05,
-          50000,
-          cct->_conf->osd_age - .05);
-      }
-    }
-
     OSDSuperblock sb;
     bufferlist sbbl;
     ret = store->read(META_COLL, OSD_SUPERBLOCK_POBJECT, 0, 0, sbbl);