From 94a39642583f6529c4589f5316e0999d36e143a1 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 19 Aug 2016 10:30:49 +0800 Subject: [PATCH 1/4] os/bluestore: fix race condition during get_fs_usage() file_map should be accessed under the protection of the global lock. Signed-off-by: xie xingguo --- src/os/bluestore/BlueFS.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 9976b4ed21932..61670a418b2ea 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -183,6 +183,7 @@ int BlueFS::reclaim_blocks(unsigned id, uint64_t want, uint64_t BlueFS::get_fs_usage() { + std::lock_guard l(lock); uint64_t total_bytes = 0; for (auto& p : file_map) { total_bytes += p.second->fnode.get_allocated(); From 8495245041b24c5661201f7a64f2b04f64615535 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 19 Aug 2016 11:20:31 +0800 Subject: [PATCH 2/4] os/bluestore: use bluefs_max_prefetch for log file prefetch Signed-off-by: xie xingguo --- src/os/bluestore/BlueFS.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 61670a418b2ea..dedc526a4edfd 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -473,7 +473,7 @@ int BlueFS::_replay(bool noop) dout(10) << __func__ << " log_fnode " << super.log_fnode << dendl; FileReader *log_reader = new FileReader( - log_file, g_conf->bluefs_alloc_size, + log_file, g_conf->bluefs_max_prefetch, false, // !random true); // ignore eof while (true) { From 0c815789c4735e1e8c151c6c4df07ebe92308798 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 19 Aug 2016 14:11:58 +0800 Subject: [PATCH 3/4] os/bluestore: use hex if we are running out of space Signed-off-by: xie xingguo --- src/os/bluestore/BlueFS.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index dedc526a4edfd..c5fe0867cb909 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1379,8 +1379,9 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) offset + length - allocated, &h->file->fnode.extents); if (r < 0) { - derr << __func__ << " allocated: " << allocated << \ - " offset: " << offset << " length: " << length << dendl; + derr << __func__ << " allocated: 0x" << std::hex << allocated + << " offset: 0x" << offset << " length: 0x" << length << std::dec + << dendl; return r; } must_dirty = true; From d2cfbb9376d2d652737a3b40cf42b3fe115d4ec4 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 19 Aug 2016 14:13:05 +0800 Subject: [PATCH 4/4] os/bluestore: fix assert This assert is used to guarantee that we don't access violation but currently has no effect. Signed-off-by: xie xingguo --- src/os/bluestore/BlueFS.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index c5fe0867cb909..eaefe16f74a80 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1483,9 +1483,10 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) x_off = 0; } for (unsigned i = 0; i < MAX_BDEV; ++i) { - if (bdev[i] && h->iocv[i]->has_aios()) { + if (bdev[i]) { assert(h->iocv[i]); - bdev[i]->aio_submit(h->iocv[i]); + if (h->iocv[i]->has_aios()) + bdev[i]->aio_submit(h->iocv[i]); } } dout(20) << __func__ << " h " << h << " pos now 0x"