-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rbd-mirror: integrate single thread pool for all processing
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
- Loading branch information
Jason Dillaman
committed
Mar 8, 2016
1 parent
3496e77
commit 7fd230f
Showing
11 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
|
||
#include "tools/rbd_mirror/Threads.h" | ||
#include "common/Timer.h" | ||
#include "common/WorkQueue.h" | ||
|
||
namespace rbd { | ||
namespace mirror { | ||
|
||
Threads::Threads(CephContext *cct) : timer_lock("Threads::timer_lock") { | ||
thread_pool = new ThreadPool(cct, "Journaler::thread_pool", "tp_journal", | ||
cct->_conf->rbd_op_threads, "rbd_op_threads"); | ||
thread_pool->start(); | ||
|
||
work_queue = new ContextWQ("Journaler::work_queue", | ||
cct->_conf->rbd_op_thread_timeout, thread_pool); | ||
|
||
timer = new SafeTimer(cct, timer_lock, true); | ||
timer->init(); | ||
} | ||
|
||
Threads::~Threads() { | ||
{ | ||
Mutex::Locker timer_locker(timer_lock); | ||
timer->shutdown(); | ||
} | ||
delete timer; | ||
|
||
work_queue->drain(); | ||
delete work_queue; | ||
|
||
thread_pool->stop(); | ||
delete thread_pool; | ||
} | ||
|
||
} // namespace mirror | ||
} // namespace rbd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=8 sw=2 smarttab | ||
|
||
#ifndef CEPH_RBD_MIRROR_THREADS_H | ||
#define CEPH_RBD_MIRROR_THREADS_H | ||
|
||
#include "common/Mutex.h" | ||
|
||
class CephContext; | ||
class ContextWQ; | ||
class SafeTimer; | ||
class ThreadPool; | ||
|
||
namespace rbd { | ||
namespace mirror { | ||
|
||
struct Threads { | ||
ThreadPool *thread_pool = nullptr; | ||
ContextWQ *work_queue = nullptr; | ||
|
||
SafeTimer *timer = nullptr; | ||
Mutex timer_lock; | ||
|
||
explicit Threads(CephContext *cct); | ||
Threads(const Threads&) = delete; | ||
Threads& operator=(const Threads&) = delete; | ||
|
||
~Threads(); | ||
}; | ||
|
||
} // namespace mirror | ||
} // namespace rbd | ||
|
||
#endif // CEPH_RBD_MIRROR_THREADS_H |