]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
objectcacher: use trimtrunc read/write ops
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 12 Feb 2010 22:32:11 +0000 (14:32 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Sat, 13 Feb 2010 00:03:47 +0000 (16:03 -0800)
src/client/Client.cc
src/osdc/ObjectCacher.cc

index ec4c070b8ca72878dc24356c900e8ffdb37b8b98..fdbe7b4e1874ca7c78c55bd4e0e2ff9dea28ded0 100644 (file)
@@ -357,6 +357,7 @@ void Client::update_inode_file_bits(Inode *in,
       dout(10) << "truncate_seq " << in->truncate_seq << " -> "
               << truncate_seq << dendl;
       in->truncate_seq = truncate_seq;
+      in->oset.truncate_seq = truncate_seq;
     }
   }
   if (truncate_seq >= in->truncate_seq &&
@@ -364,6 +365,7 @@ void Client::update_inode_file_bits(Inode *in,
     dout(10) << "truncate_size " << in->truncate_size << " -> "
             << truncate_size << dendl;
     in->truncate_size = truncate_size;
+    in->oset.truncate_size = truncate_size;
   }
   
   // be careful with size, mtime, atime
index 4e6c4df63fd0ba5a8662be5ec02933c728b7f4ea..52f1067597370e8d8a1de2425e498c78f313f1bd 100644 (file)
@@ -434,10 +434,13 @@ void ObjectCacher::bh_read(BufferHead *bh)
   // finisher
   C_ReadFinish *onfinish = new C_ReadFinish(this, bh->ob->get_soid(), bh->start(), bh->length());
 
+  ObjectSet *oset = bh->ob->oset;
+
   // go
-  objecter->read(bh->ob->get_oid(), bh->ob->get_layout(), 
+  objecter->read_trunc(bh->ob->get_oid(), bh->ob->get_layout(), 
                 bh->start(), bh->length(), bh->ob->get_snap(),
                 &onfinish->bl, 0,
+                oset->truncate_size, oset->truncate_seq,
                 onfinish);
 }
 
@@ -525,10 +528,13 @@ void ObjectCacher::bh_write(BufferHead *bh)
   C_WriteAck *onack = new C_WriteAck(this, bh->ob->get_soid(), bh->start(), bh->length());
   C_WriteCommit *oncommit = new C_WriteCommit(this, bh->ob->get_soid(), bh->start(), bh->length());
 
+  ObjectSet *oset = bh->ob->oset;
+
   // go
-  tid_t tid = objecter->write(bh->ob->get_oid(), bh->ob->get_layout(),
+  tid_t tid = objecter->write_trunc(bh->ob->get_oid(), bh->ob->get_layout(),
                              bh->start(), bh->length(),
                              bh->snapc, bh->bl, bh->last_write, 0,
+                             oset->truncate_size, oset->truncate_seq,
                              onack, oncommit);
 
   // set bh last_write_tid
@@ -537,7 +543,7 @@ void ObjectCacher::bh_write(BufferHead *bh)
   bh->ob->last_write_tid = tid;
   bh->last_write_tid = tid;
   if (commit_set_callback)
-    bh->ob->oset->uncommitted.push_back(&bh->ob->uncommitted_item);
+    oset->uncommitted.push_back(&bh->ob->uncommitted_item);
 
   mark_tx(bh);
 }
@@ -1085,9 +1091,10 @@ int ObjectCacher::atomic_sync_readx(OSDRead *rd, ObjectSet *oset, Mutex& lock)
     Mutex flock("ObjectCacher::atomic_sync_readx flock 1");
     Cond cond;
     bool done = false;
-    objecter->read(rd->extents[0].oid, rd->extents[0].layout, 
+    objecter->read_trunc(rd->extents[0].oid, rd->extents[0].layout, 
                   rd->extents[0].offset, rd->extents[0].length,
                   rd->snap, rd->bl, 0,
+                  oset->truncate_size, oset->truncate_seq,
                   new C_SafeCond(&flock, &cond, &done));
 
     // block
@@ -1165,7 +1172,8 @@ int ObjectCacher::atomic_sync_writex(OSDWrite *wr, ObjectSet *oset, Mutex& lock)
       Mutex flock("ObjectCacher::atomic_sync_writex flock");
       Cond cond;
       bool done = false;
-      objecter->sg_write(wr->extents, wr->snapc, wr->bl, wr->mtime, 0, 
+      objecter->sg_write_trunc(wr->extents, wr->snapc, wr->bl, wr->mtime, 0,
+                        oset->truncate_size, oset->truncate_seq,
                         new C_SafeCond(&flock, &cond, &done), 0);
       
       // block