From 0f80865cbbbad2e913f31661c49855f0915669cb Mon Sep 17 00:00:00 2001 From: sage Date: Wed, 29 Jun 2005 02:29:01 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@361 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 17 +++-------------- ceph/config.cc | 3 +++ ceph/include/buffer.h | 7 +++++-- ceph/include/bufferlist.h | 4 ++-- ceph/msg/FakeMessenger.cc | 6 ++++-- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index 5931de444ac8c..f0e5ac19f0096 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -8,7 +8,7 @@ # 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 = -g -I. -D_FILE_OFFSET_BITS=64 -DMPICH_IGNORE_CXX_SEEK -D_REENTRANT -D_THREAD_SAFE +CFLAGS = -pg -g -I. -D_FILE_OFFSET_BITS=64 -DMPICH_IGNORE_CXX_SEEK -D_REENTRANT -D_THREAD_SAFE LIBS = -lpthread -lrt #for normal machines @@ -51,19 +51,8 @@ COMMON_OBJS= \ common/Timer.o\ config.o -OBFS_OBJS= \ - obfs/uofs_mem.o\ - obfs/uofs_disk_io.o\ - obfs/uofs_alloc.o\ - obfs/uofs_mapping.o\ - obfs/uofs_cache.o\ - obfs/uofs_onode.o\ - obfs/uofs_rw.o\ - obfs/uofs_stat.o\ - obfs/uofs.o - TEST_TARGETS = fakemds mpitest -TARGETS = import singleclient mpifuse fakefuse mpisyn +TARGETS = import singleclient mpifuse fakefuse mpisyn fakesyn tcpsyn SRCS=*.cc */*.cc @@ -113,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} -pg ${CFLAGS} ${LIBS} $^ -o $@ + ${CC} ${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 $@ diff --git a/ceph/config.cc b/ceph/config.cc index b6a11920ef761..5ad7ac1e869a3 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -155,6 +155,9 @@ void parse_config_options(int argc, char **argv, else if (strcmp(argv[i], "--log_name") == 0) g_conf.log_name = argv[++i]; + else if (strcmp(argv[i], "--fakemessenger_serialize") == 0) + g_conf.fakemessenger_serialize = atoi(argv[++i]); + else if (strcmp(argv[i], "--mds_cache_size") == 0) g_conf.mds_cache_size = atoi(argv[++i]); diff --git a/ceph/include/buffer.h b/ceph/include/buffer.h index 583b5a9820e3a..1b952555b4f35 100644 --- a/ceph/include/buffer.h +++ b/ceph/include/buffer.h @@ -197,8 +197,7 @@ class bufferptr { // assignment operator bufferptr& operator=(const bufferptr& other) { // discard old - if (_buffer && _buffer->_put() == 0) - delete _buffer; + discard_buffer(); // new _buffer = other._buffer; @@ -208,6 +207,10 @@ class bufferptr { } ~bufferptr() { + discard_buffer(); + } + + void discard_buffer() { if (_buffer) { bufferlock.Lock(); if (_buffer->_put() == 0) diff --git a/ceph/include/bufferlist.h b/ceph/include/bufferlist.h index 0ff2801fe5335..5035c5eb30bec 100644 --- a/ceph/include/bufferlist.h +++ b/ceph/include/bufferlist.h @@ -202,8 +202,8 @@ class bufferlist { // just add another buffer. // alloc a bit extra, in case we do a bunch of appends. FIXME be smarter! - if (alen < 128) alen = 128; - push_back(new buffer(data, len, BUFFER_MODE_DEFAULT, alen)); + if (alen < 1024) alen = 1024; + push_back(new buffer(data, len, BUFFER_MODE_DEFAULT, len+alen)); } void append(bufferptr& bp) { push_back(bp); diff --git a/ceph/msg/FakeMessenger.cc b/ceph/msg/FakeMessenger.cc index 02ea99cc8db0f..985b790789487 100644 --- a/ceph/msg/FakeMessenger.cc +++ b/ceph/msg/FakeMessenger.cc @@ -158,14 +158,16 @@ int fakemessenger_do_loop_2() m->reset_payload(); m->encode_payload(); msg_envelope_t env = m->get_envelope(); - bufferlist bl = m->get_payload(); + bufferlist bl; + bl.claim( m->get_payload() ); + bl.c_str(); // condense into 1 buffer delete m; // decode m = decode_message(env, bl); assert(m); - } + } didone = true; -- 2.39.5