]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: make rbd_read_from_replica_policy actually work 35332/head
authorIlya Dryomov <idryomov@gmail.com>
Sat, 30 May 2020 17:03:20 +0000 (19:03 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 1 Jun 2020 07:43:53 +0000 (09:43 +0200)
Commit d92be8b5856d ("librbd: Improved support for balanced and
localized reads") introduced read_flags, but used low-level Objecter
flags (CEPH_OSD_FLAG_*).  This is wrong because librbd sits on top of
librados, not Objecter.  "balance" ends up being translated into
IGNORE_REDIRECT and "localize" being ignored.

Fixes: https://tracker.ceph.com/issues/45798
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h

index a2a3f1f2440278b22b67f0fe347651f2ca699814..8d71a8e061c5b3bc6cd7738debdc85730f48d3d9 100644 (file)
@@ -808,9 +808,9 @@ public:
       read_flags = 0;
       auto read_policy = config.get_val<std::string>("rbd_read_from_replica_policy");
       if (read_policy == "balance") {
-        read_flags |= CEPH_OSD_FLAG_BALANCE_READS;
+        read_flags |= librados::OPERATION_BALANCE_READS;
       } else if (read_policy == "localize") {
-        read_flags |= CEPH_OSD_FLAG_LOCALIZE_READS;
+        read_flags |= librados::OPERATION_LOCALIZE_READS;
       }
     }
 
index d1c2ef135cd994e33b4bd2d97e6e1bb144c1f34e..b2b15b7455c751bff5f88a9ef6218a99501a9e4c 100644 (file)
@@ -137,7 +137,7 @@ namespace librbd {
     ceph::mutex async_ops_lock; // protects async_ops and async_requests
     ceph::mutex copyup_list_lock; // protects copyup_waiting_list
 
-    unsigned extra_read_flags;
+    unsigned extra_read_flags;  // librados::OPERATION_*
 
     bool old_format;
     uint8_t order;
@@ -211,7 +211,7 @@ namespace librbd {
     bool clone_copy_on_read;
     bool enable_alloc_hint;
     uint32_t alloc_hint_flags = 0U;
-    uint32_t read_flags = 0U;
+    uint32_t read_flags = 0U;  // librados::OPERATION_*
     uint32_t discard_granularity_bytes = 0;
     bool blkin_trace_all;
     uint64_t mirroring_replay_delay;