summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2020-07-29 14:30:11 +0200
committerGitHub <noreply@github.com>2020-07-29 14:30:11 +0200
commit4eb8c5607ef2bc79e0904d3b9a487a0a99fd7bf2 (patch)
tree05356178157c85cf598c37fac91ef9465f48cad0
parentMerge pull request #36232 from mgfritch/cephadm-ok-to-stop (diff)
parentos/bluestore/BlueFS: Don't flush unused device. (diff)
downloadceph-4eb8c5607ef2bc79e0904d3b9a487a0a99fd7bf2.tar.xz
ceph-4eb8c5607ef2bc79e0904d3b9a487a0a99fd7bf2.zip
Merge pull request #36295 from majianpeng/bluefs-reduce-unnecessary-flush
os/bluestore/BlueFS: Don't flush unused device. Reviewed-by: Igor Fedotov <ifedotov@suse.com>
-rw-r--r--src/os/bluestore/BlueFS.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc
index 44d2655bcdc..3cb41903bb1 100644
--- a/src/os/bluestore/BlueFS.cc
+++ b/src/os/bluestore/BlueFS.cc
@@ -3093,9 +3093,12 @@ void BlueFS::flush_bdev()
{
// NOTE: this is safe to call without a lock.
dout(20) << __func__ << dendl;
- for (auto p : bdev) {
- if (p)
- p->flush();
+ for (unsigned i = 0; i < MAX_BDEV; i++) {
+ // alloc space from BDEV_SLOW is unexpected.
+ // So most cases we don't alloc from BDEV_SLOW and so avoiding flush not-used device.
+ if (bdev[i] && ((i != BDEV_SLOW) || (block_all[i].size() - alloc[i]->get_free()))) {
+ bdev[i]->flush();
+ }
}
}