*** empty log message ***

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@750 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sage 2006-04-28 23:36:16 +00:00
parent 917ba4673a
commit 5e54748744
2 changed files with 47 additions and 60 deletions

View File

@ -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<ObjectExtent>& 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;
}
};

View File

@ -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)
*/