From 10db8156e16ffb43aa65abf2731009b4d7e12dca Mon Sep 17 00:00:00 2001
From: eestolan <eestolan@29311d96-e01e-0410-9327-a35deaab8ce9>
Date: Wed, 30 May 2007 23:03:25 +0000
Subject: [PATCH] git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1385
 29311d96-e01e-0410-9327-a35deaab8ce9

---
 trunk/ceph/Makefile                         | 14 ++++++++++++++
 trunk/ceph/client/Client.cc                 |  2 ++
 trunk/ceph/client/hadoop/CephFSInterface.cc | 17 ++++++++++++++++-
 trunk/ceph/config.cc                        |  2 +-
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/trunk/ceph/Makefile b/trunk/ceph/Makefile
index 6248f207959..ccc3b1eec94 100644
--- a/trunk/ceph/Makefile
+++ b/trunk/ceph/Makefile
@@ -136,6 +136,20 @@ csyn: csyn.cc client.o osdc.o msg/SimpleMessenger.o common.o
 cfuse: cfuse.cc client.o osdc.o client/fuse.o msg/SimpleMessenger.o common.o
 	${CC} ${CFLAGS} ${LIBS} -lfuse $^ -o $@
 
+activemaster: active/activemaster.cc client.o osdc.o msg/SimpleMessenger.o common.o
+	${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+activeslave: active/activeslave.cc client.o osdc.o msg/SimpleMessenger.o common.o
+	${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+echotestclient: active/echotestclient.cc client.o osdc.o msg/SimpleMessenger.o common.o
+	${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+msgtestclient: active/msgtestclient.cc client.o osdc.o msg/SimpleMessenger.o common.o
+	${CC} ${CFLAGS} ${LIBS} $^ -o $@
+
+
+
 
 # misc
 gprof-helper.so: test/gprof-helper.c
diff --git a/trunk/ceph/client/Client.cc b/trunk/ceph/client/Client.cc
index 3d022b294b2..12e95eeb142 100644
--- a/trunk/ceph/client/Client.cc
+++ b/trunk/ceph/client/Client.cc
@@ -2505,8 +2505,10 @@ void Client::lock_fh_pos(Fh *f)
   if (f->pos_locked || !f->pos_waiters.empty()) {
     Cond cond;
     f->pos_waiters.push_back(&cond);
+    dout(10) << "lock_fh_pos BLOCKING on " << f << endl;
     while (f->pos_locked || f->pos_waiters.front() != &cond)
       cond.Wait(client_lock);
+    dout(10) << "lock_fh_pos UNBLOCKING on " << f << endl;
     assert(f->pos_waiters.front() == &cond);
     f->pos_waiters.pop_front();
   }
diff --git a/trunk/ceph/client/hadoop/CephFSInterface.cc b/trunk/ceph/client/hadoop/CephFSInterface.cc
index 92cefa3f1c6..7aa8c133d37 100644
--- a/trunk/ceph/client/hadoop/CephFSInterface.cc
+++ b/trunk/ceph/client/hadoop/CephFSInterface.cc
@@ -345,16 +345,31 @@ JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1getb
   dout(10) << "In getblocksize" << endl;
 
   Client* client;
-  struct stat stbuf;
+  //struct stat stbuf;
   client = *(Client**)&clientp;
   
   jint result;
 
   const char* c_path = env->GetStringUTFChars(j_path, 0);
+
+  /*
   if (0 > client->lstat(c_path, &stbuf))
     result =  -1;
   else
     result = stbuf.st_blksize;
+  */
+
+  // we need to open the file to retrieve the stripe size
+  dout(10) << "CephFSInterface: getblocksize: opening file" << endl;
+  int fh = client->open(c_path, O_RDONLY);  
+  if (fh < 0)
+    return -1;
+
+  result = client->get_stripe_unit(fh);
+
+  int close_result = client->close(fh);
+  assert (close_result > -1);
+
 
   env->ReleaseStringUTFChars(j_path, c_path);
   return result;
diff --git a/trunk/ceph/config.cc b/trunk/ceph/config.cc
index 345f979be92..13842821a4f 100644
--- a/trunk/ceph/config.cc
+++ b/trunk/ceph/config.cc
@@ -34,7 +34,7 @@ Mutex bufferlock;
 Mutex _dout_lock;
 
 
-FileLayout g_OSD_FileLayout( 1<<23, 1, 1<<23, 2 );  // stripe over 8M objects, 2x replication
+FileLayout g_OSD_FileLayout( 1<<26, 1, 1<<26, 2 );  // stripe over 64M objects, 2x replication
 FileLayout g_OSD_MDDirLayout( 1<<23, 1, 1<<23, 2 );  // 8M objects, 2x replication.  (a lie)
 FileLayout g_OSD_MDLogLayout( 1<<20, 1, 1<<20, 2 );  // 1M objects, 2x replication