From: Greg Farnum Date: Thu, 3 Sep 2009 22:12:06 +0000 (-0700) Subject: Hadoop: Sets default block sizes according to a config property; X-Git-Tag: v0.14~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f11678015f0feb243d94f82f8895404eca0db65;p=ceph.git Hadoop: Sets default block sizes according to a config property; defaults to 64MB --- diff --git a/src/client/hadoop/CephFSInterface.cc b/src/client/hadoop/CephFSInterface.cc index 2986625d98c..4e208b6b9d2 100644 --- a/src/client/hadoop/CephFSInterface.cc +++ b/src/client/hadoop/CephFSInterface.cc @@ -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; diff --git a/src/client/hadoop/CephFSInterface.h b/src/client/hadoop/CephFSInterface.h index 21d18c17e1f..8ae918dfa0d 100644 --- a/src/client/hadoop/CephFSInterface.h +++ b/src/client/hadoop/CephFSInterface.h @@ -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 diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index b18030d8eaf..b0b8b49bdf5 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -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 diff --git a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h index 2ebf2916d65..40f8d29f4ae 100644 --- a/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h +++ b/src/client/hadoop/org_apache_hadoop_fs_ceph_CephFileSystem.h @@ -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