Assists clients in choosing layout parameters.
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
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 */
/**
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;
+}
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);
+}