MCPcopy Create free account
hub / github.com/ceph/ceph / _queue_discard

Method _queue_discard

src/blk/kernel/KernelDevice.cc:872–903  ·  view source on GitHub ↗

this is private and is expected that the caller checks that discard threads are running via _discard_started()

Source from the content-addressed store, hash-verified

870// this is private and is expected that the caller checks that discard
871// threads are running via _discard_started()
872bool KernelDevice::_queue_discard(interval_set<uint64_t> &to_release)
873{
874 if (to_release.empty())
875 return false;
876
877 auto max_pending = cct->_conf->bdev_async_discard_max_pending;
878
879 std::lock_guard l(discard_lock);
880
881 if (max_pending > 0 && discard_queued.num_intervals() >= max_pending) {
882 discard_cond.notify_one();
883 return false;
884 }
885
886 if(discard_queue_bytes >= cct->_conf->bdev_discard_max_bytes) {
887 discard_cond.notify_one();
888 return false;
889 }
890
891 discard_queued.insert(to_release);
892
893 size_t discarded_bytes = 0;
894 for(auto p = to_release.begin(); p != to_release.end(); ++p){
895 discarded_bytes += p.get_len();
896 }
897 discard_queue_bytes += discarded_bytes;
898
899 discard_queue_length = discard_queued.num_intervals();
900
901 discard_cond.notify_one();
902 return true;
903}
904
905// return true only if discard was queued, so caller won't have to do
906// alloc->release, otherwise return false

Callers

nothing calls this directly

Calls 7

emptyMethod · 0.45
num_intervalsMethod · 0.45
notify_oneMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
get_lenMethod · 0.45

Tested by

no test coverage detected