]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: change tier-flush's operation type to ReadOperation
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 21 Apr 2020 09:36:21 +0000 (05:36 -0400)
committermyoungwon oh <ohmyoungwon@gmail.com>
Sun, 14 Jun 2020 06:45:16 +0000 (15:45 +0900)
existing flush is the ReadOperation in order to flush older
clone that head.
Like existing flush, change tier-flush's type to ReadOperation

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
src/include/rados.h
src/include/rados/librados.hpp
src/librados/librados_cxx.cc
src/osd/PrimaryLogPG.cc
src/test/osd/RadosModel.h
src/tools/rados/rados.cc

index 9cf6d6289863d704900562974b3925f12498329a..1921ae1c9e0c7d4b4fcf34e502cb49e51011ac12 100644 (file)
@@ -326,7 +326,7 @@ extern const char *ceph_osd_state_name(int s);
        f(SET_CHUNK,    __CEPH_OSD_OP(WR, DATA, 40),    "set-chunk")        \
        f(TIER_PROMOTE, __CEPH_OSD_OP(WR, DATA, 41),    "tier-promote")     \
        f(UNSET_MANIFEST, __CEPH_OSD_OP(WR, DATA, 42),  "unset-manifest")   \
-       f(TIER_FLUSH, __CEPH_OSD_OP(WR, DATA, 43),      "tier-flush")       \
+       f(TIER_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 43),   "tier-flush")       \
                                                                            \
        /** attrs **/                                                       \
        /* read */                                                          \
index 53aa31925d614d72b4ab9760f963bfb2ee53bd56..60f02852ba3ba5c06066705fcd31494abff22797 100644 (file)
@@ -518,7 +518,6 @@ inline namespace v14_2_0 {
                    std::string tgt_oid, uint64_t tgt_offset, int flag = 0);
     void tier_promote();
     void unset_manifest();
-    void tier_flush();
 
 
     friend class IoCtx;
@@ -733,6 +732,12 @@ inline namespace v14_2_0 {
      * triggering a promote on the OSD (that is then evicted).
      */
     void cache_evict();
+
+    /**
+     * flush a manifest tier object to backing tier; will block racing
+     * updates.
+     */
+    void tier_flush();
   };
 
   /* IoCtx : This is a context in which we can perform I/O.
index bc399ea82e51ab48432eadd3f90f2c78095d952d..38144ad17c80bc8e6ee43ef07cf35873cc625349 100644 (file)
@@ -631,6 +631,13 @@ void librados::ObjectReadOperation::cache_evict()
   o->cache_evict();
 }
 
+void librados::ObjectReadOperation::tier_flush()
+{
+  ceph_assert(impl);
+  ::ObjectOperation *o = &impl->o;
+  o->tier_flush();
+}
+
 void librados::ObjectWriteOperation::set_redirect(const std::string& tgt_obj, 
                                                  const IoCtx& tgt_ioctx,
                                                  uint64_t tgt_version,
@@ -669,13 +676,6 @@ void librados::ObjectWriteOperation::unset_manifest()
   o->unset_manifest();
 }
 
-void librados::ObjectWriteOperation::tier_flush()
-{
-  ceph_assert(impl);
-  ::ObjectOperation *o = &impl->o;
-  o->tier_flush();
-}
-
 void librados::ObjectWriteOperation::tmap_update(const bufferlist& cmdbl)
 {
   ceph_assert(impl);
index 1746ea8f1ec0e8c13c4adfa93a51d51b53aaa251..9ff5dd059494361b6fa1df3ac150b17ea0eb2c13 100644 (file)
@@ -6994,7 +6994,8 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          result = -EOPNOTSUPP;
          break;
        }
-       if (soid.has_snapset()) {
+       if (ctx->snapc.snaps.size() || 
+           (ctx->obc->ssc && ctx->obc->ssc->snapset.clones.size()) ) {
          result = -EOPNOTSUPP;
          break;
        }
index 0825ae93863fbdf050e03de9f15a849cf2653361..734ca3e3765eeb0db81772fccdf53feeaea0a6c3 100644 (file)
@@ -2700,7 +2700,7 @@ public:
 class TierFlushOp : public TestOp {
 public:
   librados::AioCompletion *completion;
-  librados::ObjectWriteOperation op;
+  librados::ObjectReadOperation op;
   string oid;
   std::shared_ptr<int> in_use;
 
@@ -2728,8 +2728,9 @@ public:
     context->state_lock.unlock();
 
     op.tier_flush();
+    unsigned flags = librados::OPERATION_IGNORE_CACHE;
     int r = context->io_ctx.aio_operate(context->prefix+oid, completion,
-                                       &op);
+                                       &op, flags, NULL);
     ceph_assert(!r);
   }
 
index 9af05cfdf6d5b8cb41afd808f3551065aad48aad..6fb306ba655ecd8f2404a192b68ec8332a989404 100644 (file)
@@ -3789,9 +3789,17 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
     }
     string oid(nargs[1]);
 
-    ObjectWriteOperation op;
+    ObjectReadOperation op;
     op.tier_flush();
-    ret = io_ctx.operate(oid, &op);
+    librados::AioCompletion *completion =
+      librados::Rados::aio_create_completion();
+    io_ctx.aio_operate(oid.c_str(), completion, &op,
+                      librados::OPERATION_IGNORE_CACHE |
+                      librados::OPERATION_IGNORE_OVERLAY,
+                      NULL);
+    completion->wait_for_complete();
+    ret = completion->get_return_value();
+    completion->release();
     if (ret < 0) {
       cerr << "error tier-flush " << pool_name << "/" << oid << " : " 
           << cpp_strerror(ret) << std::endl;