]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
java: add support for get_stripe_unit_granularity
authorJoe Buck <jbbuck@gmail.com>
Sat, 5 Jan 2013 01:33:26 +0000 (17:33 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Sat, 5 Jan 2013 19:08:31 +0000 (11:08 -0800)
Signed-off-by: Joe Buck <jbbuck@gmail.com>
Reviewed-by: Noah Watkins <noahwatkins@gmail.com>
src/java/java/com/ceph/fs/CephMount.java
src/java/native/libcephfs_jni.cc

index 752b69907038a24bf682da59ddd25dc5542a9596..1ad54996865fa4c08f5c407a47e81a400e846eb1 100644 (file)
@@ -664,4 +664,15 @@ public class CephMount {
   }
 
   private static synchronized native int native_ceph_localize_reads(long mountp, boolean on);
+
+  /**
+   * Pull the stripe unit granularity from the underlying ceph installation.
+   *
+   * @return all block sizes must be a (non-zero) multiple of this value.
+   */
+  public int get_stripe_unit_granularity() { 
+    return native_ceph_get_stripe_unit_granularity(instance_ptr);
+  }
+  
+  private static synchronized native int native_ceph_get_stripe_unit_granularity(long mountp);
 }
index f0313c8febdf6bc3950d30f14bb8452d38041f49..025be2bc639a651ed3733ce0569c7cd901f25bbf 100644 (file)
@@ -2408,3 +2408,31 @@ JNIEXPORT jint JNICALL Java_com_ceph_fs_CephMount_native_1ceph_1localize_1reads
 
        return ret;
 }
+
+/*
+ * Class:     com_ceph_fs_CephMount
+ * Method:    native_ceph_get_stripe_unit_granularity
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_com_ceph_fs_CephMount_native_1ceph_1get_1stripe_1unit_1granularity
+       (JNIEnv *env, jclass clz, jlong j_mntp)
+{
+       struct ceph_mount_info *cmount = get_ceph_mount(j_mntp);
+       CephContext *cct = ceph_get_mount_context(cmount);
+       int ret;
+
+       CHECK_MOUNTED(cmount, -1);
+
+       ldout(cct, 10) << "jni: get_stripe_unit_granularity" << dendl;
+
+       ret = ceph_get_stripe_unit_granularity(cmount);
+
+       ldout(cct, 10) << "jni: get_stripe_unit_granularity: exit ret " << ret << dendl;
+
+  if (ret < 0)
+    handle_error(env, ret);
+
+       return ret;
+}
+
+