From 5e547487446eff30c32c6d0704143e088e051e1c Mon Sep 17 00:00:00 2001 From: sage Date: Fri, 28 Apr 2006 23:36:16 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@750 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/osdc/Filer.h | 86 +++++++++++++++++----------------------- ceph/osdc/ObjectCacher.h | 21 +++++----- 2 files changed, 47 insertions(+), 60 deletions(-) diff --git a/ceph/osdc/Filer.h b/ceph/osdc/Filer.h index f31e46b4505..d94fdbac17d 100644 --- a/ceph/osdc/Filer.h +++ b/ceph/osdc/Filer.h @@ -49,7 +49,7 @@ class ObjectCacher; /**** Filer interface ***/ -class Filer { //: public Dispatcher { +class Filer { Objecter *objecter; ObjectCacher *oc; @@ -67,13 +67,16 @@ class Filer { //: public Dispatcher { off_t offset, bufferlist *bl, // ptr to data Context *onfinish) { - Objecter::OSDRead *rd = prepare_read(inode, len, offset, bl); - if (oc == 0) { + Objecter::OSDRead *rd = new Objecter::OSDRead(bl); + file_to_extents(inode, len, offset, rd->extents); + + // cacheless async? + if (oc == 0) return objecter->readx(rd, onfinish); - } else { - // use cache - return 0; - } + + // write me + + return 0; } int write(inode_t& inode, @@ -83,13 +86,16 @@ class Filer { //: public Dispatcher { int flags, Context *onack, Context *oncommit) { - Objecter::OSDWrite *wr = prepare_write(inode, len, offset, bl); - if (oc == 0) { + Objecter::OSDWrite *wr = new Objecter::OSDWrite(bl); + file_to_extents(inode, len, offset, wr->extents); + + // cacheles async? + if (oc == 0) return objecter->writex(wr, onack, oncommit); - } else { - // use cache - return 0; - } + + // write me + + return 0; } int zero(inode_t& inode, @@ -97,22 +103,29 @@ class Filer { //: public Dispatcher { off_t offset, Context *onack, Context *oncommit) { - Objecter::OSDZero *z = prepare_zero(inode, len, offset); - if (oc == 0) { + Objecter::OSDZero *z = new Objecter::OSDZero; + file_to_extents(inode, len, offset, z->extents); + + // cacheless async? + if (oc == 0) return objecter->zerox(z, onack, oncommit); - } else { - // mds should never do this, and clients don't do zero(). - assert(0); - return 0; - } + + // actually: mds should never do this, and clients don't do zero(). + assert(0); + return 0; } + /*** sync+blocking file interface ***/ int atomic_sync_read(inode_t& inode, size_t len, off_t offset, bufferlist& bl) { + assert(oc); + + // write me + return 0; } @@ -120,6 +133,10 @@ class Filer { //: public Dispatcher { size_t len, off_t offset, bufferlist& bl, Context *oncommit) { + assert(oc); + + // write me + return 0; } @@ -148,35 +165,6 @@ class Filer { //: public Dispatcher { off_t offset, list& extents); - Objecter::OSDRead* - prepare_read(inode_t& inode, - size_t len, - off_t offset, - bufferlist *bl) { // result goes here - Objecter::OSDRead *rd = new Objecter::OSDRead(bl); - file_to_extents(inode, len, offset, rd->extents); - return rd; - } - - Objecter::OSDWrite* - prepare_write(inode_t& inode, - size_t len, - off_t offset, - bufferlist& bl) { - Objecter::OSDWrite *wr = new Objecter::OSDWrite(bl); - file_to_extents(inode, len, offset, wr->extents); - return wr; - } - - Objecter::OSDZero* - prepare_zero(inode_t& inode, - size_t len, - off_t offset) { - Objecter::OSDZero *z = new Objecter::OSDZero; - file_to_extents(inode, len, offset, z->extents); - return z; - } - }; diff --git a/ceph/osdc/ObjectCacher.h b/ceph/osdc/ObjectCacher.h index 4cdc2504175..6d6918f6f8d 100644 --- a/ceph/osdc/ObjectCacher.h +++ b/ceph/osdc/ObjectCacher.h @@ -49,18 +49,17 @@ class ObjectCacher { }; - -// sync write (relaxed consistency, bypass cache) -Filer->prepare_write(); -Objecter->writex(...); // make async call -cond.Wait(); // wait for ack - +/* // sync write (correct) -Filer->prepare_write(); -ObjectCache->atomic_sync_writex(...); // blocks until sync write happens, or i get write locks +Filer->atomic_sync_write(); + map + ObjectCache->atomic_sync_writex(...); // blocks until sync write happens, or i get write locks // async write -Filer->prepare_write(); -ObjectCache->writex(...); // non-blocking. update cache. +Filer->write(); + map + ObjectCache->writex(...); // non-blocking. update cache. or -Objecter->writex(...); // non-blocking. don't update cache. + map + Objecter->writex(...); // non-blocking. no cache. (MDS) +*/