From: Sage Weil Date: Fri, 29 Aug 2014 15:29:35 +0000 (-0700) Subject: mds/RecoveryQueue: do not start prioritized items synchronously X-Git-Tag: v0.86~170^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F2258%2Fhead;p=ceph.git mds/RecoveryQueue: do not start prioritized items synchronously When we prioritize an item move it into a second priority list/set, but do not start immediately, so that we still obey the max. When we go to start an item, pull items first off the priority list, then off the regular list. Signed-off-by: Sage Weil --- diff --git a/src/mds/RecoveryQueue.cc b/src/mds/RecoveryQueue.cc index 90ae65edf8e..f811c2c88fe 100644 --- a/src/mds/RecoveryQueue.cc +++ b/src/mds/RecoveryQueue.cc @@ -54,18 +54,27 @@ public: void RecoveryQueue::advance() { dout(10) << file_recover_queue.size() << " queued, " + << file_recover_queue_front.size() << " prioritized, " << file_recovering.size() << " recovering" << dendl; - while (file_recovering.size() < g_conf->mds_max_file_recover && - !file_recover_queue.empty()) { - _start(*file_recover_queue.begin()); + while (file_recovering.size() < g_conf->mds_max_file_recover) { + if (!file_recover_queue_front.empty()) { + CInode *in = *file_recover_queue_front.begin(); + file_recover_queue_front.erase(file_recover_queue_front.begin()); + file_recover_queue.erase(in); + _start(in); + } else if (!file_recover_queue.empty()) { + CInode *in = *file_recover_queue.begin(); + file_recover_queue.erase(file_recover_queue.begin()); + _start(in); + } else { + break; + } } } void RecoveryQueue::_start(CInode *in) { - file_recover_queue.erase(in); - inode_t *pi = in->get_projected_inode(); // blech @@ -100,7 +109,7 @@ void RecoveryQueue::prioritize(CInode *in) if (file_recover_queue.count(in)) { dout(20) << *in << dendl; - _start(in); + file_recover_queue_front.insert(in); return; } diff --git a/src/mds/RecoveryQueue.h b/src/mds/RecoveryQueue.h index 41b2dcf0fed..18058f08b28 100644 --- a/src/mds/RecoveryQueue.h +++ b/src/mds/RecoveryQueue.h @@ -32,7 +32,8 @@ public: private: void _start(CInode *in); ///< start recovering this file - std::set file_recover_queue; + std::set file_recover_queue; ///< the queue + std::set file_recover_queue_front; ///< elevated priority items std::set file_recovering; void _recovered(CInode *in, int r, uint64_t size, utime_t mtime); MDS *mds;