Skip to content

Commit b37080c

Browse files
committed
style changes requested by Igor
Signed-off-by: Gabriel BenHanokh <[email protected]>
1 parent 1e10a9b commit b37080c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/blk/kernel/KernelDevice.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ void KernelDevice::_discard_thread(uint64_t tid)
765765
// This will allow threads to work in parallel
766766
// instead of a single thread taking over the whole discard_queued.
767767
// It will also allow threads to finish in a timely manner.
768-
constexpr unsigned MAX_LOCAL_DISCARD = 10;
768+
constexpr unsigned MAX_LOCAL_DISCARD = 32;
769769
unsigned count = 0;
770770
for (auto p = discard_queued.begin();
771771
p != discard_queued.end() && count < MAX_LOCAL_DISCARD;

src/os/bluestore/BlueStore.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7762,24 +7762,22 @@ void BlueStore::_close_db()
77627762
db = nullptr;
77637763

77647764
if (do_destage && fm && fm->is_null_manager()) {
7765-
if (cct->_conf->osd_fast_shutdown == false) {
7766-
// graceful shutdown -> commit backgrounds discards before storing allocator
7767-
bdev->discard_drain();
7768-
}
7769-
7770-
interval_set<uint64_t> discard_queued;
7771-
bdev->swap_discard_queued(discard_queued);
7772-
if (discard_queued.num_intervals() > 0) {
7765+
if (cct->_conf->osd_fast_shutdown) {
7766+
interval_set<uint64_t> discard_queued;
7767+
bdev->swap_discard_queued(discard_queued);
77737768
dout(10) << __func__ << "::discard_drain: size=" << discard_queued.size()
77747769
<< " num_intervals=" << discard_queued.num_intervals() << dendl;
77757770
// copy discard_queued to the allocator before storing it
77767771
for (auto p = discard_queued.begin(); p != discard_queued.end(); ++p) {
7777-
dout(20) << __func__ << "::discarded-extent=[" << p.get_start() << ", " << p.get_len() << "]" << dendl;
7772+
dout(20) << __func__ << "::discarded-extent=[" << p.get_start()
7773+
<< ", " << p.get_len() << "]" << dendl;
77787774
alloc->init_add_free(p.get_start(), p.get_len());
77797775
}
77807776
}
7781-
// drain the items in the threads local discard_processing queues
7782-
// There are only a few items in those queues so it is fine to do so in fast shutdown
7777+
7778+
// When we reach here it is either a graceful shutdown (so can drain the full discards-queue)
7779+
// or it was a fast shutdown, but we already moved the main discards-queue to the allocator
7780+
// and only need to wait for the threads local discard_processing queues to drain
77837781
bdev->discard_drain();
77847782
int ret = store_allocator(alloc);
77857783
if (unlikely(ret != 0)) {

0 commit comments

Comments
 (0)