From fa32d97a9fd76ac931f417e1e2fcc9177ee40105 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Thu, 31 Jan 2019 16:59:11 +0100 Subject: [PATCH] rbd: recognize alloc_size map option Signed-off-by: Ilya Dryomov --- doc/man/8/rbd.rst | 7 +++++++ src/tools/rbd/action/Kernel.cc | 3 +++ 2 files changed, 10 insertions(+) diff --git a/doc/man/8/rbd.rst b/doc/man/8/rbd.rst index b8fd324804c..928dda028e5 100644 --- a/doc/man/8/rbd.rst +++ b/doc/man/8/rbd.rst @@ -751,6 +751,13 @@ Per mapping (block device) `rbd device map` options: the data pool reaches its quota (since 5.0). The default behaviour is to block until the full condition is cleared. +* alloc_size - Minimum allocation unit of the underlying OSD object store + backend (since 5.1, default is 64K bytes). This is used to round off and + drop discards that are too small. For bluestore, the recommended setting is + bluestore_min_alloc_size (typically 64K for hard disk drives and 16K for + solid-state drives). For filestore with filestore_punch_hole = false, the + recommended setting is image object size (typically 4M). + `rbd device unmap` options: * force - Force the unmapping of a block device that is open (since 4.9). The diff --git a/src/tools/rbd/action/Kernel.cc b/src/tools/rbd/action/Kernel.cc index f3e18f96a20..3ebb5bc1de4 100644 --- a/src/tools/rbd/action/Kernel.cc +++ b/src/tools/rbd/action/Kernel.cc @@ -150,6 +150,9 @@ static int parse_map_options(const std::string &options_string) put_map_option("notrim", this_char); } else if (!strcmp(this_char, "abort_on_full")) { put_map_option("abort_on_full", this_char); + } else if (!strcmp(this_char, "alloc_size")) { + if (put_map_option_value("alloc_size", value_char, map_option_int_cb)) + return -EINVAL; } else { std::cerr << "rbd: unknown map option '" << this_char << "'" << std::endl; return -EINVAL; -- 2.39.5