]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Hadoop: Sets default block sizes according to a config property;
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 3 Sep 2009 22:12:06 +0000 (15:12 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Fri, 4 Sep 2009 21:29:55 +0000 (14:29 -0700)
defaults to 64MB

src/client/hadoop/CephFSInterface.cc
src/client/hadoop/CephFSInterface.h
src/client/hadoop/ceph/CephFileSystem.java
src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h

index 2986625d98cdf41f154116577830b0738e994987..4e208b6b9d2401627f3abdb4af11041d3c8bb93a 100644 (file)
@@ -14,10 +14,10 @@ static int path_size;
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;I)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *env, jobject obj, jstring j_args )
+  (JNIEnv *env, jobject obj, jstring j_args, jint block_size)
 {
   dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
   const char *c_args = env->GetStringUTFChars(j_args, 0);
@@ -54,6 +54,9 @@ JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1i
   env->ReleaseStringUTFChars(j_args, c_args);
   delete argv;
 
+  ceph_set_default_file_stripe_unit(block_size);
+  ceph_set_default_object_size(block_size);
+
   if (r < 0) return false;
   r = ceph_mount();
   if (r < 0) return false;
index 21d18c17e1fe1500ca6caabc0e897e97fbc7bdc3..8ae918dfa0db6f83e2fb3e8578fec6d99cd03667 100644 (file)
@@ -17,10 +17,10 @@ extern "C" {
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;I)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject, jstring);
+  (JNIEnv *, jobject, jstring, jint);
 
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
index b18030d8eaf9a8f92a119178742d28aa80537c2d..b0b8b49bdf55b601db2259bf7511fa387c368bfa 100644 (file)
@@ -61,7 +61,7 @@ public class CephFileSystem extends FileSystem {
   private static String monAddr;
   private static String fs_default_name;
   
-  private native boolean ceph_initializeClient(String arguments);
+  private native boolean ceph_initializeClient(String arguments, int block_size);
   private native String  ceph_getcwd();
   private native boolean ceph_setcwd(String path);
   private native boolean ceph_rmdir(String path);
@@ -150,7 +150,8 @@ public class CephFileSystem extends FileSystem {
        throw new IOException("You must specify a Ceph monitor address or config file!");
       }
       //  Initialize the client
-      if (!ceph_initializeClient(arguments)) {
+      if (!ceph_initializeClient(arguments,
+                                conf.getInt("fs.ceph.blockSize", 1<<26))) {
        debug("Ceph initialization failed!");
        throw new IOException("Ceph initialization failed!");
       }
@@ -774,7 +775,7 @@ public class CephFileSystem extends FileSystem {
    */
   @Override
   public long getDefaultBlockSize() {
-    return ceph_getblocksize("/");
+    return getConf().getInt("fs.ceph.blockSize", 1<<26);
   }
 
   // Makes a Path absolute. In a cheap, dirty hack, we're
index 2ebf2916d65876f090eaa1c76e432e5c68028ced..40f8d29f4aea90dd0da89440d715697170bf9e74 100644 (file)
@@ -7,17 +7,15 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#undef org_apache_hadoop_fs_ceph_CephFileSystem_DEFAULT_BLOCK_SIZE
-#define org_apache_hadoop_fs_ceph_CephFileSystem_DEFAULT_BLOCK_SIZE 4194304LL
 #undef org_apache_hadoop_fs_ceph_CephFileSystem_EEXIST
 #define org_apache_hadoop_fs_ceph_CephFileSystem_EEXIST 17L
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem
  * Method:    ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;I)Z
  */
 JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
-  (JNIEnv *, jobject, jstring);
+  (JNIEnv *, jobject, jstring, jint);
 
 /*
  * Class:     org_apache_hadoop_fs_ceph_CephFileSystem