]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rbd: recognize compression_hint map option
authorIlya Dryomov <idryomov@gmail.com>
Wed, 17 Jun 2020 12:13:12 +0000 (14:13 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Fri, 10 Jul 2020 18:12:46 +0000 (20:12 +0200)
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
doc/man/8/rbd.rst
src/tools/rbd/action/Kernel.cc

index ffc651546e9440d74cd3e6aac013b53c1739344d..52a684fcdfe7a613a850661eb0be77d78cf5235f 100644 (file)
@@ -833,6 +833,16 @@ Per mapping (block device) `rbd device map` options:
   require-osd-release octopus").  Otherwise it should be limited to read-only
   workloads such as images mapped read-only everywhere or snapshots.
 
+* compression_hint=none - Don't set compression hints (since 5.8, default).
+
+* compression_hint=compressible - Hint to the underlying OSD object store
+  backend that the data is compressible, enabling compression in passive mode
+  (since 5.8).
+
+* compression_hint=incompressible - Hint to the underlying OSD object store
+  backend that the data is incompressible, disabling compression in aggressive
+  mode (since 5.8).
+
 `rbd device unmap` options:
 
 * force - Force the unmapping of a block device that is open (since 4.9).  The
index 845c79740246183bb2b5e9cd19ea27e864dfaa22..0abdb908732b89ec701e26d195c4ff7a23ec1fcf 100644 (file)
@@ -78,6 +78,15 @@ static std::string map_option_read_from_replica_cb(const char *value_char)
   return "";
 }
 
+static std::string map_option_compression_hint_cb(const char *value_char)
+{
+  if (!strcmp(value_char, "none") || !strcmp(value_char, "compressible") ||
+      !strcmp(value_char, "incompressible")) {
+    return value_char;
+  }
+  return "";
+}
+
 static void put_map_option(const std::string &key, const std::string &val)
 {
   map_options[key] = val;
@@ -175,6 +184,10 @@ static int parse_map_options(const std::string &options_string)
       if (put_map_option_value("read_from_replica", value_char,
                                map_option_read_from_replica_cb))
         return -EINVAL;
+    } else if (!strcmp(this_char, "compression_hint")) {
+      if (put_map_option_value("compression_hint", value_char,
+                               map_option_compression_hint_cb))
+        return -EINVAL;
     } else {
       std::cerr << "rbd: unknown map option '" << this_char << "'" << std::endl;
       return -EINVAL;