]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephfs: expose stripe unit granularity
authorNoah Watkins <noahwatkins@gmail.com>
Fri, 4 Jan 2013 22:57:20 +0000 (14:57 -0800)
committerNoah Watkins <noahwatkins@gmail.com>
Sat, 5 Jan 2013 19:08:31 +0000 (11:08 -0800)
Assists clients in choosing layout parameters.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
src/include/cephfs/libcephfs.h
src/libcephfs.cc
src/test/libcephfs/test.cc

index 7e5afb9b985081a1732ddf79b80cbc32a4858304..fa58694f108288b414e47f9e939f18177144a7a4 100644 (file)
@@ -878,6 +878,13 @@ int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh);
 int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fd, loff_t offset,
                                 struct sockaddr_storage *addr, int naddr);
 
+/**
+ * Get the file layout stripe unit granularity.
+ * @param cmount the ceph mount handle.
+ * @returns the stripe unit granularity.
+ */
+int ceph_get_stripe_unit_granularity(struct ceph_mount_info *cmount);
+
 /** @} filelayout */
 
 /**
index 6323918eadf3352a2570c79f29cd3878dbefae68..e3f54508013ca032808593dd943197eebcf0552f 100644 (file)
@@ -833,3 +833,10 @@ extern "C" int ceph_debug_get_file_caps(struct ceph_mount_info *cmount, const ch
     return -ENOTCONN;
   return cmount->get_client()->get_caps_issued(path);
 }
+
+extern "C" int ceph_get_stripe_unit_granularity(struct ceph_mount_info *cmount)
+{
+  if (!cmount->is_mounted())
+    return -ENOTCONN;
+  return CEPH_MIN_STRIPE_UNIT;
+}
index f576fefd16447e4c34957fed6d0382a8d89217ee..e03a898df72c0d942708624dc61a678763552424 100644 (file)
@@ -803,3 +803,12 @@ TEST(LibCephFS, ReadEmptyFile) {
   ceph_close(cmount, fd);
   ceph_shutdown(cmount);
 }
+
+TEST(LibCephFS, StripeUnitGran) {
+  struct ceph_mount_info *cmount;
+  ASSERT_EQ(ceph_create(&cmount, NULL), 0);
+  ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
+  ASSERT_EQ(ceph_mount(cmount, NULL), 0);
+  ASSERT_GT(ceph_get_stripe_unit_granularity(cmount), 0);
+  ceph_shutdown(cmount);
+}