From 697ed23cb96b4e64d7a1be130de118d89c5eec15 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 5 Dec 2012 22:03:34 -0800 Subject: [PATCH] client: remove set_default_*() methods This is a poor interface. The hadoop stuff is shifting to specify this information on file creation instead. Signed-off-by: Sage Weil --- src/client/Client.cc | 44 ++++------------------------------ src/client/Client.h | 9 ------- src/include/cephfs/libcephfs.h | 44 ++-------------------------------- src/libcephfs.cc | 24 +++++++------------ 4 files changed, 15 insertions(+), 106 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index d876454f0f4be..362099d9cec35 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -149,10 +149,6 @@ Client::Client(Messenger *m, MonClient *mc) initialized(false), mounted(false), unmounting(false), local_osd(-1), local_osd_epoch(0), unsafe_sync_write(0), - file_stripe_unit(0), - file_stripe_count(0), - object_size(0), - file_replication(0), client_lock("Client::client_lock") { monclient->set_messenger(m); @@ -5163,8 +5159,7 @@ int Client::open(const char *relpath, int flags, mode_t mode, int stripe_unit, int Client::open(const char *relpath, int flags, mode_t mode) { /* Use default file striping parameters */ - return open(relpath, flags, mode, file_stripe_unit, file_stripe_count, - object_size, NULL); + return open(relpath, flags, mode, 0, 0, 0, NULL); } int Client::lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name) @@ -6661,7 +6656,6 @@ int Client::_create(Inode *dir, const char *name, int flags, mode_t mode, Inode req->head.args.open.stripe_unit = stripe_unit; req->head.args.open.stripe_count = stripe_count; req->head.args.open.object_size = object_size; - req->head.args.open.file_replication = file_replication; req->dentry_drop = CEPH_CAP_FILE_SHARED; req->dentry_unless = CEPH_CAP_FILE_EXCL; @@ -6682,11 +6676,10 @@ int Client::_create(Inode *dir, const char *name, int flags, mode_t mode, Inode trim_cache(); ldout(cct, 3) << "create(" << path << ", 0" << oct << mode << dec - << " layout " << file_stripe_unit - << ' ' << file_stripe_count - << ' ' << object_size - << ' ' << file_replication - <<") = " << res << dendl; + << " layout " << stripe_unit + << ' ' << stripe_count + << ' ' << object_size + <<") = " << res << dendl; return res; fail: @@ -7227,33 +7220,6 @@ int Client::ll_release(Fh *fh) // ========================================= // layout -// default layout - -void Client::set_default_file_stripe_unit(int stripe_unit) -{ - if (stripe_unit > 0) - file_stripe_unit = stripe_unit; -} - -void Client::set_default_file_stripe_count(int count) -{ - if (count > 0) - file_stripe_count = count; -} - -void Client::set_default_object_size(int size) -{ - if (size > 0) - object_size = size; -} - -void Client::set_default_file_replication(int replication) -{ - if (replication >= 0) - file_replication = replication; -} - - // expose file layouts int Client::describe_layout(int fd, ceph_file_layout *lp) diff --git a/src/client/Client.h b/src/client/Client.h index 9512a2d8861d3..125e194a9f4ab 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -273,10 +273,6 @@ public: int unsafe_sync_write; - int file_stripe_unit; - int file_stripe_count; - int object_size; - int file_replication; public: entity_name_t get_myname() { return messenger->get_myname(); } void sync_write_commit(Inode *in); @@ -659,11 +655,6 @@ public: int get_local_osd(); int get_pool_replication(int64_t pool); - void set_default_file_stripe_unit(int stripe_unit); - void set_default_file_stripe_count(int count); - void set_default_object_size(int size); - void set_default_file_replication(int replication); - int enumerate_layout(int fd, vector& result, loff_t length, loff_t offset); diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index 9cf66049d4d6d..adeea248dd2e3 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -867,53 +867,13 @@ int ceph_get_file_stripe_address(struct ceph_mount_info *cmount, int fd, loff_t /** @} filelayout */ /** - * @defgroup libcephfs_h_default_filelayout Control the Default File Layout. - * Functions for setting and getting the default file layout for new files. - * - * @{ - */ - -/** - * Set the default stripe unit of files created in this mount. - * - * @param cmount the ceph mount handle to use. - * @param stripe the stripe size to use - * @returns 0 on success or a negative error code on failure. + * No longer available. Do not use. + * These functions will return -EOPNOTSUPP. */ int ceph_set_default_file_stripe_unit(struct ceph_mount_info *cmount, int stripe); - -/** - * Set the default stripe count of files created in this mount. - * - * @param cmount the ceph mount handle to use. - * @param count the stripe count to use - * @returns 0 on success or a negative error code on failure. - */ int ceph_set_default_file_stripe_count(struct ceph_mount_info *cmount, int count); - -/** - * Set the default object size to use for striping. - * - * @param cmount the ceph mount handle to use. - * @param size the default size for objects - * @returns 0 on success or a negative error code on failure - */ int ceph_set_default_object_size(struct ceph_mount_info *cmount, int size); - -/** - * No longer available. Do not use. - * Set the default preferred placement group. This option will return - * -EOPNOTSUPP as it is no longer supported. - */ int ceph_set_default_preferred_pg(struct ceph_mount_info *cmount, int osd); - -/** - * Set the default file replication factor. - * - * @param cmount the ceph mount handle to use. - * @param replication the default replication factor for files in this filesystem. - * @returns 0 on success or negative error code on failure. - */ int ceph_set_default_file_replication(struct ceph_mount_info *cmount, int replication); /** diff --git a/src/libcephfs.cc b/src/libcephfs.cc index c33f6284afcd3..d085f846265b8 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -722,36 +722,28 @@ extern "C" int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh) extern "C" int ceph_set_default_file_stripe_unit(struct ceph_mount_info *cmount, int stripe) { - if (!cmount->is_mounted()) - return -ENOTCONN; - cmount->get_client()->set_default_file_stripe_unit(stripe); - return 0; + // this option no longer exists + return -EOPNOTSUPP; } extern "C" int ceph_set_default_file_stripe_count(struct ceph_mount_info *cmount, int count) { - if (!cmount->is_mounted()) - return -ENOTCONN; - cmount->get_client()->set_default_file_stripe_unit(count); - return 0; + // this option no longer exists + return -EOPNOTSUPP; } extern "C" int ceph_set_default_object_size(struct ceph_mount_info *cmount, int size) { - if (!cmount->is_mounted()) - return -ENOTCONN; - cmount->get_client()->set_default_object_size(size); - return 0; + // this option no longer exists + return -EOPNOTSUPP; } extern "C" int ceph_set_default_file_replication(struct ceph_mount_info *cmount, int replication) { - if (!cmount->is_mounted()) - return -ENOTCONN; - cmount->get_client()->set_default_file_replication(replication); - return 0; + // this option no longer exists + return -EOPNOTSUPP; } extern "C" int ceph_set_default_preferred_pg(struct ceph_mount_info *cmount, int osd) -- 2.39.5