]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Modified Files:
authorcarlosm <carlosm@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 12 Jul 2005 22:24:53 +0000 (22:24 +0000)
committercarlosm <carlosm@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 12 Jul 2005 22:24:53 +0000 (22:24 +0000)
  client/Buffercache.cc client/Client.cc

Fixed bug in map_existing that listed unnecessary holes

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@455 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/client/Buffercache.cc
ceph/client/Client.cc

index f9ff6906a33d7826b1e0f23e76cb2d1121493b67..21f0c51696a6166782f327a4ee794a56b6b221b6 100644 (file)
@@ -29,6 +29,7 @@ Bufferhead::~Bufferhead()
   assert(lru_is_expireable());
   assert(read_waiters.empty());
   assert(write_waiters.empty());
+  assert(!fc->buffer_map.count(offset));
   bc->lru.lru_remove(this);   
   // debug segmentation fault
   if (bl.buffers().empty()) {
@@ -271,9 +272,9 @@ Filecache::map_existing(size_t len,
     }
     need_off = actual_off + bh->bl.length();
   }
-  if (need_off < actual_off + len) {
-    holes[need_off] = (size_t) (actual_off + len - need_off);
-    dout(10) << "bc: map: hole " << need_off << " " << holes[need_off] << endl;
+  if (need_off < start_off + len) {
+    holes[need_off] = (size_t) (start_off + len - need_off);
+    dout(10) << "bc: map: last hole " << need_off << " " << holes[need_off] << endl;
   }
   return rvalue;
 }
@@ -441,17 +442,15 @@ void Buffercache::release_file(inodeno_t ino)
   dout(7) << "bc: release_file ino: " << ino << endl;
   assert(bcache_map.count(ino));
   Filecache *fc = bcache_map[ino];
-  for (map<off_t, Bufferhead*>::iterator it = fc->buffer_map.begin();
-       it != fc->buffer_map.end();
+  map<off_t, Bufferhead*> to_release = fc->buffer_map;
+  fc->buffer_map.clear();
+  for (map<off_t, Bufferhead*>::iterator it = to_release.begin();
+       it != to_release.end();
        it++) {
-
     decrease_size(it->second->bl.length());
-
     dout(6) << "bc: release_file: clean_size: " << get_clean_size() << " dirty_size: " << get_dirty_size() << " rx_size: " << get_rx_size() << " tx_size: " << get_tx_size() << " age: " << dirty_buffers.get_age() << endl;
-    assert(clean_size >= 0);
     delete it->second;    
   }
-  fc->buffer_map.clear();
   bcache_map.erase(ino);
   delete fc;  
 }
index 02c464926940cc39a76fc5b84d6f4947173c52e8..8e115f3180718f7dbda575e093d52c86b4da6979 100644 (file)
@@ -1371,6 +1371,7 @@ int Client::read(fileh_t fh, char *buf, size_t size, off_t offset)
          assert(rvalue > 0);
          dout(7) << "read bc hit: immediately returning " << rvalue << " bytes" << endl;
        }
+        assert(!(rvalue == size) || holes.empty());
        // issue reads for holes
        int hole_rvalue = 0; //FIXME: don't really need to track rvalue in MissFinish context
        for (hole = holes.begin(); hole != holes.end(); hole++) {