]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 6 Sep 2006 04:26:31 +0000 (04:26 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Wed, 6 Sep 2006 04:26:31 +0000 (04:26 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@845 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/ebofs/Ebofs.cc
ceph/osd/Ager.cc

index 948133ee134ed4699be66e21751f1184f39cc639..fd15e1912452ed9debeb04d4f1bd966434f3c8ad 100644 (file)
@@ -2771,7 +2771,8 @@ void Ebofs::_get_frag_stat(FragmentationStat& st)
   st.total_free = get_free_blocks() + get_limbo_blocks();
   st.free_extent_dist.clear();
   st.num_free_extent = 0;
-
+  st.avg_free_extent = 0;
+/*
   __uint64_t tfree = 0;
   for (int b=0; b<=EBOFS_NUM_FREE_BUCKETS; b++) {
        Table<block_t,block_t> *tab;
@@ -2805,7 +2806,7 @@ void Ebofs::_get_frag_stat(FragmentationStat& st)
        }
   }
   st.avg_free_extent = tfree / st.num_free_extent;
-
+*/
 
   // used extents is harder.  :(
   st.num_extent = 0;
@@ -2819,7 +2820,7 @@ void Ebofs::_get_frag_stat(FragmentationStat& st)
   object_tab->find(0, cursor);
   int nobj = 0;
   int njump = 0;
-  while (1) {
+  while (object_tab->get_num_keys() > 0) {
        Onode *on = get_onode(cursor.current().key);
        assert(on);
 
index e4a1506c5ba034073f9aa45bd9a6e0ef3800e0a7..151104a0a43f45bc232fc7a522de772b71d9e865 100644 (file)
@@ -53,14 +53,20 @@ __uint64_t Ager::age_fill(float pc, utime_t until) {
        
        struct statfs st;
        store->statfs(&st);
-       float a = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);
+       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 << endl;
-       if (a >= pc) {
-         dout(2) << "age_fill at " << a << " / " << pc << " stopping" << endl;
+       if (free >= pc) {
+         dout(2) << "age_fill at " << free << " / " << avail << " / " << " / " << pc << " stopping" << endl;
          break;
        }
-       
+
+       // make sure we can write to it..
+       if (avail > .98 ||
+               avail - free > .02) 
+         store->sync();
+
        object_t oid = age_get_oid();
        
        int b = myrand() % 10;
@@ -68,8 +74,11 @@ __uint64_t Ager::age_fill(float pc, utime_t until) {
        
        ssize_t s = age_pick_size();
        wrote += (s + 4095) / 4096;
-       
-       dout(2) << "age_fill at " << a << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
+
+
+
+
+       dout(2) << "age_fill at " << free << " / " << avail << " / " << pc << " creating " << hex << oid << dec << " sz " << s << endl;
        
 
        if (false && !g_conf.ebofs_verify && start_debug && wrote > 1000000ULL) { 
@@ -117,10 +126,11 @@ void Ager::age_empty(float pc) {
   while (1) {
        struct statfs st;
        store->statfs(&st);
-       float a = 1.0 - ((float)(st.f_bavail) / (float)st.f_blocks);
-       dout(2) << "age_empty at " << a << " / " << pc << endl;//" stopping" << endl;
-       if (a <= pc) {
-         dout(2) << "age_empty at " << a << " / " << pc << " stopping" << endl;
+       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
+       dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << endl;//" stopping" << endl;
+       if (free <= pc) {
+         dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " stopping" << endl;
          break;
        }
        
@@ -129,14 +139,14 @@ void Ager::age_empty(float pc) {
        if (n == 0 || age_objects[b].empty()) {
          dout(2) << "age_empty sync" << endl;
          //sync();
-         sync();
+         //sync();
          n = nper;
          continue;
        }
        object_t oid = age_objects[b].front();
        age_objects[b].pop_front();
        
-       dout(2) << "age_empty at " << a << " / " << pc << " removing " << hex << oid << dec << endl;
+       dout(2) << "age_empty at " << free << " / " << avail << " / " << pc << " removing " << hex << oid << dec << endl;
        
        store->remove(oid);
        age_free_oids.push_back(oid);