]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fuse_ll seems to be in good shape
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 10 Aug 2007 17:53:03 +0000 (17:53 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Fri, 10 Aug 2007 17:53:03 +0000 (17:53 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1618 29311d96-e01e-0410-9327-a35deaab8ce9

branches/sage/mds/client/Client.cc
branches/sage/mds/client/Client.h
branches/sage/mds/client/fuse_ll.cc
branches/sage/mds/common/Logger.cc
branches/sage/mds/config.cc
branches/sage/mds/fakefuse.cc
branches/sage/mds/include/lru.h
branches/sage/mds/mon/MonitorStore.cc

index 887e3be1f2705e02a52b333ed7f78483079d8496..9512a8cc509002523ea6ad3514732c516206a309 100644 (file)
@@ -261,7 +261,8 @@ void Client::trim_cache()
   }
 
   // hose root?
-  if (lru.lru_get_size() == 0 && root && inode_map.size() == 1) {
+  if (lru.lru_get_size() == 0 && root && root->ref == 0 && inode_map.size() == 1) {
+    dout(15) << "trim_cache trimmed root " << root << endl;
     delete root;
     root = 0;
     inode_map.clear();
@@ -422,13 +423,14 @@ Inode* Client::insert_trace(MClientReply *reply)
       if (!root) {
         // create
         cur = root = new Inode((*pin)->inode, objectcacher);
+       dout(10) << "insert_trace new root is " << root << endl;
         inode_map[root->inode.ino] = root;
       }
     } else {
       // not root.
-      dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << endl;
       Dir *dir = cur->open_dir();
       cur = this->insert_inode(dir, *pin, *pdn);
+      dout(10) << "insert_trace dn " << *pdn << " ino " << (*pin)->inode.ino << " -> " << cur << endl;
       ++pdn;      
 
       // move to top of lru!
@@ -1361,6 +1363,11 @@ int Client::mount()
          << " and mdsmap " << mdsmap->get_epoch() 
          << endl;
 
+  // get+pin root inode
+  Inode *root;
+  _do_lstat("/", STAT_MASK_ALL, &root);
+  _ll_get(root);
+
   client_lock.Unlock();
 
   /*
@@ -1391,7 +1398,13 @@ int Client::unmount()
 
   // NOTE: i'm assuming all caches are already flushing (because all files are closed).
   assert(fd_map.empty());
+
+  dout(10) << "a" << endl;
+
+  _ll_drop_pins();
   
+  dout(10) << "b" << endl;
+
   // empty lru cache
   lru.lru_set_max(0);
   trim_cache();
@@ -1419,14 +1432,14 @@ int Client::unmount()
          !inode_map.empty()) {
     dout(2) << "cache still has " << lru.lru_get_size() 
             << "+" << inode_map.size() << " items" 
-            << ", waiting (presumably for safe or for caps to be released?)"
+           << ", waiting (for caps to release?)"
             << endl;
     dump_cache();
     mount_cond.Wait(client_lock);
   }
   assert(lru.lru_get_size() == 0);
   assert(inode_map.empty());
-  
+
   // unsafe writes
   if (!g_conf.client_oc) {
     while (unsafe_sync_write > 0) {
@@ -1435,6 +1448,8 @@ int Client::unmount()
       mount_cond.Wait(client_lock);
     }
   }
+
   
   // send session closes!
   for (map<int,version_t>::iterator p = mds_sessions.begin();
@@ -1805,7 +1820,7 @@ int Client::_do_lstat(const char *path, int mask, Inode **in)
 
 int Client::fill_stat(Inode *in, struct stat *st) 
 {
-  dout(10) << "fill_stat on " << in->inode.ino << " mode " << oct << in->inode.mode << dec
+  dout(10) << "fill_stat on " << in->inode.ino << " mode 0" << oct << in->inode.mode << dec
           << " mtime " << in->inode.mtime << " ctime " << in->inode.ctime << endl;
   memset(st, 0, sizeof(struct stat));
   st->st_ino = in->inode.ino;
@@ -1853,7 +1868,7 @@ int Client::_lstat(const char *path, struct stat *stbuf)
   if (res == 0) {
     assert(in);
     fill_stat(in, stbuf);
-    dout(10) << "stat sez size = " << in->inode.size << " mode = " << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << endl;
+    dout(10) << "stat sez size = " << in->inode.size << " mode = 0" << oct << stbuf->st_mode << dec << " ino = " << stbuf->st_ino << endl;
   }
 
   trim_cache();
@@ -1908,6 +1923,7 @@ int Client::chmod(const char *relpath, mode_t mode)
 
 int Client::_chmod(const char *path, mode_t mode) 
 {
+  dout(3) << "_chmod(" << path << ", 0" << oct << mode << dec << ")" << endl;
   tout << "chmod" << endl;
   tout << path << endl;
   tout << mode << endl;
@@ -1927,7 +1943,7 @@ int Client::_chmod(const char *path, mode_t mode)
   dout(10) << "chmod result is " << res << endl;
 
   trim_cache();
-  dout(3) << "chmod(\"" << path << "\", " << mode << ") = " << res << endl;
+  dout(3) << "chmod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
   return res;
 }
 
@@ -1941,6 +1957,7 @@ int Client::chown(const char *relpath, uid_t uid, gid_t gid)
 
 int Client::_chown(const char *path, uid_t uid, gid_t gid)
 {
+  dout(3) << "_chown(" << path << ", " << uid << ", " << gid << ")" << endl;
   tout << "chown" << endl;
   tout << path << endl;
   tout << uid << endl;
@@ -1973,12 +1990,13 @@ int Client::utime(const char *relpath, struct utimbuf *buf)
   Mutex::Locker lock(client_lock);
   string abspath;
   mkabspath(relpath, abspath);
-  return _utime(abspath.c_str(), utime_t(buf->modtime,0), utime_t(buf->actime,0));
+  return _utimes(abspath.c_str(), utime_t(buf->modtime,0), utime_t(buf->actime,0));
 }
 
-int Client::_utime(const char *path, utime_t mtime, utime_t atime)
+int Client::_utimes(const char *path, utime_t mtime, utime_t atime)
 {
-  tout << "utime" << endl;
+  dout(3) << "_utimes(" << path << ", " << mtime << ", " << atime << ")" << endl;
+  tout << "utimes" << endl;
   tout << path << endl;
   tout << mtime.sec() << endl;
   tout << atime.sec() << endl;
@@ -1997,7 +2015,7 @@ int Client::_utime(const char *path, utime_t mtime, utime_t atime)
   insert_trace(reply);  
   delete reply;
 
-  dout(3) << "utime(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << endl;
+  dout(3) << "utimes(\"" << path << "\", " << mtime << ", " << atime << ") = " << res << endl;
   trim_cache();
   return res;
 }
@@ -2014,6 +2032,7 @@ int Client::mknod(const char *relpath, mode_t mode, dev_t rdev)
 
 int Client::_mknod(const char *path, mode_t mode, dev_t rdev) 
 { 
+  dout(3) << "_mknod(" << path << ", 0" << oct << mode << dec << ", " << rdev << ")" << endl;
   tout << "mknod" << endl;
   tout << path << endl;
   tout << mode << endl;
@@ -2037,7 +2056,7 @@ int Client::_mknod(const char *path, mode_t mode, dev_t rdev)
 
   trim_cache();
 
-  dout(3) << "mknod(\"" << path << "\", " << mode << ") = " << res << endl;
+  dout(3) << "mknod(\"" << path << "\", 0" << oct << mode << dec << ") = " << res << endl;
   return res;
 }
 
@@ -2076,7 +2095,7 @@ int Client::opendir(const char *name, DIR **dirpp)
   if (dn && dn->inode) {
     dirp->inode = dn->inode;
     dirp->inode->get();
-    dout(10) << "had inode " << dn->inode->inode.ino << " ref now " << dn->inode->ref << endl;
+    dout(10) << "had inode " << dn->inode << " " << dn->inode->inode.ino << " ref now " << dn->inode->ref << endl;
     dirp->set_frag(dn->inode->dirfragtree[0]);
     dout(10) << "opendir " << name << ", our cache says the first dirfrag is " << dirp->frag() << endl;
   }
@@ -2085,7 +2104,7 @@ int Client::opendir(const char *name, DIR **dirpp)
   int r = _readdir_get_frag(dirp);
   if (r < 0) {
     dout(3) << "opendir " << name << " err = " << r << endl;
-    delete dirp;
+    _closedir(dirp);
   } else {
     // yay!
     *((DirResult**)dirpp) = dirp;
@@ -2169,11 +2188,13 @@ int Client::_readdir_get_frag(DirResult *dirp)
   if ((res == -EAGAIN || res == 0) &&
       inode_map.count(ino)) {
     diri = inode_map[ino];
+    dout(10) << "_readdir_get_frag got diri " << diri << " " << diri->inode.ino << endl;
     assert(diri);
     assert(diri->inode.mode & INODE_MODE_DIR);
   }
   
   if (!dirp->inode && diri) {
+    dout(10) << "_readdir_get_frag attaching inode" << endl;
     dirp->inode = inode_map[ino];
     diri->get();
   }
@@ -2320,17 +2341,21 @@ int Client::closedir(DIR *dir)
   Mutex::Locker lock(client_lock);
 
   dout(3) << "closedir(" << dir << ") = 0" << endl;
+  _closedir((DirResult*)dir);
+  return 0;
+}
 
-  DirResult *dirp = (DirResult*)dir;
+void Client::_closedir(DirResult *dirp)
+{
+  dout(10) << "_closedir(" << dirp << ")" << endl;
   if (dirp->inode) {
+    dout(10) << "_closedir detaching inode " << dirp->inode << endl;
     put_inode(dirp->inode);
     dirp->inode = 0;
   }
   delete dirp;
-  return 0;
 }
 
-
 void Client::rewinddir(DIR *dirp)
 {
   dout(3) << "rewinddir(" << dirp << ")" << endl;
@@ -3136,9 +3161,7 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
       dirp->buffer.clear();
     }
 
-    put_inode(diri);
-    dirp->inode = 0;
-    delete dirp;
+    _closedir(dirp);
   }
 
   // do we have it?
@@ -3146,7 +3169,7 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
       diri->dir->dentries.count(dname)) {
     Inode *in = diri->dir->dentries[dname]->inode;
     fill_stat(in, attr);
-    in->get();
+    _ll_get(in);
     dout(3) << "ll_lookup " << parent << " " << name << " -> " << in->inode.ino << endl;
     return 0;
   } else {
@@ -3154,6 +3177,34 @@ int Client::ll_lookup(inodeno_t parent, const char *name, struct stat *attr)
   }
 }
 
+void Client::_ll_get(Inode *in)
+{
+  if (in->ll_ref == 0) 
+    in->get();
+  in->ll_get();
+  dout(20) << "_ll_get " << in << " " << in->inode.ino << " -> " << in->ll_ref << endl;
+}
+
+void Client::_ll_put(Inode *in, int num)
+{
+  in->ll_put(num);
+  dout(20) << "_ll_put " << in << " " << in->inode.ino << " " << num << " -> " << in->ll_ref << endl;
+  if (in->ll_ref == 0) 
+    put_inode(in);
+}
+
+void Client::_ll_drop_pins()
+{
+  dout(10) << "_ll_drop_pins" << endl;
+  for (hash_map<inodeno_t, Inode*>::iterator it = inode_map.begin();
+       it != inode_map.end();
+       it++) {
+    Inode *in = it->second;
+    if (in->ll_ref)
+      _ll_put(in, in->ll_ref);
+  }
+}
+
 void Client::ll_forget(inodeno_t ino, int num)
 {
   Mutex::Locker lock(client_lock);
@@ -3167,7 +3218,7 @@ void Client::ll_forget(inodeno_t ino, int num)
   } else {
     Inode *in = inode_map[ino];
     assert(in);
-    put_inode(in, num);
+    _ll_put(in, num);
   }
 }
 
@@ -3185,19 +3236,19 @@ Inode *Client::_ll_get_inode(inodeno_t ino)
 }
 
 
-int Client::ll_getattr(inodeno_t ino, struct stat *st)
+int Client::ll_getattr(inodeno_t ino, struct stat *attr)
 {
   Mutex::Locker lock(client_lock);
   dout(3) << "ll_getattr " << ino << endl;
   Inode *in = _ll_get_inode(ino);
-  fill_stat(in, st);
+  fill_stat(in, attr);
   return 0;
 }
 
-int Client::ll_setattr(inodeno_t ino, struct stat *st, int mask)
+int Client::ll_setattr(inodeno_t ino, struct stat *attr, int mask)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_setattr " << ino << endl;
+  dout(3) << "ll_setattr " << ino << " mask " << hex << mask << dec << endl;
   Inode *in = _ll_get_inode(ino);
 
   string path;
@@ -3205,24 +3256,27 @@ int Client::ll_setattr(inodeno_t ino, struct stat *st, int mask)
 
   int r;
   if ((mask & FUSE_SET_ATTR_MODE) &&
-      (r = _chmod(path.c_str(), st->st_mode) < 0)) return r;
+      ((r = _chmod(path.c_str(), attr->st_mode)) < 0)) return r;
 
-  if ((mask & FUSE_SET_ATTR_UID) &&
-      (r = _chown(path.c_str(), st->st_uid, st->st_gid) < 0)) return r;
+  if ((mask & FUSE_SET_ATTR_UID) && (mask & FUSE_SET_ATTR_GID) &&
+      ((r = _chown(path.c_str(), attr->st_uid, attr->st_gid)) < 0)) return r;
   //if ((mask & FUSE_SET_ATTR_GID) &&
-  //(r = client->_chgrp(path.c_str(), st->st_gid) < 0)) return r;
+  //(r = client->_chgrp(path.c_str(), attr->st_gid) < 0)) return r;
 
   if ((mask & FUSE_SET_ATTR_SIZE) &&
-      (r = _truncate(path.c_str(), st->st_size) < 0)) return r;
+      ((r = _truncate(path.c_str(), attr->st_size)) < 0)) return r;
   
-  if ((mask & FUSE_SET_ATTR_MTIME) &&
-      (mask & FUSE_SET_ATTR_ATIME) &&
-      (r = _utime(path.c_str(), utime_t(st->st_mtime,0), utime_t(st->st_atime,0)) < 0)) return r;
-  else if ((mask & FUSE_SET_ATTR_MTIME) &&
-      (r = _utime(path.c_str(), utime_t(st->st_mtime,0), utime_t()) < 0)) return r;
-  else if ((mask & FUSE_SET_ATTR_ATIME) &&
-      (r = _utime(path.c_str(), utime_t(), utime_t(st->st_atime,0)) < 0)) return r;
+  if ((mask & FUSE_SET_ATTR_MTIME) && (mask & FUSE_SET_ATTR_ATIME)) {
+    if ((r = _utimes(path.c_str(), utime_t(attr->st_mtime,0), utime_t(attr->st_atime,0))) < 0) return r;
+  } else if (mask & FUSE_SET_ATTR_MTIME) {
+    if ((r = _utimes(path.c_str(), utime_t(attr->st_mtime,0), utime_t())) < 0) return r;
+  } else if (mask & FUSE_SET_ATTR_ATIME) {
+    if ((r = _utimes(path.c_str(), utime_t(), utime_t(attr->st_atime,0))) < 0) return r;
+  }
   
+  assert(r == 0);
+  fill_stat(in, attr);
+
   dout(3) << "ll_setattr " << ino << " = " << r << endl;
   return 0;
 }
@@ -3254,8 +3308,8 @@ int Client::ll_mknod(inodeno_t parent, const char *name, mode_t mode, dev_t rdev
   if (r == 0) {
     string dname(name);
     Inode *in = diri->dir->dentries[dname]->inode;
-    in->get();
     fill_stat(in, attr);
+    //_ll_get(in);
   }
   dout(3) << "ll_mknod " << parent << " " << name << " = " << r << endl;
   return r;
@@ -3275,8 +3329,8 @@ int Client::ll_mkdir(inodeno_t parent, const char *name, mode_t mode, struct sta
   if (r == 0) {
     string dname(name);
     Inode *in = diri->dir->dentries[dname]->inode;
-    in->get();
     fill_stat(in, attr);
+    //_ll_get(in);
   }
   dout(3) << "ll_mkdir " << parent << " " << name << " = " << r << endl;
   return r;
@@ -3296,8 +3350,8 @@ int Client::ll_symlink(inodeno_t parent, const char *name, const char *value, st
   if (r == 0) {
     string dname(name);
     Inode *in = diri->dir->dentries[dname]->inode;
-    in->get();
     fill_stat(in, attr);
+    //_ll_get(in);
   }
   return r;
 }
@@ -3368,8 +3422,8 @@ int Client::ll_link(inodeno_t ino, inodeno_t newparent, const char *newname, str
   if (r == 0) {
     string dname(newname);
     Inode *in = diri->dir->dentries[dname]->inode;
-    in->get();
     fill_stat(in, attr);
+    //_ll_get(in);
   }
   return r;
 }
@@ -3411,7 +3465,7 @@ int Client::ll_create(inodeno_t parent, const char *name, mode_t mode, int flags
                      struct stat *attr, Fh **fhp)
 {
   Mutex::Locker lock(client_lock);
-  dout(3) << "ll_create " << parent << " " << name << " " << mode << " " << flags << endl;
+  dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec << " " << flags << endl;
 
   Inode *pin = _ll_get_inode(parent);
   string path;
@@ -3421,10 +3475,11 @@ int Client::ll_create(inodeno_t parent, const char *name, mode_t mode, int flags
 
   int r = _open(path.c_str(), flags|O_CREAT, mode, fhp);
   if (r >= 0) {
-    (*fhp)->inode->get();  // this counts as a reference
-    fill_stat((*fhp)->inode, attr);
+    Inode *in = (*fhp)->inode;
+    fill_stat(in, attr);
+    //_ll_get(in);
   }
-  dout(3) << "ll_create " << parent << " " << name << " " << mode 
+  dout(3) << "ll_create " << parent << " " << name << " 0" << oct << mode << dec
          << " " << flags << " = " << r << " (" << *fhp << ")" << endl;
   return 0;
 }
index 70b79613aa3450dd33a17d87af846be0d668ce37..d787039ccadb8d8e4e5f7417b03cacea931f66e7 100644 (file)
@@ -138,6 +138,7 @@ class Inode {
   int       num_open_rd, num_open_wr, num_open_lazy;  // num readers, writers
 
   int       ref;      // ref count. 1 for each dentry, fh that links to me.
+  int       ll_ref;   // separate ref count for ll client
   Dir       *dir;     // if i'm a dir.
   Dentry    *dn;      // if i'm linked to a dentry.
   string    *symlink; // symlink content, if it's a symlink
@@ -170,11 +171,19 @@ class Inode {
 
   void get() { 
     ref++; 
-    //cout << "inode.get on " << hex << inode.ino << dec << " now " << ref << endl;
+    //cout << "inode.get on " << this << " " << hex << inode.ino << dec << " now " << ref << endl;
   }
   void put(int n=1) { 
     ref -= n; assert(ref >= 0); 
-    //cout << "inode.put on " << hex << inode.ino << dec << " now " << ref << endl;
+    //cout << "inode.put on " << this << " " << hex << inode.ino << dec << " now " << ref << endl;
+  }
+
+  void ll_get() {
+    ll_ref++;
+  }
+  void ll_put(int n=1) {
+    assert(ll_ref >= n);
+    ll_ref -= n;
   }
 
   Inode(inode_t _inode, ObjectCacher *_oc) : 
@@ -183,7 +192,8 @@ class Inode {
     dir_auth(-1), dir_hashed(false), dir_replicated(false), 
     file_wr_mtime(0, 0), file_wr_size(0), 
     num_open_rd(0), num_open_wr(0), num_open_lazy(0),
-    ref(0), dir(0), dn(0), symlink(0),
+    ref(0), ll_ref(0), 
+    dir(0), dn(0), symlink(0),
     fc(_oc, _inode),
     sync_reads(0), sync_writes(0),
     hack_balance_reads(false)
@@ -474,8 +484,10 @@ protected:
 
   // decrease inode ref.  delete if dangling.
   void put_inode(Inode *in, int n=1) {
+    //cout << "put_inode on " << in << " " << in->inode.ino << endl;
     in->put(n);
     if (in->ref == 0) {
+      //cout << "put_inode deleting " << in->inode.ino << endl;
       inode_map.erase(in->inode.ino);
       if (in == root) root = 0;
       delete in;
@@ -644,6 +656,10 @@ private:
   void _readdir_rechoose_frag(DirResult *dirp);
   int _readdir_get_frag(DirResult *dirp);
   void _readdir_fill_dirent(struct dirent *de, DirEntry *entry, off_t);
+  void _closedir(DirResult *dirp);
+  void _ll_get(Inode *in);
+  void _ll_put(Inode *in, int num);
+  void _ll_drop_pins();
 
   // internal interface
   //   call these with client_lock held!
@@ -657,7 +673,7 @@ private:
   int _lstat(const char *path, struct stat *stbuf);
   int _chmod(const char *relpath, mode_t mode);
   int _chown(const char *relpath, uid_t uid, gid_t gid);
-  int _utime(const char *relpath, utime_t mtime, utime_t atime);
+  int _utimes(const char *relpath, utime_t mtime, utime_t atime);
   int _mknod(const char *path, mode_t mode, dev_t rdev);
   int _open(const char *path, int flags, mode_t mode, Fh **fhp);
   int _release(Fh *fh);
index 869c899ced8b01961e7b4f339668af83a70418aa..1f21d6b5e0b5b216e0139776b48f50a5e3293d86 100644 (file)
@@ -293,7 +293,6 @@ static void ceph_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name,
   if (r == 0) {
     fi->fh = (long)fh;
     fe.ino = fe.attr.st_ino;
-    cout << "ino is " << fe.ino << endl;
     fuse_reply_create(req, &fe, fi);
   } else {
     fuse_reply_err(req, -r);
@@ -331,7 +330,7 @@ static struct fuse_lowlevel_ops ceph_ll_oper = {
  listxattr: 0,
  removexattr: 0,
  access: 0,
- create: 0, //ceph_ll_create,
+ create: ceph_ll_create,
  getlk: 0,
  setlk: 0,
  bmap: 0
index 61d1d595de106595f1db5fe004bf40fd18d90517..9ffab65074f1a4358b4fe116cd8e86306f89ff72 100644 (file)
@@ -39,7 +39,7 @@ Logger::Logger(string fn, LogType *type)
     if (g_conf.use_abspaths) {
       char *cwd = get_current_dir_name(); 
       filename = cwd;
-      delete cwd;
+      free(cwd);
       filename += "/";
     }
 
index 0e086e603fcabd1e408a9714a8d4f61e4187c173..630f34af4c3c353f85fd411781ef0fca6a67c26e 100644 (file)
@@ -160,7 +160,7 @@ md_config_t g_conf = {
 
   client_trace: 0,
   fuse_direct_io: 0,
-  fuse_ll: false,
+  fuse_ll: true,
   
   // --- objecter ---
   objecter_buffer_uncommitted: true,  // this must be true for proper failure handling
index a83e54ad75d543d3cdbf833194f5a1356ac7159f..d5c33c1cc11877496bb0ecdabf5ea93a6336e7a9 100644 (file)
@@ -138,6 +138,7 @@ int main(int argc, char **argv) {
     else
       ceph_fuse_main(client[i], argc, argv);
     ::chdir(oldcwd);                        // return to previous wd
+    free(oldcwd);
 
     client[i]->unmount();
     cout << "fuse finished on pid " << getpid() << endl;
index 9b3a563fc22e3caa0f58308c657548ddcea14751..cb8d08c58ae9c5f064bbb3959f446b53a50c06f8 100644 (file)
@@ -71,6 +71,12 @@ class LRUList {
     return tail;
   }
 
+  void clear() {
+    while (len > 0) {
+      remove(get_head());
+    }
+  }
+
   void insert_head(LRUObject *o) {
     o->lru_next = head;
     o->lru_prev = NULL;
@@ -143,6 +149,11 @@ class LRU {
   void lru_set_max(uint32_t m) { lru_max = m; }
   void lru_set_midpoint(float f) { lru_midpoint = f; }
   
+  void lru_clear() {
+    lru_top.clear();
+    lru_bot.clear();
+    lru_pintail.clear();
+  }
 
   // insert at top of lru
   void lru_insert_top(LRUObject *o) {
index d260dfd7604e4471d603d4b3af04f54dc71016e2..7f00bf83921df3f2abf547338264f17174c74ff7 100644 (file)
@@ -42,7 +42,7 @@ void MonitorStore::mount()
     string old = dir;
     char *cwd = get_current_dir_name();
     dir = cwd;
-    delete cwd;
+    free(cwd);
     dir += "/";
     dir += old;
   }