]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: extend OS interface with set_collection_opts method.
authorIgor Fedotov <ifedotov@mirantis.com>
Fri, 9 Sep 2016 16:42:43 +0000 (19:42 +0300)
committerIgor Fedotov <ifedotov@mirantis.com>
Wed, 19 Oct 2016 14:33:29 +0000 (14:33 +0000)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/ObjectStore.h
src/os/Transaction.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h
src/os/kstore/KStore.cc
src/os/kstore/KStore.h
src/os/memstore/MemStore.cc
src/os/memstore/MemStore.h

index 10b513755df0354509002b3a9a6ce922386fdf67..2eb52b0cd6127fb306b6a3a848b0530b8a4952bf 100644 (file)
@@ -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) {}
index 16b60671347f1cf17a55d5bcdddc3f968dd571f7..aa3136fcebabb9d7eea9a5baa55245098bf4f87f 100644 (file)
@@ -241,7 +241,6 @@ void ObjectStore::Transaction::_build_actions_from_tbl()
        create_collection(cid, 0);
       }
       break;
-
     case Transaction::OP_COLL_HINT:
       {
        coll_t cid;
index 68f74d87bd9c78773106654561cedffcdcd3b298..439163effc81b2f4f30dc64ae1e1c046e2ac4714 100644 (file)
@@ -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<Collection*>(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;
 }
 
+
+
+
 // ===========================================
index acdb8e17b91bcb6feb9b1852e15eaa723f93f85d..5d780fb4ba1a2b590e832f1759a1de53d6fc2832 100644 (file)
@@ -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,
index 96a45da06764059f7af22394625dc0dc1fb0ebe0..94e2fba0fc1e1380674c68f2d8db89bd72f54192 100644 (file)
@@ -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,
index d0c75463b1967a461f65c958fd769504a1328a8b..9d453630b1afef9c4dda8c5d65149ec910934013 100644 (file)
@@ -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,
index 9b5a77f733e67b92ae5de40fb5f71a35c3ced173..17f4c48a7e734f606d444e5db78e6e731772e972 100755 (executable)
@@ -20,6 +20,7 @@
 #include <unistd.h>
 
 #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,
index 5f5aea6e5f184d4c09f308cd2698a24b04186796..b9f5e4caeb25f12f3d56d9929f3730d301c51d87 100644 (file)
@@ -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,
index 2feaa43b8d124a608a733e3f8668a65770995ab8..05991ae9464245c0df92642a616774bdfe36006e 100644 (file)
@@ -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,
index 35015fe2b70de03aa0006a94e6592a5b2f006da7..b2d9401f45942e6c48f29a1499dd9e6150731212 100644 (file)
@@ -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,