From cf6ca244f64bb0ec2fbb4f2e16062f84bd9c12f8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 11 Jan 2016 17:22:11 -0500 Subject: [PATCH] os/bluestore: add flag to make reads default to buffered Signed-off-by: Sage Weil --- src/common/config_opts.h | 1 + src/os/bluestore/BlueStore.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index bda1653533ba9..88ebb141fe6f9 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -887,6 +887,7 @@ OPTION(bluestore_overlay_max, OPT_INT, 0) OPTION(bluestore_open_by_handle, OPT_BOOL, true) OPTION(bluestore_o_direct, OPT_BOOL, true) OPTION(bluestore_clone_cow, OPT_BOOL, true) // do copy-on-write for clones +OPTION(bluestore_default_buffered_read, OPT_BOOL, false) OPTION(bluestore_debug_misc, OPT_BOOL, false) OPTION(bluestore_debug_no_reuse_blocks, OPT_BOOL, false) OPTION(bluestore_debug_small_allocations, OPT_INT, 0) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ac602e513aecd..4cf1500d695ff 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2373,6 +2373,11 @@ int BlueStore::_do_read( if (op_flags & CEPH_OSD_OP_FLAG_FADVISE_WILLNEED) { dout(20) << __func__ << " will do buffered read" << dendl; buffered = true; + } else if (g_conf->bluestore_default_buffered_read && + (op_flags & (CEPH_OSD_OP_FLAG_FADVISE_DONTNEED | + CEPH_OSD_OP_FLAG_FADVISE_NOCACHE)) == 0) { + dout(20) << __func__ << " defaulting to buffered read" << dendl; + buffered = true; } dout(20) << __func__ << " " << offset << "~" << length << " size " -- 2.39.5