]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: support new alloc_hint flags
authorSage Weil <sage@redhat.com>
Thu, 8 Oct 2015 19:34:40 +0000 (15:34 -0400)
committerSage Weil <sage@redhat.com>
Sat, 14 May 2016 13:20:00 +0000 (09:20 -0400)
Pass these through to the ObjectStore.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/ObjectStore.h
src/os/Transaction.cc
src/osd/ECTransaction.cc
src/osd/ECTransaction.h
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedPG.cc
src/test/objectstore/store_test.cc

index aacf642d546cad8eed9f826736cd2042586b670e..516761087859ade5a471f5f379ef57ee00c15b8b 100644 (file)
@@ -426,7 +426,14 @@ public:
       __le32 dest_cid;
       __le32 dest_oid;                  //OP_CLONE, OP_CLONERANGE
       __le64 dest_off;                  //OP_CLONERANGE
-      __le32 hint_type;                 //OP_COLL_HINT
+      union {
+       struct {
+         __le32 hint_type;             //OP_COLL_HINT
+       };
+       struct {
+         __le32 alloc_hint_flags;      //OP_SETALLOCHINT
+       };
+      };
       __le64 expected_object_size;      //OP_SETALLOCHINT
       __le64 expected_write_size;       //OP_SETALLOCHINT
       __le32 split_bits;                //OP_SPLIT_COLLECTION2
@@ -1722,7 +1729,8 @@ public:
       coll_t cid,
       const ghobject_t &oid,
       uint64_t expected_object_size,
-      uint64_t expected_write_size
+      uint64_t expected_write_size,
+      uint32_t flags
     ) {
       if (use_tbl) {
         __u32 op = OP_SETALLOCHINT;
@@ -1738,6 +1746,7 @@ public:
         _op->oid = _get_object_id(oid);
         _op->expected_object_size = expected_object_size;
         _op->expected_write_size = expected_write_size;
+       _op->alloc_hint_flags = flags;
       }
       data.ops++;
     }
index 60281049634b8eb78c0bab5f50e9778cee11deca..68ff6d6a837951586d0ac9ee6646444afbb0fd14 100644 (file)
@@ -506,7 +506,7 @@ void ObjectStore::Transaction::_build_actions_from_tbl()
        ::decode(expected_object_size, p);
        ::decode(expected_write_size, p);
 
-       set_alloc_hint(cid, oid, expected_object_size, expected_write_size);
+       set_alloc_hint(cid, oid, expected_object_size, expected_write_size, 0);
       }
       break;
 
index 64dd89feac2c93bfd58d1d8f3ea6853afaf7e181..7661ddcd8b9c24b0143c481b1b7f691b9772ac00 100644 (file)
@@ -265,7 +265,7 @@ struct TransGenerator : public boost::static_visitor<void> {
       i->second.set_alloc_hint(
         get_coll_ct(i->first, op.oid),
         ghobject_t(op.oid, ghobject_t::NO_GEN, i->first),
-        object_size, write_size);
+        object_size, write_size, op.flags);
     }
   }
   void operator()(const ECTransaction::NoOp &op) {}
index 17be72265cba4169cf42bd31a28be6dfe1d1f2d8..236da76002210cab89a024d2fa9c7b5f756d29ee 100644 (file)
@@ -79,11 +79,15 @@ public:
     hobject_t oid;
     uint64_t expected_object_size;
     uint64_t expected_write_size;
+    uint32_t flags;
     AllocHintOp(const hobject_t &oid,
                 uint64_t expected_object_size,
-                uint64_t expected_write_size)
-      : oid(oid), expected_object_size(expected_object_size),
-        expected_write_size(expected_write_size) {}
+                uint64_t expected_write_size,
+               uint32_t flags)
+      : oid(oid),
+       expected_object_size(expected_object_size),
+        expected_write_size(expected_write_size),
+       flags(flags) {}
   };
   struct NoOp {};
   typedef boost::variant<
@@ -158,8 +162,10 @@ public:
   void set_alloc_hint(
     const hobject_t &hoid,
     uint64_t expected_object_size,
-    uint64_t expected_write_size) {
-    ops.push_back(AllocHintOp(hoid, expected_object_size, expected_write_size));
+    uint64_t expected_write_size,
+    uint32_t flags) {
+    ops.push_back(AllocHintOp(hoid, expected_object_size, expected_write_size,
+                             flags));
   }
 
   void append(PGTransaction *_to_append) {
index f88c1a08af76441a523760c933d6bfed156eeb0f..8dad866766df11a768f5d3653a243916b8928ebf 100644 (file)
@@ -400,7 +400,8 @@ struct shard_info_wrapper;
      virtual void set_alloc_hint(
        const hobject_t &hoid,
        uint64_t expected_object_size,
-       uint64_t expected_write_size
+       uint64_t expected_write_size,
+       uint32_t flags
        ) = 0;
 
      /// Optional, not supported on ec-pool
index 1411126e8684b90a6fdcd9e875be3f829cffd849..28295cde838d8748492b90c224f3a67719b022ea 100644 (file)
@@ -473,10 +473,11 @@ public:
   void set_alloc_hint(
     const hobject_t &hoid,
     uint64_t expected_object_size,
-    uint64_t expected_write_size
+    uint64_t expected_write_size,
+    uint32_t flags
     ) {
     t.set_alloc_hint(get_coll(hoid), ghobject_t(hoid), expected_object_size,
-                      expected_write_size);
+                    expected_write_size, flags);
   }
 
   using PGBackend::PGTransaction::append;
index 43ef40ffb9982136ba29c96b39d146266c26f990..51fe13112cbc67e1af5e5106b308288338c4b36c 100644 (file)
@@ -4962,7 +4962,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
           t->touch(soid);
        }
         t->set_alloc_hint(soid, op.alloc_hint.expected_object_size,
-                          op.alloc_hint.expected_write_size);
+                          op.alloc_hint.expected_write_size,
+                         op.alloc_hint.flags);
         ctx->delta_stats.num_wr++;
         result = 0;
       }
index 9a5de2e629f3cefdc5c4e6f1c14e210911f25e06..98b02d2717096bf861e7719f244ccbdcb7bb97a8 100644 (file)
@@ -3588,7 +3588,7 @@ TEST_P(StoreTest, SetAllocHint) {
   }
   {
     ObjectStore::Transaction t;
-    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
+    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4, 0);
     r = apply_transaction(store, &osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
@@ -3600,7 +3600,7 @@ TEST_P(StoreTest, SetAllocHint) {
   }
   {
     ObjectStore::Transaction t;
-    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
+    t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4, 0);
     r = apply_transaction(store, &osr, std::move(t));
     ASSERT_EQ(r, 0);
   }