From: Igor Fedotov Date: Fri, 9 Sep 2016 16:42:43 +0000 (+0300) Subject: os/ObjectStore: extend OS interface with set_collection_opts method. X-Git-Tag: v11.1.0~539^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9276df193b8309f2a5316e0ca44aa1382ec4217b;p=ceph.git os/ObjectStore: extend OS interface with set_collection_opts method. Signed-off-by: Igor Fedotov --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 10b513755df0..2eb52b0cd612 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1973,6 +1973,16 @@ public: virtual bool exists(CollectionHandle& c, const ghobject_t& oid) { return exists(c->get_cid(), oid); } + /** + * set_collection_opts -- set pool options for a collectioninformation for an object + * + * @param cid collection + * @param opts new collection options + * @returns 0 on success, negative error code on failure. + */ + virtual int set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) = 0; /** * stat -- get information for an object @@ -2327,6 +2337,7 @@ public: */ virtual uint64_t estimate_objects_overhead(uint64_t num_objects) = 0; + // DEBUG virtual void inject_data_error(const ghobject_t &oid) {} virtual void inject_mdata_error(const ghobject_t &oid) {} diff --git a/src/os/Transaction.cc b/src/os/Transaction.cc index 16b60671347f..aa3136fcebab 100644 --- a/src/os/Transaction.cc +++ b/src/os/Transaction.cc @@ -241,7 +241,6 @@ void ObjectStore::Transaction::_build_actions_from_tbl() create_collection(cid, 0); } break; - case Transaction::OP_COLL_HINT: { coll_t cid; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 68f74d87bd9c..439163effc81 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4822,6 +4822,21 @@ int BlueStore::stat( } return r; } +int BlueStore::set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) +{ + CollectionHandle ch = _get_collection(cid); + if (!ch) + return -ENOENT; + Collection *c = static_cast(ch.get()); + dout(15) << __func__ << " " << cid << " " + << " options " << opts << dendl; + RWLock::WLocker l(c->lock); + + c->pool_opts = opts; + return 0; +} int BlueStore::read( const coll_t& cid, @@ -8811,4 +8826,7 @@ int BlueStore::_split_collection(TransContext *txc, return r; } + + + // =========================================== diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index acdb8e17b91b..5d780fb4ba1a 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1017,6 +1017,9 @@ public: // contention. OnodeSpace onode_map; + //pool options + pool_opts_t pool_opts; + OnodeRef get_onode(const ghobject_t& oid, bool create); // the terminology is confusing here, sorry! @@ -1621,6 +1624,9 @@ public: bool exists(const coll_t& cid, const ghobject_t& oid) override; bool exists(CollectionHandle &c, const ghobject_t& oid) override; + int set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) override; int stat( const coll_t& cid, const ghobject_t& oid, diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 96a45da06764..94e2fba0fc1e 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -3069,6 +3069,13 @@ int FileStore::stat( } } +int FileStore::set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) +{ + return -EOPNOTSUPP; +} + int FileStore::read( const coll_t& _cid, const ghobject_t& oid, diff --git a/src/os/filestore/FileStore.h b/src/os/filestore/FileStore.h index d0c75463b196..9d453630b1af 100644 --- a/src/os/filestore/FileStore.h +++ b/src/os/filestore/FileStore.h @@ -559,6 +559,10 @@ public: const ghobject_t& oid, struct stat *st, bool allow_eio = false); + using ObjectStore::set_collection_opts; + int set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts); using ObjectStore::read; int read( const coll_t& cid, diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 9b5a77f733e6..17f4c48a7e73 100755 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -20,6 +20,7 @@ #include #include "KStore.h" +#include "osd/osd_types.h" #include "kv.h" #include "include/compat.h" #include "include/stringify.h" @@ -1155,6 +1156,13 @@ int KStore::stat( return 0; } +int KStore::set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) +{ + return -EOPNOTSUPP; +} + int KStore::read( const coll_t& cid, const ghobject_t& oid, diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 5f5aea6e5f18..b9f5e4caeb25 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -441,6 +441,9 @@ public: const ghobject_t& oid, struct stat *st, bool allow_eio = false); // struct stat? + int set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts); using ObjectStore::read; int read( const coll_t& cid, diff --git a/src/os/memstore/MemStore.cc b/src/os/memstore/MemStore.cc index 2feaa43b8d12..05991ae94642 100644 --- a/src/os/memstore/MemStore.cc +++ b/src/os/memstore/MemStore.cc @@ -302,6 +302,13 @@ int MemStore::stat( return 0; } +int MemStore::set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts) +{ + return -EOPNOTSUPP; +} + int MemStore::read( const coll_t& cid, const ghobject_t& oid, diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 35015fe2b70d..b2d9401f4594 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -290,6 +290,9 @@ public: struct stat *st, bool allow_eio = false) override; int stat(CollectionHandle &c, const ghobject_t& oid, struct stat *st, bool allow_eio = false) override; + int set_collection_opts( + const coll_t& cid, + const pool_opts_t& opts); int read( const coll_t& cid, const ghobject_t& oid,