*** empty log message ***

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@363 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sage 2005-06-29 06:36:41 +00:00
parent 07fc14bb49
commit 157bf90e1f
5 changed files with 57 additions and 29 deletions

View File

@ -1,5 +1,5 @@
# mpicxx must be on your path; on Szilard, this means that
# mpicxx must be on your path; on Szilard and googoo, this means that
# /usr/local/mpich2-1.0.2/bin must be on your path.
# For now, use g++ most of the time.
@ -8,10 +8,10 @@
# This makes it less annoying to build on non-mpi hosts for dev work, and seems to
# behave just fine... change ${CC} back to mpicxx if you get paranoid.
CC = g++
CFLAGS = -pg -g -I. -D_FILE_OFFSET_BITS=64 -DMPICH_IGNORE_CXX_SEEK -D_REENTRANT -D_THREAD_SAFE
CFLAGS = -g -I. -D_FILE_OFFSET_BITS=64 -DMPICH_IGNORE_CXX_SEEK -D_REENTRANT -D_THREAD_SAFE
LIBS = -lpthread -lrt
#for normal machines
#for normal mpich2 machines
MPICC = mpicxx
MPICFLAGS = ${CFLAGS}
MPILIBS = ${LIBS}
@ -102,7 +102,7 @@ obfstest: tcpsyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OS
${MPICC} -DUSE_OBFS ${MPICFLAGS} ${MPILIBS} $^ -o $@ ../uofs/uofs.a
fakesyn: fakesyn.cc mds/allmds.o client/Client.o client/SyntheticClient.o osd/OSD.o msg/FakeMessenger.o ${COMMON_OBJS}
${CC} ${CFLAGS} ${LIBS} $^ -o $@
${CC} -pg ${CFLAGS} ${LIBS} $^ -o $@
fakefuse: fakefuse.cc mds/allmds.o client/Client.o osd/OSD.o client/fuse.o msg/FakeMessenger.cc ${COMMON_OBJS}
${CC} -pg ${CFLAGS} ${LIBS} -lfuse $^ -o $@

View File

@ -16,6 +16,7 @@
class Buffercache;
class Bufferhead : public LRUObject {
// reference counting
int ref;
int get() {

View File

@ -65,11 +65,11 @@ Client::~Client()
void Client::tear_down_cache()
{
// fh's
for (map<fileh_t, Fh*>::iterator it = fh_map.begin();
for (hash_map<fileh_t, Fh*>::iterator it = fh_map.begin();
it != fh_map.end();
it++) {
Fh *fh = it->second;
dout(3) << "forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << endl;
dout(1) << "tear_down_cache forcing close of fh " << it->first << " ino " << fh->inode->inode.ino << endl;
put_inode(fh->inode);
delete fh;
}
@ -121,7 +121,7 @@ void Client::dump_cache()
if (root) dump_inode(root, did);
for (map<inodeno_t, Inode*>::iterator it = inode_map.begin();
for (hash_map<inodeno_t, Inode*>::iterator it = inode_map.begin();
it != inode_map.end();
it++) {
if (did.count(it->second)) continue;

View File

@ -149,12 +149,12 @@ class Client : public Dispatcher {
Filer *filer; // (non-blocking) osd interface
// cache
map<inodeno_t, Inode*> inode_map;
hash_map<inodeno_t, Inode*> inode_map;
Inode* root;
LRU lru; // lru list of Dentry's in our local metadata cache.
// file handles
map<fileh_t, Fh*> fh_map;
hash_map<fileh_t, Fh*> fh_map;
// global (client) lock
Mutex client_lock;

View File

@ -20,16 +20,21 @@ using namespace __gnu_cxx;
class bufferlist {
private:
/* local state limited to _buffers, and _len.
* we maintain _len ourselves, so we must be careful when fiddling with buffers!
*/
list<bufferptr> _buffers;
int _len;
public:
// cons/des
bufferlist() {
bufferlist() : _len(0) {
bdbout(1) << "bufferlist.cons " << this << endl;
}
bufferlist(bufferlist& bl) {
bufferlist(bufferlist& bl) : _len(0) {
bdbout(1) << "bufferlist.cons " << this << endl;
_buffers = bl._buffers;
_len = bl._len;
}
~bufferlist() {
bdbout(1) << "bufferlist.des " << this << endl;
@ -40,17 +45,6 @@ class bufferlist {
}
*/
// sort-of-like-assignment-op
void claim(bufferlist& bl) {
// free my buffers
_buffers.clear();
claim_append(bl);
}
void claim_append(bufferlist& bl) {
// steal the other guy's buffers
_buffers.splice( _buffers.end(), bl._buffers );
}
// accessors
list<bufferptr>& buffers() {
return _buffers;
@ -59,13 +53,18 @@ class bufferlist {
//list<buffer*>::iterator end() { return _buffers.end(); }
int length() {
int len = 0;
for (list<bufferptr>::iterator it = _buffers.begin();
it != _buffers.end();
it++) {
len += (*it).length();
#if 0
{ // DEBUG: verify _len
int len = 0;
for (list<bufferptr>::iterator it = _buffers.begin();
it != _buffers.end();
it++) {
len += (*it).length();
}
assert(len == _len);
}
return len;
#endif
return _len;
}
void _rope(crope& r) {
@ -78,22 +77,44 @@ class bufferlist {
// modifiers
void clear() {
_buffers.clear();
_len = 0;
}
void push_front(bufferptr& bp) {
_buffers.push_front(bp);
_len += bp.length();
}
void push_front(buffer *b) {
bufferptr bp(b);
_buffers.push_front(bp);
_len += bp.length();
}
void push_back(bufferptr& bp) {
_buffers.push_back(bp);
_len += bp.length();
}
void push_back(buffer *b) {
bufferptr bp(b);
_buffers.push_back(bp);
_len += bp.length();
}
// sort-of-like-assignment-op
void claim(bufferlist& bl) {
// free my buffers
clear();
claim_append(bl);
}
void claim_append(bufferlist& bl) {
// steal the other guy's buffers
_len += bl._len;
_buffers.splice( _buffers.end(), bl._buffers );
bl._len = 0;
}
// crope lookalikes
void copy(int off, int len, char *dest) {
@ -193,6 +214,7 @@ class bufferlist {
memcpy(_buffers.back().c_str() + blen, data, avail);
blen += avail;
_buffers.back().set_length(blen);
_len += avail;
data += avail;
len -= avail;
}
@ -246,7 +268,7 @@ class bufferlist {
void substr_of(bufferlist& other, int off, int len) {
_buffers.clear();
clear();
// skip off
list<bufferptr>::iterator curbuf = other._buffers.begin();
@ -269,6 +291,7 @@ class bufferlist {
if (off + len < (*curbuf).length()) {
//cout << "copying partial of " << *curbuf << endl;
_buffers.push_back( bufferptr( *curbuf, len, off ) );
_len += len;
break;
}
@ -276,6 +299,7 @@ class bufferlist {
//cout << "copying end (all?) of " << *curbuf << endl;
int howmuch = (*curbuf).length() - off;
_buffers.push_back( bufferptr( *curbuf, howmuch, off ) );
_len += howmuch;
len -= howmuch;
off = 0;
curbuf++;
@ -305,6 +329,7 @@ class bufferlist {
// insert it before curbuf (which we'll hose)
//cout << "keeping front " << off << " of " << *curbuf << endl;
_buffers.insert( curbuf, bufferptr( *curbuf, off, 0 ) );
_len += off;
}
while (len > 0) {
@ -315,6 +340,7 @@ class bufferlist {
claim_by->append( *curbuf, len, off );
(*curbuf).set_offset( off + len + (*curbuf).offset() ); // ignore beginning big
(*curbuf).set_length( (*curbuf).length() - len - off );
_len -= off+len;
//cout << " now " << *curbuf << endl;
break;
}
@ -324,6 +350,7 @@ class bufferlist {
//cout << "discarding " << howmuch << " of " << *curbuf << endl;
if (claim_by)
claim_by->append( *curbuf, howmuch, off );
_len -= (*curbuf).length();
_buffers.erase( curbuf++ );
len -= howmuch;
off = 0;