]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 26 Dec 2005 00:15:53 +0000 (00:15 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 26 Dec 2005 00:15:53 +0000 (00:15 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@545 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/ebofs/BlockDevice.h
ceph/ebofs/BufferCache.cc
ceph/ebofs/Cnode.h
ceph/ebofs/Ebofs.cc
ceph/ebofs/mkfs.ebofs.cc

index e3aca9d279bf307850b72d9ca16fcf0ad121ccbd..32a67630abf7d835bf57a14fce6fc18a91c8571f 100644 (file)
@@ -102,6 +102,8 @@ class BlockDevice {
   // get size in blocks
   block_t get_num_blocks();
 
+  char *get_device_name() const { return dev; }
+
   int open();
   int close();
 
index e1cfabd381e86f0d00c9e31c069fc7a175aaa01a..7604b589c7f011e1c7b7916d85bb15aef31e9be6 100644 (file)
@@ -415,9 +415,12 @@ int ObjectCache::map_write(Onode *on,
                }
          }
          
+         // try to cancel tx?
+         if (bh->is_tx() && !newalloc) bc->bh_cancel_write(bh);
+                 
          // put in our map
          hits[cur] = bh;
-                 
+
          // keep going.
          block_t lenfromcur = bh->end() - cur;
          cur += lenfromcur;
index 43b448fe3e8c028ee7ff2fa8dcdefa3cafdae863..d19fa5ed86977bed08cba60f27cc3a3cfbbc2acc 100644 (file)
@@ -77,7 +77,7 @@ inline ostream& operator<<(ostream& out, Cnode& cn)
 {
   out << "cnode(" << hex << cn.coll_id << dec;
   if (cn.is_dirty()) out << " dirty";
-  out << " " << &cn;
+  //out << " " << &cn;
   out << ")";
   return out;
 }
index 305c484ed2379635bf3331401a3540b2946530a2..7a3631767d2cee7b48ee16e5657ac4eac7d3220d 100644 (file)
@@ -14,7 +14,7 @@ int Ebofs::mount()
   // note: this will fail in mount -> unmount -> mount type situations, bc
   //       prior state isn't fully cleaned up.
 
-  dout(1) << "mount" << endl;
+  dout(1) << "mount " << dev.get_device_name() << endl;
 
   ebofs_lock.Lock();
   assert(!mounted);
@@ -72,7 +72,7 @@ int Ebofs::mount()
   commit_thread.create();
   finisher_thread.create();
 
-  dout(1) << "mount mounted" << endl;
+  dout(1) << "mount mounted " << dev.get_device_name() << endl;
   mounted = true;
 
   ebofs_lock.Unlock();
@@ -216,7 +216,7 @@ int Ebofs::umount()
   close_tables();
   dev.close();
 
-  dout(1) << "umount done" << endl;
+  dout(1) << "umount done on " << dev.get_device_name() << endl;
   ebofs_lock.Unlock();
   return 0;
 }
@@ -423,7 +423,7 @@ Onode* Ebofs::new_onode(object_t oid)
 
   assert(onode_map.count(oid) == 0);
   onode_map[oid] = on;
-  onode_lru.lru_insert_mid(on);
+  onode_lru.lru_insert_top(on);
   
   assert(object_tab->lookup(oid) < 0);
   object_tab->insert( oid, on->onode_loc );  // even tho i'm not placed yet
@@ -464,12 +464,12 @@ Onode* Ebofs::get_onode(object_t oid)
          // yep, just wait.
          Cond c;
          waitfor_onode[oid].push_back(&c);
-         dout(7) << "get_onode " << oid << " already loading, waiting" << endl;
+         dout(10) << "get_onode " << oid << " already loading, waiting" << endl;
          c.Wait(ebofs_lock);
          continue;
        }
 
-       dout(7) << "get_onode reading " << hex << oid << dec << " from " << onode_loc << endl;
+       dout(10) << "get_onode reading " << hex << oid << dec << " from " << onode_loc << endl;
 
        assert(waitfor_onode.count(oid) == 0);
        waitfor_onode[oid].clear();  // this should be empty initially. 
@@ -485,6 +485,7 @@ Onode* Ebofs::get_onode(object_t oid)
        // parse data block
        Onode *on = new Onode(oid);
        onode_map[oid] = on;
+       onode_lru.lru_insert_top(on);
        
        struct ebofs_onode *eo = (struct ebofs_onode*)bl.c_str();
        assert(eo->object_id == oid);
@@ -501,7 +502,7 @@ Onode* Ebofs::get_onode(object_t oid)
          p += sizeof(len);
          on->attr[key] = AttrVal(p, len);
          p += len;
-         dout(7) << "get_onode " << *on  << " attr " << key << " len " << len << endl;
+         dout(10) << "get_onode " << *on  << " attr " << key << " len " << len << endl;
        }
        
        // parse extents
@@ -510,7 +511,7 @@ Onode* Ebofs::get_onode(object_t oid)
        for (int i=0; i<eo->num_extents; i++) {
          Extent ex = *((Extent*)p);
          on->extents.push_back(ex);
-         dout(7) << "get_onode " << *on  << " ex " << i << ": " << ex << endl;
+         dout(10) << "get_onode " << *on  << " ex " << i << ": " << ex << endl;
          n += ex.length;
          p += sizeof(Extent);
        }
@@ -562,7 +563,7 @@ void Ebofs::write_onode(Onode *on)
        object_tab->insert( on->object_id, on->onode_loc );
   }
 
-  dout(7) << "write_onode " << *on << " to " << on->onode_loc << endl;
+  dout(10) << "write_onode " << *on << " to " << on->onode_loc << endl;
 
   struct ebofs_onode *eo = (struct ebofs_onode*)bl.c_str();
   eo->onode_loc = on->onode_loc;
@@ -583,14 +584,14 @@ void Ebofs::write_onode(Onode *on)
        off += sizeof(int);
        bl.copy_in(off, i->second.len, i->second.data);
        off += i->second.len;
-       dout(7) << "write_onode " << *on  << " attr " << i->first << " len " << i->second.len << endl;
+       dout(10) << "write_onode " << *on  << " attr " << i->first << " len " << i->second.len << endl;
   }
   
   // extents
   for (unsigned i=0; i<on->extents.size(); i++) {
        bl.copy_in(off, sizeof(Extent), (char*)&on->extents[i]);
        off += sizeof(Extent);
-       dout(7) << "write_onode " << *on  << " ex " << i << ": " << on->extents[i] << endl;
+       dout(10) << "write_onode " << *on  << " ex " << i << ": " << on->extents[i] << endl;
   }
 
   // write
@@ -743,7 +744,7 @@ Cnode* Ebofs::new_cnode(object_t cid)
 
   assert(cnode_map.count(cid) == 0);
   cnode_map[cid] = cn;
-  cnode_lru.lru_insert_mid(cn);
+  cnode_lru.lru_insert_top(cn);
   
   assert(collection_tab->lookup(cid) < 0);
   collection_tab->insert( cid, cn->cnode_loc );  // even tho i'm not placed yet
@@ -785,7 +786,7 @@ Cnode* Ebofs::get_cnode(object_t cid)
          continue;
        }
 
-       dout(7) << "get_cnode reading " << hex << cid << dec << " from " << cnode_loc << endl;
+       dout(10) << "get_cnode reading " << hex << cid << dec << " from " << cnode_loc << endl;
 
        assert(waitfor_cnode.count(cid) == 0);
        waitfor_cnode[cid].clear();  // this should be empty initially. 
@@ -800,7 +801,9 @@ Cnode* Ebofs::get_cnode(object_t cid)
 
        // parse data block
        Cnode *cn = new Cnode(cid);
+
        cnode_map[cid] = cn;
+       cnode_lru.lru_insert_top(cn);
        
        struct ebofs_cnode *ec = (struct ebofs_cnode*)bl.c_str();
        cn->cnode_loc = ec->cnode_loc;
@@ -814,7 +817,7 @@ Cnode* Ebofs::get_cnode(object_t cid)
          p += sizeof(len);
          cn->attr[key] = AttrVal(p, len);
          p += len;
-         dout(7) << "get_cnode " << *cn  << " attr " << key << " len " << len << endl;
+         dout(10) << "get_cnode " << *cn  << " attr " << key << " len " << len << endl;
        }
        
        // wake up other waiters
@@ -848,7 +851,7 @@ void Ebofs::write_cnode(Cnode *cn)
        collection_tab->insert( cn->coll_id, cn->cnode_loc );
   }
   
-  dout(7) << "write_cnode " << *cn << " to " << cn->cnode_loc << endl;
+  dout(10) << "write_cnode " << *cn << " to " << cn->cnode_loc << endl;
 
   struct ebofs_cnode ec;
   ec.cnode_loc = cn->cnode_loc;
@@ -869,7 +872,7 @@ void Ebofs::write_cnode(Cnode *cn)
        bl.copy_in(off, i->second.len, i->second.data);
        off += i->second.len;
 
-       dout(7) << "write_cnode " << *cn  << " attr " << i->first << " len " << i->second.len << endl;
+       dout(10) << "write_cnode " << *cn  << " attr " << i->first << " len " << i->second.len << endl;
   }
   
   // write
index 46752e20985b321c0bf8ca786a6b4a95f2c4f8e2..075b1e856e6e5c6c22339a5b1eb5d7231e2f6d4f 100644 (file)
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
   int r = mfs.mkfs();
   if (r < 0) exit(r);
 
-  if (1) {
+  if (args.size() > 1) {   // pass an extra arg of some sort to trigger the test crapola
        // test-o-rama!
        Ebofs fs(filename);
        fs.mount();