]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: add notrim option to rbd map 21056/head
authorHitoshi Kamei <hitoshi.kamei.xm@hitachi.com>
Tue, 27 Mar 2018 06:39:02 +0000 (15:39 +0900)
committerHitoshi Kamei <hitoshi.kamei.xm@hitachi.com>
Tue, 27 Mar 2018 06:39:02 +0000 (15:39 +0900)
Add the notrim option to the rbd map command to avoid
discarding allocated blocks from a fully provisioned image,
and add the description of notrim option to manpage.

When enabled, user programs such as mkfs.xfs will receive -EOPNOTSUPP
if it sends a discard request for an image with this option.

Signed-off-by: Hitoshi Kamei <hitoshi.kamei.xm@hitachi.com>
Cc: Mitsuo Hayasaka <mitsuo.hayasaka.hu@hitachi.com>
doc/man/8/rbd.rst
src/tools/rbd/action/Kernel.cc

index fbbbc9aaecda6e2c8ee0492c720b49f41d02694e..85875d560501de0a9ee43eb4a5037193db7db739 100644 (file)
@@ -661,6 +661,11 @@ Per mapping (block device) `rbd device map` options:
 
 * exclusive - Disable automatic exclusive lock transitions (since 4.12).
 
+* notrim - Turn off discard and write zeroes offload support to avoid
+  deprovisioning a fully provisioned image (since 4.17). When enabled, discard
+  requests will fail with -EOPNOTSUPP, write zeroes requests will fall back to
+  manually zeroing.
+
 `rbd device unmap` options:
 
 * force - Force the unmapping of a block device that is open (since 4.9).  The
index cbcff9c76a3406eb1f58aacb242577dcc048da4d..ae48e1db08602c19ceadf175dab22340ea987fb2 100644 (file)
@@ -143,6 +143,8 @@ static int parse_map_options(const std::string &options_string)
       put_map_option("lock_on_read", this_char);
     } else if (!strcmp(this_char, "exclusive")) {
       put_map_option("exclusive", this_char);
+    } else if (!strcmp(this_char, "notrim")) {
+      put_map_option("notrim", this_char);
     } else {
       std::cerr << "rbd: unknown map option '" << this_char << "'" << std::endl;
       return -EINVAL;